初始提交
This commit is contained in:
17
uniCloud-aliyun/cloudfunctions/jnpfPush/index.js
Normal file
17
uniCloud-aliyun/cloudfunctions/jnpfPush/index.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// 简单的使用示例
|
||||
'use strict';
|
||||
const uniPush = uniCloud.getPushManager({
|
||||
appId: "__UNI__663111E"
|
||||
}) //注意这里需要传入你的应用appId
|
||||
exports.main = async (event, context) => {
|
||||
let data = {
|
||||
...event
|
||||
}
|
||||
return await uniPush.sendMessage({
|
||||
"push_clientid": data.push_clientid, //填写上一步在uni-app客户端获取到的客户端推送标识push_clientid
|
||||
"force_notification": true, //填写true,客户端就会对在线消息自动创建“通知栏消息”。
|
||||
"title": data.title,
|
||||
"content": data.content,
|
||||
"payload": data.payload
|
||||
})
|
||||
};
|
||||
8
uniCloud-aliyun/cloudfunctions/jnpfPush/package.json
Normal file
8
uniCloud-aliyun/cloudfunctions/jnpfPush/package.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "jnpfPush",
|
||||
"dependencies": {},
|
||||
"extensions": {
|
||||
"uni-cloud-push": {},
|
||||
"uni-cloud-jql": {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user