针对同一条消息,type为click和receive的两种类型监听到的值不一样,click类型获取不到playload的值。

hqzmss
- 发布:2024-04-11 11:24
- 更新:2024-04-11 14:42
- 阅读:480

hqzmss (作者)
请求参数如下:
{
"push_clientid": "af3c0f76e32b0a568ceafc189da92b87",
"title": "抢单通知",
"content": "平台用户您好,您提交的运维工单审核通过,点击进入>>",
"payload": "1",
"options": {
"HW": {
"/message/android/category": "WORK"
}
}
}
云函数日志如下:
请求入参: {
"args": {
"path": "/",
"httpMethod": "POST",
"headers": {
"content-length": "309",
"cookie": "aliyungf_tc=30ce5f3903a35b8b3c990b608449061a60d316d4fc605b2c34fcec41d59d3063",
"x5-uuid": "f2b039eb99e8620e03915eafd1254924",
"x-client-ip": "111.22.53.16",
"x-forwarded-for": "111.22.53.16, 47.111.193.81, 39.96.130.149",
"accept": "*/*",
"authorization": "Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ5emFkbWluIiwiY3JlYXRlZCI6MTcxMjA0MjQ4NTEzMSwiY29tcGFueSI6MjUxLCJleHAiOjE3MTIxMjg4ODUsInVzZXJJZCI6NDcyLCJ1c2VyIjp7ImlkIjo0NzIsImNvbXBhbnlfaWQiOjI1MSwiY29tcGFueV9uYW1lIjpudWxsLCJkZXBhcnRfaWQiOm51bGwsImRlcGFydF9uYW1lIjpudWxsLCJ1c2VyX25hbWUiOiJ5emFkbWluIiwidXNlcl9uaWtlX25hbWUiOiLnrqHnkIblkZjvvIjkuJrkuLvvvIkiLCJwd2QiOm51bGwsInB3ZF9zYWx0IjpudWxsLCJ1c2VyX3NleCI6MSwidXNlcl9waG9uZSI6IjE4NTI4MjY5MDk4IiwidXNlcl9lbWFpbCI6IjEyM0AxcXEuY29tIiwiaGVhZF9pbWciOiJodHRwOi8vMTExLjI5LjYxLjExNTo1MTg4Ni9idHYvMjUxLzgzMTQyMDQyLWMwYWYtNDc2OC05ZjFlLThkNzI2ZmQyYjI4NS5qcGciLCJzdGF0dXMiOjEsImNyZWF0ZV91c2V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oyOSIsImNyZWF0ZV90aW1lIjoiMjAxOC0wOC0xNCAyMDowMjozMCJ9LHsicm9sZV9pZCI6NjkyLCJjb21wYW55X2lkIjoyNTEsIm5hbWUiOiLov5DooYzop5LoibIiLCJyZW1hcmsiOiLov5DooYzop5LoibIiLCJzdGF0dXMiOjEsImlzX2NoZWNrIjpudWxsLCJ1cGRhdGVfdGltZSI6IjIwMjQtMDMtMDggMTY6MTU6MzQiLCJjcmVhdGVfdGltZSI6IjIwMjMtMTItMjAgMTQ6MzQ6NDkifV19fQ.EEqVuTEsIQe721pBGGqdeyOgro5bgg9cxhaANhrFKGtR21BMvWmA0_t9jxyHVCk0nTurAvEw0LM9HhVeoqWO4w",
"x-real-ip": "111.22.53.16",
"x-sinfo": "on",
"host": "fc-mp-a4d21e68-f39a-411a-a148-f1b6e244bee3.next.bspapp.com",
"content-type": "application/json",
"x-forwarded-by": "172.28.211.101:80",
"accept-encoding": "gzip, deflate, br",
"user-agent": "Apifox/1.0.0 (https://apifox.com)"
},
"queryStringParameters": {},
"isBase64Encoded": false,
"body": "{\r\n \"push_clientid\": \"af3c0f76e32b0a568ceafc189da92b87\",\r\n \"title\": \"抢单通知\",\r\n \"content\": \"平台用户您好,您提交的运维工单审核通过,点击进入>>\",\r\n \"payload\": \"1\",\r\n \"options\": {\r\n \"HW\": {\r\n \"/message/android/category\": \"WORK\"\r\n }\r\n }\r\n}"
},
"requestId": "ac1cd3651712817651904145822"
}
[uni-push/ac1cd3651712817651904145822/14ms/DEBUG] event ===> { path: '/',
httpMethod: 'POST',
headers:
{ 'content-length': '309',
cookie: 'aliyungf_tc=30ce5f3903a35b8b3c990b608449061a60d316d4fc605b2c34fcec41d59d3063',
'x5-uuid': 'f2b039eb99e8620e03915eafd1254924',
'x-client-ip': '111.22.53.16',
'x-forwarded-for': '111.22.53.16, 47.111.193.81, 39.96.130.149',
accept: '*/*',
authorization: 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ5emFkbWluIiwi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RyZXNzIjpudWxsLCJsaW5rbWFuIjpudWxsLCJ0ZWwiOm51bGwsImhvbWVfdXJsIjpudWxsLCJyZW1hcmsiOm51bGwsInN5c19uYW1lIjpudWxsLCJsb2dvIjpudWxsLCJpY28iOm51bGwsInN5c19iYWNrIjpudWxsLCJlcnJvcl9ub3RpY2VfbW9kZSI6bnVsbCwic2VydmVyX2FkZHJlc3MiOm51bGwsImxvZ190eXBlIjoxLCJoYXZlX2NvbXBhbnkiOlsyLDNdLCJ1c2VyX3R5cGUiOjEsInJ6dF91c2VyX2lkIjpudWxsLCJjb21wYW55VHlwZSI6bnVsbCwicm9vdElkIjpudWxsLCJleHBpcmUiOm51bGwsInJvbGVzIjpbeyJyb2xlX2lkIjoyNzgsImNvbXBhbnlfaWQiOjI1MSwibmFtZSI6Iui2hee6p-euoeeQhuWRmCIsInJlbWFyayI6Iui2hee6p-euoeeQhuWRmCIsInN0YXR1cyI6MSwiaXNfY2hlY2siOm51bGwsInVwZGF0ZV90aW1lIjoiMjAyNC0wNC0wMSAxNDo1MzoyOSIsImNyZWF0ZV90aW1lIjoiMjAxOC0wOC0xNCAyMDowMjozMCJ9LHsicm9sZV9pZCI6NjkyLCJjb21wYW55X2lkIjoyNTEsIm5hbWUiOiLov5DooYzop5LoibIiLCJyZW1hcmsiOiLov5DooYzop5LoibIiLCJzdGF0dXMiOjEsImlzX2NoZWNrIjpudWxsLCJ1cGRhdGVfdGltZSI6IjIwMjQtMDMtMDggMTY6MTU6MzQiLCJjcmVhdGVfdGltZSI6IjIwMjMtMTItMjAgMTQ6MzQ6NDkifV19fQ.EEqVuTEsIQe721pBGGqdeyOgro5bgg9cxhaANhrFKGtR21BMvWmA0_t9jxyHVCk0nTurAvEw0LM9HhVeoqWO4w',
'x-real-ip': '111.22.53.16',
'x-sinfo': 'on',
host: 'fc-mp-a4d21e68-f39a-411a-a148-f1b6e244bee3.next.bspapp.com',
'content-type': 'application/json',
'x-forwarded-by': '172.28.211.101:80',
'accept-encoding': 'gzip, deflate, br',
'user-agent': 'Apifox/1.0.0 (https://apifox.com)' },
queryStringParameters: {},
isBase64Encoded: false,
body: '{\r\n "push_clientid": "af3c0f76e32b0a568ceafc189da92b87",\r\n "title": "抢单通知",\r\n "content": "平台用户您好,您提交的运维工单审核通过,点击进入>>",\r\n "payload": "1",\r\n "options": {\r\n "HW": {\r\n "/message/android/category": "WORK"\r\n }\r\n }\r\n}' }
[uni-push/ac1cd3651712817651904145822/16ms/DEBUG] context ===> { DEVICEID: undefined,
uniIdToken: undefined,
secretType: 'none',
SOURCE: 'http',
CLIENTIP: '111.22.53.16',
CLIENTUA: 'Apifox/1.0.0 (https://apifox.com)',
SPACEINFO:
{ spaceId: 'mp-a4d21e68-f39a-411a-a148-f1b6e244bee3',
provider: 'aliyun',
useOldSpaceId: false },
FUNCTION_NAME: 'uni-push',
requestId: 'ac1cd3651712817651904145822',
FUNCTION_TYPE: 'cloudfunction' }
[uni-push/ac1cd3651712817651904145822/16ms/DEBUG] params ===> { push_clientid: 'af3c0f76e32b0a568ceafc189da92b87',
title: '抢单通知',
content: '平台用户您好,您提交的运维工单审核通过,点击进入>>',
payload: '1',
options: { HW: { '/message/android/category': 'WORK' } } }
请求响应状态: success
hqzmss (作者)
消息,日志贴在下面了,麻烦帮忙看一下
2024-04-11 14:42
DCloud_Android_THB
回复 hqzmss: click的是离线推送?
2024-04-11 15:09
hqzmss (作者)
回复 DCloud_Android_THB: 都是离线推送的,同一条消息,针对不同类型监听了两次。消息只发了一条。
2024-04-11 15:36
DCloud_Android_THB
回复 hqzmss: 离线推送怎么会有receive事件?
2024-04-11 15:47
hqzmss (作者)
回复 DCloud_Android_THB: 是这样的,我们实际的业务是要离线推送,通过click事件获取到payload,以此来跳转到不同的页面。测试的时候为了方便就打开了app,然后就出现了这个问题,click事件拿不到payload参数。
2024-04-11 16:37
DCloud_Android_THB
回复 hqzmss: 为这边测试是正常的
发送:
"push_clientid": "6c4896c3f4ea2a009d20d0cd5e8a1206",
"title": "留言",
"content": "留言审核通过",
// "payload": {
// "name": "留言审核通过",
// "time": Date.now()
// },
"payload":"1",
结果:
{"type":"click","data":{"title":"留言","content":"\"留言审核通过\"","unipush_version":"2.0","payload":"1","UUID":"androidPushMsg207357135","appid":"UNIEE8E36A"}}
2024-04-11 17:26