integrated_traffic_uniapp/uniCloud-aliyun/cloudfunctions/unipush/index.js

12 lines
462 B
JavaScript
Raw Normal View History

2024-01-16 17:24:49 +08:00
'use strict';
exports.main = async (event, context) => {
let body = event.body;
if (event.isBase64Encoded) {body = Buffer.from(body);}
if(!body) {return { message: 'no body'};}
const param = JSON.parse(body);
// 云函数是通用的,和项目没有直接的关系。通过传递 appId,可以为多个项目进行推送
const uniPush = uniCloud.getPushManager({appId:"__UNI__C846DA5"});
return await uniPush.sendMessage(param);
};