|
@@ -5,9 +5,11 @@ import time
|
|
|
from django.db import transaction
|
|
|
from django.views.generic.base import View
|
|
|
|
|
|
-from Ansjer.config import SERVER_TYPE
|
|
|
+from Ansjer.config import SERVER_TYPE, CONFIG_INFO, CONFIG_TEST
|
|
|
from Model.models import AppSetModel, PromotionRuleModel, PopupsConfig, RedDotsConfig, Device_Info, UidSetModel, \
|
|
|
UserOperationLog, Order_Model, IPAddr, RegionRestriction, UserSetStatus
|
|
|
+from Object.Enums.ConstantEnum import ConstantEnum
|
|
|
+from Object.Enums.RedisKeyConstant import RedisKeyConstant
|
|
|
from Object.IPWeatherObject import IPQuery
|
|
|
from Object.RedisObject import RedisObject
|
|
|
from Object.ResponseObject import ResponseObject
|
|
@@ -53,6 +55,8 @@ class AppSetView(View):
|
|
|
return self.status_by_ip(user_id, request, response)
|
|
|
elif operation == 'userSetAdStatus':
|
|
|
return self.user_set_ad_status(user_id, request_dict, response)
|
|
|
+ elif operation == 'promotionTime':
|
|
|
+ return self.promotion_time(user_id, response)
|
|
|
else:
|
|
|
return response.json(414)
|
|
|
|
|
@@ -368,3 +372,24 @@ class AppSetView(View):
|
|
|
except Exception as e:
|
|
|
LOGGER.info('设置用户广告状态异常,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
return response.json(500)
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def promotion_time(user_id, response):
|
|
|
+ """
|
|
|
+ 促销时间
|
|
|
+ @return:
|
|
|
+ """
|
|
|
+ redis_obj = RedisObject()
|
|
|
+ distribute_key = RedisKeyConstant.CLOUD_STORAGE_COUPONS.value + user_id
|
|
|
+ is_distributed = redis_obj.get_data(distribute_key)
|
|
|
+ if is_distributed == '1':
|
|
|
+ if CONFIG_INFO == CONFIG_TEST:
|
|
|
+ start_time = 1734080109
|
|
|
+ else:
|
|
|
+ start_time = ConstantEnum.PROMOTION_START_TIME.value
|
|
|
+ res = {
|
|
|
+ 'start_time': start_time,
|
|
|
+ 'end_time': ConstantEnum.PROMOTION_END_TIME.value
|
|
|
+ }
|
|
|
+ return response.json(0, res)
|
|
|
+ return response.json(0)
|