|
@@ -630,20 +630,25 @@ class AiView(View):
|
|
'msg_id' : msg_id,
|
|
'msg_id' : msg_id,
|
|
}
|
|
}
|
|
# 推送消息
|
|
# 推送消息
|
|
- if push_type == 0: # ios apns
|
|
|
|
|
|
+ # if push_type == 0: # ios apns
|
|
|
|
+ # logger.info('into-------apns')
|
|
|
|
+ # apns_start_time = int(time.time())
|
|
|
|
+ # res = self.do_apns(**kwargs)
|
|
|
|
+ # apns_end_time = int(time.time())
|
|
|
|
+ # logger.info(res)
|
|
|
|
+ # # elif push_type == 1: # android gcm
|
|
|
|
+ # # self.do_fcm(**kwargs)
|
|
|
|
+ # elif push_type == 2: # android jpush
|
|
|
|
+ # logger.info('into-------jpush')
|
|
|
|
+ # jpush_start_time = int(time.time())
|
|
|
|
+ # res = self.do_jpush(**kwargs)
|
|
|
|
+ # jpush_end_time = int(time.time())
|
|
|
|
+ # logger.info(res)
|
|
|
|
+ if push_type == 1: # android gcm
|
|
logger.info('into-------apns')
|
|
logger.info('into-------apns')
|
|
apns_start_time = int(time.time())
|
|
apns_start_time = int(time.time())
|
|
- res = self.do_apns(**kwargs)
|
|
|
|
|
|
+ res = self.do_fcm(**kwargs)
|
|
apns_end_time = int(time.time())
|
|
apns_end_time = int(time.time())
|
|
- logger.info(res)
|
|
|
|
- # elif push_type == 1: # android gcm
|
|
|
|
- # self.do_fcm(**kwargs)
|
|
|
|
- elif push_type == 2: # android jpush
|
|
|
|
- logger.info('into-------jpush')
|
|
|
|
- jpush_start_time = int(time.time())
|
|
|
|
- res = self.do_jpush(**kwargs)
|
|
|
|
- jpush_end_time = int(time.time())
|
|
|
|
- logger.info(res)
|
|
|
|
|
|
|
|
# 以下是存库
|
|
# 以下是存库
|
|
userID_id = up["userID_id"]
|
|
userID_id = up["userID_id"]
|
|
@@ -803,7 +808,7 @@ class AiView(View):
|
|
return 'serverKey abnormal'
|
|
return 'serverKey abnormal'
|
|
push_service = FCMNotification(api_key=serverKey)
|
|
push_service = FCMNotification(api_key=serverKey)
|
|
data = {"alert": "Motion ", "event_time": n_time, "event_type": event_type, "msg": "",
|
|
data = {"alert": "Motion ", "event_time": n_time, "event_type": event_type, "msg": "",
|
|
- "received_at": n_time, "sound": "sound.aif", "uid": uid, "zpush": "1", "channel": channel}
|
|
|
|
|
|
+ "received_at": n_time, "sound": "sound.aif", "uid": uid, "zpush": "1", "channel": channel, "msg_id": msg_id}
|
|
result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
|
|
result = push_service.notify_single_device(registration_id=token_val, message_title=msg_title,
|
|
message_body=msg_text, data_message=data,
|
|
message_body=msg_text, data_message=data,
|
|
extra_kwargs={
|
|
extra_kwargs={
|