浏览代码

初始化用户地区 和 APP设置更新值2

chenshibin 4 年之前
父节点
当前提交
5122bf76d0
共有 1 个文件被更改,包括 11 次插入8 次删除
  1. 11 8
      Controller/AppSetController.py

+ 11 - 8
Controller/AppSetController.py

@@ -65,25 +65,28 @@ class AppSetView(View):
             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:
-                if sm_qs[0]['editionUpgrading']:
-                    if lang !='cn':
-                        sm_qs[0]['editionUpgrading'] = 'Upgrading, please sign in later'
-                    else:
-                        sm_qs[0]['editionUpgrading'] = '正在升级,请稍后登录'
 
                 sm_qs = sm_qs.values("content")
                 # 添加到缓存,缓存时间为3600秒------指的是一个钟后再次访问,就会刷新缓存一次
-                content_json_str = list(sm_qs)[0]['content'].replace("'", '"')
+                dict_json = json.loads(sm_qs[0]['content'])
+                if 'editionUpgrading' in dict_json and dict_json['editionUpgrading'] == 1:
+                    if lang !='cn':
+                        dict_json['editionUpgrading'] = 'Upgrading, please sign in later'
+                    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, json.loads(list(sm_qs)[0]['content']))
+                return response.json(0, content_json_str)
             else:
                 return response.json(173)
         else: