2025-09-30 16:42:25 +08:00

18 lines
923 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 简单的使用示例
'use strict';
const uniPush = uniCloud.getPushManager({appId:"__UNI__89F511F"}) //注意这里需要传入你的应用appId
exports.main = async (event, context) => {
return await uniPush.sendMessage({
"push_clientid": "58614bcaadae8a6998d166a21e61772f", //填写上一步在uni-app客户端获取到的客户端推送标识push_clientid
"force_notification":true, //填写true客户端就会对在线消息自动创建“通知栏消息”。
"title": "通知栏显示的标题",
"content": "通知栏显示的内容",
"settings": {
//消息有效期设置,单位毫秒,-1表示不设离线。默认是 2 小时,取值范围:-1 3 * 24 * 3600 * 1000(3天)之间
"ttl":86400000
},
"payload": {
"text":"体验一下uni-push2.0"
},
})
};