增加unipush2.0 云服务器,暂时无用之后集成到java中,只是配置需要

This commit is contained in:
xuli3099
2025-09-04 14:03:38 +08:00
parent 95a1187b8a
commit 45b0117f5f
13 changed files with 389 additions and 0 deletions

View 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
}
}
})
};

View File

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