增加unipush2.0 云服务器,暂时无用之后集成到java中,只是配置需要
This commit is contained in:
32
uniCloud-aliyun/cloudfunctions/testUnipush2/index.js
Normal file
32
uniCloud-aliyun/cloudfunctions/testUnipush2/index.js
Normal file
@@ -0,0 +1,32 @@
|
||||
// 'use strict';
|
||||
// exports.main = async (event, context) => {
|
||||
// //event为客户端上传的参数
|
||||
// console.log('event : ', event)
|
||||
|
||||
// //返回数据给客户端
|
||||
// return event
|
||||
// };
|
||||
|
||||
|
||||
// 简单的使用示例
|
||||
'use strict';
|
||||
const uniPush = uniCloud.getPushManager({appId:"__UNI__4C459F4"}) //注意这里需要传入你的应用appId
|
||||
exports.main = async (event, context) => {
|
||||
//event为客户端上传的参数
|
||||
console.log('event : ', event)
|
||||
return await uniPush.sendMessage({
|
||||
"push_clientid": "xxx", //填写上一步在uni-app客户端获取到的客户端推送标识push_clientid
|
||||
"force_notification":true, //填写true,客户端就会对在线消息自动创建“通知栏消息”。
|
||||
"title": "通知栏显示的标题",
|
||||
"content": "通知栏显示的内容",
|
||||
"payload": {
|
||||
"text":"体验一下uni-push2.0"
|
||||
}
|
||||
"options":{
|
||||
"HW": {
|
||||
// 1 表示华为测试消息,华为每个应用每日可发送该测试消息500条,此target_user_type 参数请勿发布至线上。
|
||||
"/message/android/target_user_type":1
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
7
uniCloud-aliyun/cloudfunctions/testUnipush2/package.json
Normal file
7
uniCloud-aliyun/cloudfunctions/testUnipush2/package.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "testUnipush2",
|
||||
"dependencies": {},
|
||||
"extensions": {
|
||||
"uni-cloud-push": {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user