|
@@ -255,28 +255,28 @@ class PushObject:
|
|
@return: bool
|
|
@return: bool
|
|
"""
|
|
"""
|
|
try:
|
|
try:
|
|
- app_key = JPUSH_CONFIG[app_bundle_id]['Key']
|
|
|
|
- master_secret = JPUSH_CONFIG[app_bundle_id]['Secret']
|
|
|
|
- # 换成各自的app_key和master_secret
|
|
|
|
- _jpush = jpush.JPush(app_key, master_secret)
|
|
|
|
- push = _jpush.create_push()
|
|
|
|
- push.audience = jpush.registration_id(token_val)
|
|
|
|
- if event_type in [606, 607]:
|
|
|
|
- channel_id = '111934'
|
|
|
|
- else:
|
|
|
|
- channel_id = '1'
|
|
|
|
- push_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'uid': nickname,
|
|
|
|
- 'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
|
- 'channel': channel
|
|
|
|
- }
|
|
|
|
- android = jpush.android(title=msg_title, big_text=msg_text, alert=msg_text, extras=push_data,
|
|
|
|
- priority=1, style=1, alert_type=7, channel_id=channel_id
|
|
|
|
- )
|
|
|
|
- push.notification = jpush.notification(android=android)
|
|
|
|
- push.platform = jpush.all_
|
|
|
|
- res = push.send()
|
|
|
|
- LOGGER.info("uid:{},time:{},极光推送返回值:{}".format(nickname, n_time, res))
|
|
|
|
- assert res.status_code == 200
|
|
|
|
|
|
+ # app_key = JPUSH_CONFIG[app_bundle_id]['Key']
|
|
|
|
+ # master_secret = JPUSH_CONFIG[app_bundle_id]['Secret']
|
|
|
|
+ # # 换成各自的app_key和master_secret
|
|
|
|
+ # _jpush = jpush.JPush(app_key, master_secret)
|
|
|
|
+ # push = _jpush.create_push()
|
|
|
|
+ # push.audience = jpush.registration_id(token_val)
|
|
|
|
+ # if event_type in [606, 607]:
|
|
|
|
+ # channel_id = '111934'
|
|
|
|
+ # else:
|
|
|
|
+ # channel_id = '1'
|
|
|
|
+ # push_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'uid': nickname,
|
|
|
|
+ # 'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
|
+ # 'channel': channel
|
|
|
|
+ # }
|
|
|
|
+ # android = jpush.android(title=msg_title, big_text=msg_text, alert=msg_text, extras=push_data,
|
|
|
|
+ # priority=1, style=1, alert_type=7, channel_id=channel_id
|
|
|
|
+ # )
|
|
|
|
+ # push.notification = jpush.notification(android=android)
|
|
|
|
+ # push.platform = jpush.all_
|
|
|
|
+ # res = push.send()
|
|
|
|
+ # LOGGER.info("uid:{},time:{},极光推送返回值:{}".format(nickname, n_time, res))
|
|
|
|
+ # assert res.status_code == 200
|
|
return True
|
|
return True
|
|
except Exception as e:
|
|
except Exception as e:
|
|
LOGGER.info('uid:{},time:{},极光推送异常:{}'.format(nickname, n_time, repr(e)))
|
|
LOGGER.info('uid:{},time:{},极光推送异常:{}'.format(nickname, n_time, repr(e)))
|