|
@@ -11,34 +11,33 @@
|
|
@file: DetectController.py
|
|
@file: DetectController.py
|
|
@Contact: chanjunkai@163.com
|
|
@Contact: chanjunkai@163.com
|
|
"""
|
|
"""
|
|
|
|
+import json
|
|
import os
|
|
import os
|
|
import time
|
|
import time
|
|
-import json
|
|
|
|
|
|
+
|
|
import apns2
|
|
import apns2
|
|
|
|
+import boto3
|
|
|
|
+import botocore
|
|
import jpush as jpush
|
|
import jpush as jpush
|
|
import oss2
|
|
import oss2
|
|
|
|
+from botocore import client
|
|
from django.http import JsonResponse
|
|
from django.http import JsonResponse
|
|
from django.views.generic.base import View
|
|
from django.views.generic.base import View
|
|
from pyfcm import FCMNotification
|
|
from pyfcm import FCMNotification
|
|
-from Object.RedisObject import RedisObject
|
|
|
|
-from Ansjer.config import DETECT_PUSH_DOMAIN, DETECT_PUSH_DOMAINS, DETECT_PUSH_DOMAIN_JIUAN, DETECT_PUSH_DOMAINS_JIUAN,\
|
|
|
|
- SERVER_DOMAIN, SERVER_DOMAIN_SSL, \
|
|
|
|
- OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, \
|
|
|
|
- JPUSH_CONFIG, FCM_CONFIG, APNS_CONFIG, BASE_DIR, APNS_MODE, SERVER_TYPE
|
|
|
|
|
|
+
|
|
|
|
+from Ansjer.config import DETECT_PUSH_DOMAIN, DETECT_PUSH_DOMAINS, DETECT_PUSH_DOMAIN_JIUAN, DETECT_PUSH_DOMAINS_JIUAN, \
|
|
|
|
+ OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, \
|
|
|
|
+ JPUSH_CONFIG, FCM_CONFIG, APNS_CONFIG, BASE_DIR, APNS_MODE, SERVER_TYPE
|
|
|
|
+from Ansjer.config import PUSH_REDIS_ADDRESS
|
|
from Model.models import Device_Info, VodHlsModel, Equipment_Info, UidSetModel, UidPushModel, CompanyModel, SysMsgModel, \
|
|
from Model.models import Device_Info, VodHlsModel, Equipment_Info, UidSetModel, UidPushModel, CompanyModel, SysMsgModel, \
|
|
AiService
|
|
AiService
|
|
from Object.ETkObject import ETkObject
|
|
from Object.ETkObject import ETkObject
|
|
from Object.RedisObject import RedisObject
|
|
from Object.RedisObject import RedisObject
|
|
-from django.db.models import Q
|
|
|
|
from Object.ResponseObject import ResponseObject
|
|
from Object.ResponseObject import ResponseObject
|
|
from Object.TokenObject import TokenObject
|
|
from Object.TokenObject import TokenObject
|
|
from Object.UidTokenObject import UidTokenObject
|
|
from Object.UidTokenObject import UidTokenObject
|
|
from Service.CommonService import CommonService
|
|
from Service.CommonService import CommonService
|
|
-from Service.ModelService import ModelService
|
|
|
|
-import boto3
|
|
|
|
-import botocore
|
|
|
|
-from botocore import client
|
|
|
|
-from Ansjer.config import PUSH_REDIS_ADDRESS
|
|
|
|
|
|
+from Service.EquipmentInfoService import EquipmentInfoService
|
|
|
|
|
|
|
|
|
|
class DetectControllerViewV2(View):
|
|
class DetectControllerViewV2(View):
|
|
@@ -288,24 +287,34 @@ class DetectControllerViewV2(View):
|
|
if not region:
|
|
if not region:
|
|
return response.json(444, 'region')
|
|
return response.json(444, 'region')
|
|
region = int(region)
|
|
region = int(region)
|
|
- now_time = int(time.time())
|
|
|
|
-
|
|
|
|
- qs = Equipment_Info.objects.filter(userID_id=userID).order_by('-eventTime')
|
|
|
|
- qs = qs.filter(eventTime__gt=now_time - 3600 * 168)
|
|
|
|
|
|
+ # now_time = int(time.time())
|
|
|
|
|
|
|
|
+ # qs = Equipment_Info.objects.filter(userID_id=userID).order_by('-eventTime')
|
|
|
|
+ # qs = qs.filter(eventTime__gt=now_time - 3600 * 168)
|
|
|
|
+ # 根据时间筛选消息推送
|
|
if startTime and endTime:
|
|
if startTime and endTime:
|
|
- qs = qs.filter(eventTime__range=(startTime, endTime))
|
|
|
|
- if eventType:
|
|
|
|
- if ',' in eventType: #兼容AI查询
|
|
|
|
- eventTypeList = eventType.split(',')
|
|
|
|
- eventTypeList = [int(i.strip()) for i in eventTypeList]
|
|
|
|
- qs = qs.filter(eventType__in=eventTypeList)
|
|
|
|
- else:
|
|
|
|
- qs = qs.filter(eventType=eventType)
|
|
|
|
|
|
+ qs, count = EquipmentInfoService.find_by_start_time_equipment_info(page, line, userID, startTime,
|
|
|
|
+ endTime, eventType,
|
|
|
|
+ request_dict.get('uids', None))
|
|
|
|
+
|
|
|
|
+ else:
|
|
|
|
+ # 默认查询近七天消息推送
|
|
|
|
+ qs, count = EquipmentInfoService.get_equipment_info_week_all(page, line, userID, startTime, endTime,
|
|
|
|
+ eventType,
|
|
|
|
+ request_dict.get('uids', None))
|
|
|
|
+ # if startTime and endTime:
|
|
|
|
+ # qs = qs.filter(eventTime__range=(startTime, endTime))
|
|
|
|
+ # if eventType:
|
|
|
|
+ # if ',' in eventType: # 兼容AI查询
|
|
|
|
+ # eventTypeList = eventType.split(',')
|
|
|
|
+ # eventTypeList = [int(i.strip()) for i in eventTypeList]
|
|
|
|
+ # qs = qs.filter(eventType__in=eventTypeList)
|
|
|
|
+ # else:
|
|
|
|
+ # qs = qs.filter(eventType=eventType)
|
|
uids = request_dict.get('uids', None)
|
|
uids = request_dict.get('uids', None)
|
|
if uids:
|
|
if uids:
|
|
uid_list = uids.split(',')
|
|
uid_list = uids.split(',')
|
|
- qs = qs.filter(devUid__in=uid_list)
|
|
|
|
|
|
+ # qs = qs.filter(devUid__in=uid_list)
|
|
dvqs = Device_Info.objects.filter(UID__in=uid_list, userID_id=userID).values('UID', 'Type', 'NickName')
|
|
dvqs = Device_Info.objects.filter(UID__in=uid_list, userID_id=userID).values('UID', 'Type', 'NickName')
|
|
uid_type_dict = {}
|
|
uid_type_dict = {}
|
|
for dv in dvqs:
|
|
for dv in dvqs:
|
|
@@ -316,13 +325,14 @@ class DetectControllerViewV2(View):
|
|
for dv in dvqs:
|
|
for dv in dvqs:
|
|
uid_type_dict[dv['UID']] = {'type': dv['Type'], 'NickName': dv['NickName']}
|
|
uid_type_dict[dv['UID']] = {'type': dv['Type'], 'NickName': dv['NickName']}
|
|
# print(uid_type_dict)
|
|
# print(uid_type_dict)
|
|
- if not qs.exists():
|
|
|
|
|
|
+ if count == 0 and not qs.exists():
|
|
return response.json(0, {'datas': [], 'count': 0})
|
|
return response.json(0, {'datas': [], 'count': 0})
|
|
- qs = qs.values('id', 'devUid', 'devNickName', 'Channel', 'eventType', 'status', 'alarm', 'eventTime',
|
|
|
|
- 'receiveTime', 'is_st', 'addTime', 'storage_location', 'borderCoords')
|
|
|
|
|
|
+ # qs = qs.values('id', 'devUid', 'devNickName', 'Channel', 'eventType', 'status', 'alarm', 'eventTime',
|
|
|
|
+ # 'receiveTime', 'is_st', 'addTime', 'storage_location', 'borderCoords')
|
|
|
|
|
|
- count = qs.count()
|
|
|
|
- qr = qs[(page - 1) * line:page * line]
|
|
|
|
|
|
+ # count = qs.count()
|
|
|
|
+ # qr = qs[(page - 1) * line:page * line]
|
|
|
|
+ qr = qs
|
|
res = []
|
|
res = []
|
|
auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
|
|
auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
|
|
oss_img_bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'apg')
|
|
oss_img_bucket = oss2.Bucket(auth, 'oss-cn-shenzhen.aliyuncs.com', 'apg')
|
|
@@ -346,10 +356,10 @@ class DetectControllerViewV2(View):
|
|
eventTime = p['eventTime']
|
|
eventTime = p['eventTime']
|
|
channel = p['Channel']
|
|
channel = p['Channel']
|
|
storage_location = p['storage_location']
|
|
storage_location = p['storage_location']
|
|
- p['borderCoords'] = '' if p['borderCoords'] =='' else json.loads(p['borderCoords'])
|
|
|
|
|
|
+ p['borderCoords'] = '' if p['borderCoords'] == '' else json.loads(p['borderCoords'])
|
|
if p['is_st'] == 1:
|
|
if p['is_st'] == 1:
|
|
thumbspng = '{uid}/{channel}/{time}.jpeg'.format(uid=devUid, channel=p['Channel'], time=eventTime)
|
|
thumbspng = '{uid}/{channel}/{time}.jpeg'.format(uid=devUid, channel=p['Channel'], time=eventTime)
|
|
- if storage_location == 1: # oss
|
|
|
|
|
|
+ if storage_location == 1: # oss
|
|
response_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
response_url = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
p['img'] = response_url
|
|
p['img'] = response_url
|
|
p['img_list'] = [response_url]
|
|
p['img_list'] = [response_url]
|
|
@@ -359,9 +369,10 @@ class DetectControllerViewV2(View):
|
|
ExpiresIn=300)
|
|
ExpiresIn=300)
|
|
p['img'] = response_url
|
|
p['img'] = response_url
|
|
p['img_list'] = [response_url]
|
|
p['img_list'] = [response_url]
|
|
- elif region == 1 and storage_location == 2: # 1:国外,aws
|
|
|
|
|
|
+ elif region == 1 and storage_location == 2: # 1:国外,aws
|
|
response_url = aws_s3_guowai.generate_presigned_url('get_object',
|
|
response_url = aws_s3_guowai.generate_presigned_url('get_object',
|
|
- Params={'Bucket': 'foreignpush', 'Key': thumbspng},
|
|
|
|
|
|
+ Params={'Bucket': 'foreignpush',
|
|
|
|
+ 'Key': thumbspng},
|
|
ExpiresIn=300)
|
|
ExpiresIn=300)
|
|
p['img'] = response_url
|
|
p['img'] = response_url
|
|
p['img_list'] = [response_url]
|
|
p['img_list'] = [response_url]
|
|
@@ -376,18 +387,21 @@ class DetectControllerViewV2(View):
|
|
endpoint = vodqs[0]['bucket__endpoint']
|
|
endpoint = vodqs[0]['bucket__endpoint']
|
|
bucket = oss2.Bucket(auth, endpoint, bucket_name)
|
|
bucket = oss2.Bucket(auth, endpoint, bucket_name)
|
|
ts = '{uid}/vod{channel}/{etime}/ts0.ts'.format(uid=devUid, channel=p['Channel'], etime=eventTime)
|
|
ts = '{uid}/vod{channel}/{etime}/ts0.ts'.format(uid=devUid, channel=p['Channel'], etime=eventTime)
|
|
- if storage_location == 1: # oss
|
|
|
|
- thumb0 = bucket.sign_url('GET', ts, 3600, params={'x-oss-process': 'video/snapshot,t_0000,w_700'})
|
|
|
|
- thumb1 = bucket.sign_url('GET', ts, 3600, params={'x-oss-process': 'video/snapshot,t_1000,w_700'})
|
|
|
|
- thumb2 = bucket.sign_url('GET', ts, 3600, params={'x-oss-process': 'video/snapshot,t_2000,w_700'})
|
|
|
|
|
|
+ if storage_location == 1: # oss
|
|
|
|
+ thumb0 = bucket.sign_url('GET', ts, 3600,
|
|
|
|
+ params={'x-oss-process': 'video/snapshot,t_0000,w_700'})
|
|
|
|
+ thumb1 = bucket.sign_url('GET', ts, 3600,
|
|
|
|
+ params={'x-oss-process': 'video/snapshot,t_1000,w_700'})
|
|
|
|
+ thumb2 = bucket.sign_url('GET', ts, 3600,
|
|
|
|
+ params={'x-oss-process': 'video/snapshot,t_2000,w_700'})
|
|
# thumb3 = bucket.sign_url('GET', ts, 3600, params={'x-oss-process': 'video/snapshot,t_3000,w_700'})
|
|
# thumb3 = bucket.sign_url('GET', ts, 3600, params={'x-oss-process': 'video/snapshot,t_3000,w_700'})
|
|
p['img_list'] = [thumb0, thumb1, thumb2]
|
|
p['img_list'] = [thumb0, thumb1, thumb2]
|
|
- elif region == 2 and storage_location == 2: # 2:国内,aws
|
|
|
|
|
|
+ elif region == 2 and storage_location == 2: # 2:国内,aws
|
|
thumb = aws_s3_guonei.generate_presigned_url('get_object',
|
|
thumb = aws_s3_guonei.generate_presigned_url('get_object',
|
|
Params={'Bucket': 'push', 'Key': ts},
|
|
Params={'Bucket': 'push', 'Key': ts},
|
|
ExpiresIn=3600)
|
|
ExpiresIn=3600)
|
|
p['img_list'] = [thumb]
|
|
p['img_list'] = [thumb]
|
|
- elif region == 1 and storage_location == 2: # 1:国外,aws
|
|
|
|
|
|
+ elif region == 1 and storage_location == 2: # 1:国外,aws
|
|
thumb = aws_s3_guowai.generate_presigned_url('get_object',
|
|
thumb = aws_s3_guowai.generate_presigned_url('get_object',
|
|
Params={'Bucket': 'foreignpush', 'Key': ts},
|
|
Params={'Bucket': 'foreignpush', 'Key': ts},
|
|
ExpiresIn=3600)
|
|
ExpiresIn=3600)
|
|
@@ -396,8 +410,9 @@ class DetectControllerViewV2(View):
|
|
# 列表装载回放时间戳标记
|
|
# 列表装载回放时间戳标记
|
|
p['img_list'] = []
|
|
p['img_list'] = []
|
|
for i in range(p['is_st']):
|
|
for i in range(p['is_st']):
|
|
- thumbspng = '{uid}/{channel}/{time}_{st}.jpeg'.format(uid=devUid, channel=p['Channel'], time=eventTime, st=i)
|
|
|
|
- if storage_location == 1: # oss
|
|
|
|
|
|
+ thumbspng = '{uid}/{channel}/{time}_{st}.jpeg'.format(uid=devUid, channel=p['Channel'],
|
|
|
|
+ time=eventTime, st=i)
|
|
|
|
+ if storage_location == 1: # oss
|
|
img = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
img = oss_img_bucket.sign_url('GET', thumbspng, 300)
|
|
p['img_list'].append(img)
|
|
p['img_list'].append(img)
|
|
elif region == 2 and storage_location == 2: # 2:国内,aws
|
|
elif region == 2 and storage_location == 2: # 2:国内,aws
|
|
@@ -406,9 +421,10 @@ class DetectControllerViewV2(View):
|
|
ExpiresIn=300)
|
|
ExpiresIn=300)
|
|
img = response_url
|
|
img = response_url
|
|
p['img_list'].append(img)
|
|
p['img_list'].append(img)
|
|
- elif region == 1 and storage_location == 2: # 1:国外,aws
|
|
|
|
|
|
+ elif region == 1 and storage_location == 2: # 1:国外,aws
|
|
response_url = aws_s3_guowai.generate_presigned_url('get_object',
|
|
response_url = aws_s3_guowai.generate_presigned_url('get_object',
|
|
- Params={'Bucket': 'foreignpush', 'Key': thumbspng},
|
|
|
|
|
|
+ Params={'Bucket': 'foreignpush',
|
|
|
|
+ 'Key': thumbspng},
|
|
ExpiresIn=300)
|
|
ExpiresIn=300)
|
|
img = response_url
|
|
img = response_url
|
|
p['img_list'].append(img)
|
|
p['img_list'].append(img)
|
|
@@ -513,7 +529,8 @@ class NotificationView(View):
|
|
uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid, uid_set__detect_status=1). \
|
|
uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid, uid_set__detect_status=1). \
|
|
values('token_val', 'app_type', 'appBundleId', 'm_code',
|
|
values('token_val', 'app_type', 'appBundleId', 'm_code',
|
|
'push_type', 'userID_id', 'userID__NickName',
|
|
'push_type', 'userID_id', 'userID__NickName',
|
|
- 'lang', 'm_code', 'tz', 'uid_set__nickname', 'uid_set__detect_interval', 'uid_set__detect_group',
|
|
|
|
|
|
+ 'lang', 'm_code', 'tz', 'uid_set__nickname', 'uid_set__detect_interval',
|
|
|
|
+ 'uid_set__detect_group',
|
|
'uid_set__channel')
|
|
'uid_set__channel')
|
|
print(uid_push_qs)
|
|
print(uid_push_qs)
|
|
# 新建一个list接收数据
|
|
# 新建一个list接收数据
|
|
@@ -528,8 +545,8 @@ class NotificationView(View):
|
|
return JsonResponse(status=200, data=res_data)
|
|
return JsonResponse(status=200, data=res_data)
|
|
else:
|
|
else:
|
|
# 从数据库查询出来
|
|
# 从数据库查询出来
|
|
- uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid,uid_set__detect_status=1). \
|
|
|
|
- values('token_val', 'app_type', 'appBundleId','m_code',
|
|
|
|
|
|
+ uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid, uid_set__detect_status=1). \
|
|
|
|
+ values('token_val', 'app_type', 'appBundleId', 'm_code',
|
|
'push_type', 'userID_id', 'userID__NickName',
|
|
'push_type', 'userID_id', 'userID__NickName',
|
|
'lang', 'm_code', 'tz', 'uid_set__nickname', 'uid_set__detect_interval', 'uid_set__detect_group',
|
|
'lang', 'm_code', 'tz', 'uid_set__nickname', 'uid_set__detect_interval', 'uid_set__detect_group',
|
|
'uid_set__channel')
|
|
'uid_set__channel')
|
|
@@ -569,7 +586,7 @@ class NotificationView(View):
|
|
else:
|
|
else:
|
|
detect_med_type = 2 # 为2的话,既推送,又存库
|
|
detect_med_type = 2 # 为2的话,既推送,又存库
|
|
# detect_group=0允许全部推送的时候
|
|
# detect_group=0允许全部推送的时候
|
|
- if detect_group == '0'or detect_group == '':
|
|
|
|
|
|
+ if detect_group == '0' or detect_group == '':
|
|
redisObj.set_data(key=dkey, val=1, expire=detect_interval)
|
|
redisObj.set_data(key=dkey, val=1, expire=detect_interval)
|
|
else:
|
|
else:
|
|
detect_group_list = detect_group.split(',')
|
|
detect_group_list = detect_group.split(',')
|
|
@@ -579,7 +596,7 @@ class NotificationView(View):
|
|
redisObj.set_data(key=dkey, val=1, expire=detect_interval)
|
|
redisObj.set_data(key=dkey, val=1, expire=detect_interval)
|
|
# 改为1秒
|
|
# 改为1秒
|
|
# 如果不是正式
|
|
# 如果不是正式
|
|
- if SERVER_TYPE!="Ansjer.formal_settings":
|
|
|
|
|
|
+ if SERVER_TYPE != "Ansjer.formal_settings":
|
|
redisObj.set_data(key=pkey, val=1, expire=10)
|
|
redisObj.set_data(key=pkey, val=1, expire=10)
|
|
else:
|
|
else:
|
|
redisObj.set_data(key=pkey, val=1, expire=60)
|
|
redisObj.set_data(key=pkey, val=1, expire=60)
|
|
@@ -645,7 +662,7 @@ class NotificationView(View):
|
|
kwag_args['msg_title'] = msg_title
|
|
kwag_args['msg_title'] = msg_title
|
|
kwag_args['msg_text'] = msg_text
|
|
kwag_args['msg_text'] = msg_text
|
|
push_server_status = 0
|
|
push_server_status = 0
|
|
- #推送
|
|
|
|
|
|
+ # 推送
|
|
if detect_med_type == 2 or detect_med_type == 0:
|
|
if detect_med_type == 2 or detect_med_type == 0:
|
|
if push_type == 0: # ios apns
|
|
if push_type == 0: # ios apns
|
|
print('do_apns')
|
|
print('do_apns')
|
|
@@ -717,7 +734,7 @@ class NotificationView(View):
|
|
del up['uid_set__nickname']
|
|
del up['uid_set__nickname']
|
|
del up['uid_set__detect_interval']
|
|
del up['uid_set__detect_interval']
|
|
del up['uid_set__detect_group']
|
|
del up['uid_set__detect_group']
|
|
- return JsonResponse(status=200, data={'code': 0, 'msg': 'success 0 or 2' ,'re_list':redis_list})
|
|
|
|
|
|
+ return JsonResponse(status=200, data={'code': 0, 'msg': 'success 0 or 2', 're_list': redis_list})
|
|
|
|
|
|
elif is_st == '1':
|
|
elif is_st == '1':
|
|
print("is_st=1")
|
|
print("is_st=1")
|
|
@@ -735,7 +752,7 @@ class NotificationView(View):
|
|
},
|
|
},
|
|
ExpiresIn=3600
|
|
ExpiresIn=3600
|
|
)
|
|
)
|
|
- else: # 1:国外
|
|
|
|
|
|
+ else: # 1:国外
|
|
response_url = aws_s3_guowai.generate_presigned_url(
|
|
response_url = aws_s3_guowai.generate_presigned_url(
|
|
ClientMethod='put_object',
|
|
ClientMethod='put_object',
|
|
Params={
|
|
Params={
|
|
@@ -790,7 +807,7 @@ class NotificationView(View):
|
|
},
|
|
},
|
|
ExpiresIn=3600
|
|
ExpiresIn=3600
|
|
)
|
|
)
|
|
- else: # 1:国外
|
|
|
|
|
|
+ else: # 1:国外
|
|
response_url = aws_s3_guowai.generate_presigned_url(
|
|
response_url = aws_s3_guowai.generate_presigned_url(
|
|
ClientMethod='put_object',
|
|
ClientMethod='put_object',
|
|
Params={
|
|
Params={
|
|
@@ -826,7 +843,6 @@ class NotificationView(View):
|
|
res_data = {'code': 0, 'img_url_list': img_url_list, 'msg': 'success 3'}
|
|
res_data = {'code': 0, 'img_url_list': img_url_list, 'msg': 'success 3'}
|
|
return JsonResponse(status=200, data=res_data)
|
|
return JsonResponse(status=200, data=res_data)
|
|
|
|
|
|
-
|
|
|
|
def get_msg_title(self, appBundleId, nickname):
|
|
def get_msg_title(self, appBundleId, nickname):
|
|
package_title_config = {
|
|
package_title_config = {
|
|
'com.ansjer.customizedd_a': 'DVS',
|
|
'com.ansjer.customizedd_a': 'DVS',
|
|
@@ -853,7 +869,7 @@ class NotificationView(View):
|
|
return False
|
|
return False
|
|
|
|
|
|
def get_msg_text(self, channel, n_time, lang, tz, event_type, is_sys=0):
|
|
def get_msg_text(self, channel, n_time, lang, tz, event_type, is_sys=0):
|
|
- n_date = CommonService.get_now_time_str(n_time=n_time, tz=tz,lang=lang)
|
|
|
|
|
|
+ n_date = CommonService.get_now_time_str(n_time=n_time, tz=tz, lang=lang)
|
|
etype = int(event_type)
|
|
etype = int(event_type)
|
|
if lang == 'cn':
|
|
if lang == 'cn':
|
|
if etype == 704:
|
|
if etype == 704:
|
|
@@ -1036,7 +1052,7 @@ class PushNotificationView(View):
|
|
# 从数据库查询出来
|
|
# 从数据库查询出来
|
|
uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid, uid_set__detect_status=1). \
|
|
uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid, uid_set__detect_status=1). \
|
|
values('token_val', 'app_type', 'appBundleId',
|
|
values('token_val', 'app_type', 'appBundleId',
|
|
- 'push_type', 'userID_id', 'lang','m_code',
|
|
|
|
|
|
+ 'push_type', 'userID_id', 'lang', 'm_code',
|
|
'tz', 'uid_set__nickname')
|
|
'tz', 'uid_set__nickname')
|
|
# 新建一个list接收数据
|
|
# 新建一个list接收数据
|
|
redis_list = []
|
|
redis_list = []
|
|
@@ -1080,7 +1096,7 @@ class PushNotificationView(View):
|
|
},
|
|
},
|
|
ExpiresIn=3600
|
|
ExpiresIn=3600
|
|
)
|
|
)
|
|
- else: # 1:国外
|
|
|
|
|
|
+ else: # 1:国外
|
|
response_url = aws_s3_guowai.generate_presigned_url(
|
|
response_url = aws_s3_guowai.generate_presigned_url(
|
|
ClientMethod='put_object',
|
|
ClientMethod='put_object',
|
|
Params={
|
|
Params={
|
|
@@ -1113,7 +1129,7 @@ class PushNotificationView(View):
|
|
},
|
|
},
|
|
ExpiresIn=3600
|
|
ExpiresIn=3600
|
|
)
|
|
)
|
|
- else: # 1:国外
|
|
|
|
|
|
+ else: # 1:国外
|
|
response_url = aws_s3_guowai.generate_presigned_url(
|
|
response_url = aws_s3_guowai.generate_presigned_url(
|
|
ClientMethod='put_object',
|
|
ClientMethod='put_object',
|
|
Params={
|
|
Params={
|
|
@@ -1217,4 +1233,4 @@ class PushNotificationView(View):
|
|
else:
|
|
else:
|
|
send_text = '{msg_type} channel:{channel} date:{date}'. \
|
|
send_text = '{msg_type} channel:{channel} date:{date}'. \
|
|
format(msg_type=msg_type, channel=channel, date=n_date)
|
|
format(msg_type=msg_type, channel=channel, date=n_date)
|
|
- return send_text
|
|
|
|
|
|
+ return send_text
|