Browse Source

app控制接口新增促销弹窗消息,时间
云存套餐列表新增促销信息

lang 3 years ago
parent
commit
293e0a5dfc
2 changed files with 22 additions and 4 deletions
  1. 7 1
      Controller/AppSetController.py
  2. 15 3
      Controller/CloudStorage.py

+ 7 - 1
Controller/AppSetController.py

@@ -12,7 +12,7 @@
 @Contact: chanjunkai@163.com
 @Contact: chanjunkai@163.com
 """
 """
 from Ansjer.config import SERVER_TYPE
 from Ansjer.config import SERVER_TYPE
-from Model.models import AppSetModel
+from Model.models import AppSetModel,PromotionRuleModel
 from django.views.generic.base import View
 from django.views.generic.base import View
 from Object.RedisObject import RedisObject
 from Object.RedisObject import RedisObject
 from Object.TokenObject import TokenObject
 from Object.TokenObject import TokenObject
@@ -67,6 +67,12 @@ class AppSetView(View):
             if not app_set_qs[0]['content']:
             if not app_set_qs[0]['content']:
                 return response.json(0)
                 return response.json(0)
             dict_json = json.loads(app_set_qs[0]['content'])
             dict_json = json.loads(app_set_qs[0]['content'])
+            #加入促销弹窗
+            promotion = PromotionRuleModel.objects.filter(status=1).values('startTime','endTime','popups')
+            if promotion.exists():
+                dict_json['popupsStartTime'] = promotion[0]['startTime']
+                dict_json['popupsEndTime'] = promotion[0]['endTime']
+                dict_json['popupsContent'] = json.loads(promotion[0]['popups']).get(lang,'')
             if 'editionUpgrading' in dict_json:
             if 'editionUpgrading' in dict_json:
                 if dict_json['editionUpgrading'] == 1:
                 if dict_json['editionUpgrading'] == 1:
                     if lang == 'cn':
                     if lang == 'cn':

+ 15 - 3
Controller/CloudStorage.py

@@ -235,8 +235,20 @@ class CloudStorageView(View):
             #是否促销
             #是否促销
             nowTime = int(time.time())
             nowTime = int(time.time())
             promotion = PromotionRuleModel.objects.filter(status=1, startTime__lte=nowTime,
             promotion = PromotionRuleModel.objects.filter(status=1, startTime__lte=nowTime,
-                                                          endTime__gte=nowTime).values('id','ruleConfig')
-            is_promotion = 1 if promotion.exists() else 0
+                                                          endTime__gte=nowTime).values('id','ruleConfig','ruleName',
+                                                                                       'startTime','endTime','ruleDesc')
+            if promotion.exists():
+                promotion = {
+                    'is_promotion': 1,
+                    'promotionStartTime': promotion[0]['startTime'],
+                    'promotionEndTime': promotion[0]['endTime'],
+                    'promotionName': json.loads(promotion[0]['ruleName']).get(lang, ''),
+                    'promotionDesc': json.loads(promotion[0]['ruleDesc']).get(lang, '')
+                }
+            else:
+                promotion = {
+                    'is_promotion': 0
+                }
             result = {
             result = {
                 'meals': res,
                 'meals': res,
                 'extra':
                 'extra':
@@ -244,7 +256,7 @@ class CloudStorageView(View):
                         'cloud_banner': SERVER_DOMAIN+'web/images/cloud_cn_banner.png',
                         'cloud_banner': SERVER_DOMAIN+'web/images/cloud_cn_banner.png',
                         'cloud_en_baner': SERVER_DOMAIN_SSL+'web/images/cloud_en_banner.png'
                         'cloud_en_baner': SERVER_DOMAIN_SSL+'web/images/cloud_en_banner.png'
                     },
                     },
-                'is_promotion':is_promotion
+                'promotion':promotion
             }
             }
             return response.json(0, result)
             return response.json(0, result)
         else:
         else: