Exemplo n.º 1
0
 def getCloudPHPExt(self, get):
     import json
     try:
         if 'php_ext' in session: return True
         if not session.get('download_url'):
             session['download_url'] = 'http://download.bt.cn'
         download_url = session['download_url'] + '/install/lib/phplib.json'
         tstr = public.httpGet(download_url)
         data = json.loads(tstr)
         if not data: return False
         public.writeFile('data/phplib.conf', json.dumps(data))
         session['php_ext'] = True
         return True
     except:
         return False
Exemplo n.º 2
0
 def get_business_plugin(self, get):
     try:
         if not session.get('get_product_list') or not os.path.exists(
                 self.__product_list_path):
             data = self.send_cloud(
                 '{}/api/product/chargeProducts'.format(
                     self.__official_url), {})
             if data['success']:
                 public.writeFile(self.__product_list_path,
                                  json.dumps(data['res']))
             session['get_product_list'] = True
         data = json.loads(public.readFile(self.__product_list_path))
         return data
     except:
         return None