You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
776 B
16 lines
776 B
8 months ago
|
'use strict';
|
||
|
const uniPush = uniCloud.getPushManager({
|
||
|
appId: "__UNI__BD5EF27"
|
||
|
}) //注意这里需要传入你的应用appId,用于指定接收消息的客户端
|
||
|
exports.main = async (event, context) => {
|
||
|
let obj = JSON.parse(event.body)
|
||
|
const res = await uniPush.sendMessage({
|
||
|
"push_clientid": obj.cids, // 设备id,支持多个以数组的形式指定多个设备,如["cid-1","cid-2"],数组长度不大于1000
|
||
|
"title": obj.title, // 标题
|
||
|
"content": obj.content, // 内容
|
||
|
"payload": obj.payload, // 数据
|
||
|
"force_notification": true, // 服务端推送 需要加这一句
|
||
|
"request_id": obj.request_id //请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失
|
||
|
})
|
||
|
return res //一定要return回去
|
||
|
};
|