|
|
@@ -130,10 +130,13 @@ class PushObject:
|
|
|
apns_url = "https://api.sandbox.push.apple.com" if CONFIG_INFO == CONFIG_TEST else "https://api.push.apple.com"
|
|
|
url = f"{apns_url}/3/device/{token_val}"
|
|
|
|
|
|
+ jump_type = CommonService.get_jump_type(event_type)
|
|
|
+
|
|
|
sound = 'call_phone.mp3' if event_type in DATA_PUSH_EVENT_TYPE_LIST else 'default'
|
|
|
|
|
|
# 构造 body —— 把 image_url 等字段放顶层,便于 Notification Service Extension 直接读取
|
|
|
body = {
|
|
|
+ "alert": msg_text,
|
|
|
"aps": {
|
|
|
"alert": {
|
|
|
"title": msg_title,
|
|
|
@@ -143,16 +146,16 @@ class PushObject:
|
|
|
"category": "myCategory",
|
|
|
"mutable-content": 1
|
|
|
},
|
|
|
- # ---- 把原来的 push_data 展平到顶层(尤其是 image_url) ----
|
|
|
- "image_url": launch_image,
|
|
|
- "uid": uid,
|
|
|
+ 'jump_type': jump_type,
|
|
|
+ 'image_url': launch_image,
|
|
|
"channel": channel,
|
|
|
- "received_at": n_time,
|
|
|
"event_time": n_time,
|
|
|
"event_type": event_type,
|
|
|
- "nickname": nickname,
|
|
|
- "zpush": "1",
|
|
|
- "jump_type": CommonService.get_jump_type(event_type)
|
|
|
+ "msg": "",
|
|
|
+ "received_at": n_time,
|
|
|
+ "sound": "",
|
|
|
+ "uid": uid,
|
|
|
+ "zpush": "1"
|
|
|
}
|
|
|
|
|
|
headers = {
|
|
|
@@ -160,7 +163,7 @@ class PushObject:
|
|
|
"apns-push-type": "alert"
|
|
|
}
|
|
|
|
|
|
- with httpx.Client(http2=True, timeout=10, cert=str(pem_path)) as client:
|
|
|
+ with httpx.Client(http2=True,timeout=10, cert=str(pem_path),) as client:
|
|
|
res = client.post(url, headers=headers, json=body)
|
|
|
|
|
|
if res.status_code == 200:
|
|
|
@@ -241,15 +244,18 @@ class PushObject:
|
|
|
"category": "myCategory",
|
|
|
"mutable-content": 1
|
|
|
},
|
|
|
+ # ---- 把原来的 push_data 展平到顶层(尤其是 image_url) ----
|
|
|
+ "jump_type": CommonService.get_jump_type(event_type),
|
|
|
"image_url": launch_image,
|
|
|
- "uid": uid,
|
|
|
"channel": channel,
|
|
|
- "received_at": n_time,
|
|
|
"event_time": n_time,
|
|
|
"event_type": event_type,
|
|
|
- "nickname": nickname,
|
|
|
+ "msg":"",
|
|
|
+ "received_at": n_time,
|
|
|
+ "sound":"",
|
|
|
+ "uid": uid,
|
|
|
"zpush": "1",
|
|
|
- "jump_type": CommonService.get_jump_type(event_type)
|
|
|
+ "nickname": nickname,
|
|
|
}
|
|
|
|
|
|
headers = {
|