|
@@ -53,6 +53,9 @@ class NotificationV2View(View):
|
|
is_st = request_dict.get('is_st', None)
|
|
is_st = request_dict.get('is_st', None)
|
|
region = request_dict.get('region', None)
|
|
region = request_dict.get('region', None)
|
|
electricity = request_dict.get('electricity', '')
|
|
electricity = request_dict.get('electricity', '')
|
|
|
|
+ time_token = request_dict.get('time_token', None)
|
|
|
|
+ time_stamp = request_dict.get('time_stamp', None)
|
|
|
|
+ uid = request_dict.get('uid', None)
|
|
|
|
|
|
if not all([channel, n_time]):
|
|
if not all([channel, n_time]):
|
|
return JsonResponse(status=200, data={
|
|
return JsonResponse(status=200, data={
|
|
@@ -60,12 +63,18 @@ class NotificationV2View(View):
|
|
'msg': 'param is wrong'})
|
|
'msg': 'param is wrong'})
|
|
if not region or not is_st:
|
|
if not region or not is_st:
|
|
return JsonResponse(status=200, data={'code': 404, 'msg': 'no region or is_st'})
|
|
return JsonResponse(status=200, data={'code': 404, 'msg': 'no region or is_st'})
|
|
-
|
|
|
|
|
|
+ # 时间戳token校验
|
|
|
|
+ if time_token and time_stamp:
|
|
|
|
+ time_stamp = int(time_stamp)
|
|
|
|
+ time_token = int(time_token)
|
|
|
|
+ if not CommonService.check_time_stamp_token(time_token, time_stamp):
|
|
|
|
+ return JsonResponse(status=200, data={'code': 13, 'msg': 'Timestamp token verification failed'})
|
|
try:
|
|
try:
|
|
with transaction.atomic():
|
|
with transaction.atomic():
|
|
is_st = int(is_st)
|
|
is_st = int(is_st)
|
|
region = int(region)
|
|
region = int(region)
|
|
- uid = DevicePushService.decode_uid(etk, uidToken) # 解密uid
|
|
|
|
|
|
+ if not uid:
|
|
|
|
+ uid = DevicePushService.decode_uid(etk, uidToken) # 解密uid
|
|
if len(uid) != 20 and len(uid) != 14:
|
|
if len(uid) != 20 and len(uid) != 14:
|
|
return JsonResponse(status=200, data={'code': 404, 'msg': 'wrong uid'})
|
|
return JsonResponse(status=200, data={'code': 404, 'msg': 'wrong uid'})
|
|
req_limiting = '{uid}_{channel}_{event_type}_ptl' \
|
|
req_limiting = '{uid}_{channel}_{event_type}_ptl' \
|