// 简单的使用示例 'use strict'; exports.main = async (event, context) => { const db = uniCloud.database() const regsTable = db.collection('mustgo-registration') const res = await regsTable.where({ owner_id: event.uid, notified: false }).get() let arr = new Array let list = new Array arr = res.data for (var i = 0; i < arr.length; i++) { const teamActivityTable = db.collection('mustgo-team-activity') const activity = await teamActivityTable.where({ _id: arr[i]["team_activity_id"] }).get() list.push(activity.data[0].title) } const uniPush = uniCloud.getPushManager({ appId: "__UNI__AAFC50C" }); let result = new Array for (var i = 0; i < list.length; i++) { let tmp = await uniPush.sendMessage({ "push_clientid": event.cid, "title": "小队活动即将开始", "content": "您报名的小队活动" + list[i] + "即将开始,快来看看吧~", "payload": event.payload, "force_notification": true, "request_id": event.request_id, "badge": event.badge }); await regsTable.doc(arr[i].owner_id).update({ notified: true }) result.push(tmp) } return result };