'use strict'; const uniPush = uniCloud.getPushManager({ appId: "__UNI__82C0680" }); exports.main = async (event) => { let obj = event.body? JSON.parse(event.body) :{}; //这是重点 解析json字符串 const res = await uniPush.sendMessage({ "push_clientid": obj.clientId, // 设备id,支持多个以数组的形式指定多个设备,如["cid-1","cid-2"],数组长度不大于1000 "title": obj.type, // 标题 "content": obj.content, // 内容 // "payload": obj.data, // 数据 // await this.$store.dispatch("UPDATELOGININFO"); "force_notification": true, // 服务端推送 需要加这一句 "request_id": obj.id, //请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失 // "options": obj.options //消息分类,没申请可以不传这个参数 }); return res; };