|
@@ -127,7 +127,7 @@ class PushObject:
|
|
|
try:
|
|
|
cli = apns2.APNSClient(mode=APNS_MODE, client_cert=pem_path)
|
|
|
alert = apns2.PayloadAlert(title=msg_title, body=msg_text, launch_image=launch_image)
|
|
|
- push_data = {'alert': 'Motion', 'msg': '', 'sound': '', 'zpush': '1', 'uid': uid, 'channel': channel,
|
|
|
+ push_data = {'alert': msg_text, 'msg': '', 'sound': '', 'zpush': '1', 'uid': uid, 'channel': channel,
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
'image_url': launch_image
|
|
|
}
|
|
@@ -164,7 +164,7 @@ class PushObject:
|
|
|
try:
|
|
|
serverKey = FCM_CONFIG[app_bundle_id]
|
|
|
push_service = FCMNotification(api_key=serverKey)
|
|
|
- push_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'image': image,
|
|
|
+ push_data = {'alert': msg_text, 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'image': image,
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
'uid': uid, 'channel': channel
|
|
|
}
|
|
@@ -206,7 +206,7 @@ class PushObject:
|
|
|
try:
|
|
|
event_type = str(event_type)
|
|
|
n_time = str(n_time)
|
|
|
- push_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
+ push_data = {'alert': msg_text, 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
'uid': uid, 'channel': channel
|
|
|
}
|
|
@@ -257,7 +257,7 @@ class PushObject:
|
|
|
channel_id = '111934'
|
|
|
else:
|
|
|
channel_id = '1'
|
|
|
- push_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'uid': nickname,
|
|
|
+ push_data = {'alert': msg_text, 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'uid': nickname,
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
'channel': channel
|
|
|
}
|
|
@@ -294,10 +294,6 @@ class PushObject:
|
|
|
try:
|
|
|
url = 'https://api.xmpush.xiaomi.com/v3/message/regid'
|
|
|
app_secret = XMPUSH_CONFIG[app_bundle_id]
|
|
|
- # payload = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
- # 'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
- # 'uid': uid, 'channel': channel
|
|
|
- # }
|
|
|
data = {
|
|
|
'title': msg_title,
|
|
|
'description': msg_text,
|
|
@@ -305,7 +301,7 @@ class PushObject:
|
|
|
'restricted_package_name': app_bundle_id,
|
|
|
'registration_id': token_val,
|
|
|
'extra.channel_id': channel_id,
|
|
|
- 'extra.alert': 'Motion',
|
|
|
+ 'extra.alert': msg_text,
|
|
|
'extra.msg': '',
|
|
|
'extra.sound': 'sound.aif',
|
|
|
'extra.zpush': '1',
|
|
@@ -362,7 +358,7 @@ class PushObject:
|
|
|
# 鉴权接口调用获得authToken
|
|
|
sender_send = APISender(app_secret)
|
|
|
sender_send.set_token(rec['authToken'])
|
|
|
- push_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'image': image,
|
|
|
+ push_data = {'alert': msg_text, 'msg': '', 'sound': 'sound.aif', 'zpush': '1', 'image': image,
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
'uid': uid, 'channel': channel
|
|
|
}
|
|
@@ -440,7 +436,7 @@ class PushObject:
|
|
|
result = response.json()
|
|
|
# 发送推送
|
|
|
push_url = url + 'server/v1/message/notification/unicast'
|
|
|
- extra_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
+ extra_data = {'alert': msg_text, 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
'uid': uid, 'channel': channel
|
|
|
}
|
|
@@ -494,7 +490,7 @@ class PushObject:
|
|
|
appId = MEIZUPUSH_CONFIG[app_bundle_id]['ID']
|
|
|
appSecret = MEIZUPUSH_CONFIG[app_bundle_id]['AppSecret']
|
|
|
url = 'https://server-api-push.meizu.com/garcia/api/server/push/varnished/pushByPushId'
|
|
|
- extra_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
+ extra_data = {'alert': msg_text, 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': event_type, 'nickname': nickname,
|
|
|
'uid': uid, 'channel': channel
|
|
|
}
|
|
@@ -570,7 +566,7 @@ class PushObject:
|
|
|
push_url = 'https://push-api.cloud.hihonor.com/api/v1/{}/sendMessage'.format(app_id)
|
|
|
headers = {'Content-Type': 'application/json', 'Authorization': authorization_token,
|
|
|
'timestamp': str(int(time.time()) * 1000)}
|
|
|
- extra_data = {'alert': 'Motion', 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
+ extra_data = {'alert': msg_text, 'msg': '', 'sound': 'sound.aif', 'zpush': '1',
|
|
|
'received_at': n_time, 'event_time': n_time, 'event_type': str(event_type),
|
|
|
'nickname': nickname,
|
|
|
'uid': uid, 'channel': channel, 'title': msg_title, 'body': msg_text
|