|
@@ -122,7 +122,6 @@ class PushObject:
|
|
@return: bool
|
|
@return: bool
|
|
"""
|
|
"""
|
|
pem_path = os.path.join(BASE_DIR, APNS_CONFIG[app_bundle_id]['pem_path'])
|
|
pem_path = os.path.join(BASE_DIR, APNS_CONFIG[app_bundle_id]['pem_path'])
|
|
- LOGGER.info('IOS推送: app_bundle_id:{}, pem_path:{}'.format(app_bundle_id, pem_path))
|
|
|
|
try:
|
|
try:
|
|
cli = apns2.APNSClient(mode=APNS_MODE, client_cert=pem_path)
|
|
cli = apns2.APNSClient(mode=APNS_MODE, client_cert=pem_path)
|
|
alert = apns2.PayloadAlert(title=msg_title, body=msg_text, launch_image=launch_image)
|
|
alert = apns2.PayloadAlert(title=msg_title, body=msg_text, launch_image=launch_image)
|
|
@@ -135,8 +134,6 @@ class PushObject:
|
|
mutable_content=True)
|
|
mutable_content=True)
|
|
n = apns2.Notification(payload=payload, priority=apns2.PRIORITY_LOW)
|
|
n = apns2.Notification(payload=payload, priority=apns2.PRIORITY_LOW)
|
|
res = cli.push(n=n, device_token=token_val, topic=app_bundle_id)
|
|
res = cli.push(n=n, device_token=token_val, topic=app_bundle_id)
|
|
- LOGGER.info('IOS推送响应状态码{},token:{},uid:{},params:{}'
|
|
|
|
- .format(res.status_code, token_val, uid, json.dumps(push_data)))
|
|
|
|
assert res.status_code == 200 or res.status_code == 410
|
|
assert res.status_code == 200 or res.status_code == 410
|
|
return True
|
|
return True
|
|
except Exception as e:
|
|
except Exception as e:
|
|
@@ -190,7 +187,6 @@ class PushObject:
|
|
'default_light_settings': True,
|
|
'default_light_settings': True,
|
|
},
|
|
},
|
|
)
|
|
)
|
|
- LOGGER.info('uid:{},evnet_type:{},time:{},fcm推送结果:{}'.format(uid, event_type, n_time, result))
|
|
|
|
return True
|
|
return True
|
|
except Exception as e:
|
|
except Exception as e:
|
|
LOGGER.info('uid:{},evnet_type:{},time:{},fcm推送异常:{}'.format(uid, event_type, n_time, repr(e)))
|
|
LOGGER.info('uid:{},evnet_type:{},time:{},fcm推送异常:{}'.format(uid, event_type, n_time, repr(e)))
|
|
@@ -236,7 +232,6 @@ class PushObject:
|
|
# Send a message to the device corresponding to the provided
|
|
# Send a message to the device corresponding to the provided
|
|
# registration token.
|
|
# registration token.
|
|
result = messaging.send(message)
|
|
result = messaging.send(message)
|
|
- LOGGER.info('fcm推送结果:{}'.format(result))
|
|
|
|
return True
|
|
return True
|
|
except Exception as e:
|
|
except Exception as e:
|
|
LOGGER.info('fcm推送异常:{}'.format(repr(e)))
|
|
LOGGER.info('fcm推送异常:{}'.format(repr(e)))
|