|
@@ -25,6 +25,7 @@ from AnsjerPush.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, DETECT_
|
|
|
APNS_CONFIG, BASE_DIR, APNS_MODE
|
|
|
from Model.models import Equipment_Info, UidPushModel, SysMsgModel
|
|
|
from Object.ETkObject import ETkObject
|
|
|
+from Object.LogUtil import LogUtil
|
|
|
from Object.RedisObject import RedisObject
|
|
|
from Object.UidTokenObject import UidTokenObject
|
|
|
from Service.CommonService import CommonService
|
|
@@ -47,6 +48,7 @@ class NotificationView(View):
|
|
|
return self.validation(request.POST)
|
|
|
|
|
|
def validation(self, request_dict):
|
|
|
+ LogUtil.write_log(log='push----------{time}'.format(time=time.strftime('%Y-%m-%d-%H-%M-%S', time.localtime())))
|
|
|
uidToken = request_dict.get('uidToken', None)
|
|
|
etk = request_dict.get('etk', None)
|
|
|
channel = request_dict.get('channel', '1')
|
|
@@ -67,7 +69,7 @@ class NotificationView(View):
|
|
|
else:
|
|
|
utko = UidTokenObject(uidToken)
|
|
|
uid = utko.UID
|
|
|
- pkey = '{uid}_{channel}_ptl'.format(uid=uid, event_type=event_type, channel=channel)
|
|
|
+ pkey = '{uid}_{channel}_{event_type}_ptl'.format(uid=uid, event_type=event_type, channel=channel)
|
|
|
# ykey = 'MUJ887NLR8K8GBM9111A_redis_qs'.format(uid=uid)
|
|
|
ykey = '{uid}_redis_qs'.format(uid=uid)
|
|
|
dkey = '{uid}_{channel}_{event_type}_flag'.format(uid=uid, event_type=event_type, channel=channel)
|
|
@@ -90,6 +92,7 @@ class NotificationView(View):
|
|
|
# 数据库读取数据
|
|
|
if have_ykey:
|
|
|
redis_list = eval(redisObj.get_data(key=ykey))
|
|
|
+ print(have_ykey)
|
|
|
else:
|
|
|
# 从数据库查询出来
|
|
|
uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid,uid_set__detect_status=1). \
|
|
@@ -97,6 +100,7 @@ class NotificationView(View):
|
|
|
'push_type', 'userID_id', 'userID__NickName',
|
|
|
'lang', 'm_code', 'tz', 'uid_set__nickname', 'uid_set__detect_interval', 'uid_set__detect_group',
|
|
|
'uid_set__channel')
|
|
|
+ print(uid_push_qs)
|
|
|
# 新建一个list接收数据
|
|
|
redis_list = []
|
|
|
# 把数据库数据追加进redis_list
|
|
@@ -240,7 +244,6 @@ class NotificationView(View):
|
|
|
if is_sys_msg:
|
|
|
SysMsgModel.objects.bulk_create(sys_msg_list)
|
|
|
Equipment_Info.objects.bulk_create(eq_list)
|
|
|
-
|
|
|
if is_st == '0' or is_st == '2':
|
|
|
print("is_st=0or2")
|
|
|
for up in redis_list:
|