|
@@ -58,47 +58,21 @@ class AppSetView(View):
|
|
lang = request_dict.get('lang', None)
|
|
lang = request_dict.get('lang', None)
|
|
appBundleId = request_dict.get('appBundleId', None)
|
|
appBundleId = request_dict.get('appBundleId', None)
|
|
if not appBundleId:
|
|
if not appBundleId:
|
|
- return response.json(444,'appBundleId')
|
|
|
|
- redis = RedisObject()
|
|
|
|
-
|
|
|
|
- if SERVER_TYPE != "Ansjer.formal_settings":
|
|
|
|
- key_id= "www"+appBundleId
|
|
|
|
- else:
|
|
|
|
- key_id = "test" + appBundleId
|
|
|
|
- #redis_value = redis.get_data(key=key_id) 去除到缓存中找
|
|
|
|
- redis_value = False
|
|
|
|
- if redis_value == False:
|
|
|
|
- print('添加到缓存')
|
|
|
|
- # 查数据库
|
|
|
|
- sm_qs = AppSetModel.objects.filter(appBundleId=appBundleId)
|
|
|
|
- count = sm_qs.count()
|
|
|
|
- if count > 0:
|
|
|
|
|
|
+ return response.json(444, 'appBundleId')
|
|
|
|
|
|
- sm_qs = sm_qs.values("content")
|
|
|
|
- # 添加到缓存,缓存时间为3600秒------指的是一个钟后再次访问,就会刷新缓存一次
|
|
|
|
- dict_json = json.loads(sm_qs[0]['content'])
|
|
|
|
- if 'editionUpgrading' in dict_json :
|
|
|
|
- if dict_json['editionUpgrading'] == 1:
|
|
|
|
- if lang !='cn':
|
|
|
|
- dict_json['editionUpgrading'] = 'Upgrading, please sign in later'
|
|
|
|
- else:
|
|
|
|
- dict_json['editionUpgrading'] = '正在升级,请稍后登录'
|
|
|
|
- else:
|
|
|
|
- dict_json['editionUpgrading'] = ''
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- content_json_str = dict_json
|
|
|
|
-
|
|
|
|
- redis.set_data(key=key_id, val=content_json_str, expire=3600)
|
|
|
|
- # 返回固定值
|
|
|
|
- return response.json(0, content_json_str)
|
|
|
|
|
|
+ app_set_qs = AppSetModel.objects.filter(appBundleId=appBundleId).values('content')
|
|
|
|
+ if not app_set_qs.exists():
|
|
|
|
+ return response.json(173)
|
|
|
|
+ dict_json = json.loads(app_set_qs[0]['content'])
|
|
|
|
+ if 'editionUpgrading' in dict_json:
|
|
|
|
+ if dict_json['editionUpgrading'] == 1:
|
|
|
|
+ if lang == 'cn':
|
|
|
|
+ dict_json['editionUpgrading'] = '正在升级,请稍后登录'
|
|
|
|
+ else:
|
|
|
|
+ dict_json['editionUpgrading'] = 'Upgrading, please sign in later'
|
|
else:
|
|
else:
|
|
- return response.json(173)
|
|
|
|
- else:
|
|
|
|
- print('去缓存找')
|
|
|
|
- # 返回固定值
|
|
|
|
- return response.json(0, json.loads(redis_value))
|
|
|
|
|
|
+ dict_json['editionUpgrading'] = ''
|
|
|
|
+ return response.json(0, dict_json)
|
|
|
|
|
|
# res = {}
|
|
# res = {}
|
|
# res['grade'] = 1
|
|
# res['grade'] = 1
|