消息推送

This commit is contained in:
仲么了
2023-09-13 16:40:03 +08:00
parent f8d8229cc1
commit f9bb466096
13 changed files with 204 additions and 154 deletions

View File

@@ -0,0 +1,20 @@
'use strict';
const uniPush = uniCloud.getPushManager({appId: "__UNI__88BC25B"})
exports.main = async (event, context) => {
//event为客户端上传的参数
console.log('event : ', event)
let body = JSON.parse(event.body)
let res = await uniPush.sendMessage({
"push_clientid": body.push_clientid, //填写上一步在uni-app客户端获取到的客户端推送标识push_clientid
"title": body.title,
"content": body.content,
"payload": body.payload,
"force_notification": true,
"settings": {
"strategy": {
"default": 4
}
}
})
return res
};

View File

@@ -0,0 +1,7 @@
{
"name": "push",
"dependencies": {},
"extensions": {
"uni-cloud-push": {}
}
}