index.js 487 B

1234567891011121314151617
  1. 'use strict';
  2. exports.main = async (event, context) => {
  3. let data = JSON.parse(event.body)
  4. const uniPush = uniCloud.getPushManager({ appId: data.appId })
  5. if (data.type == 'bindCid') {
  6. return await uniPush.cidBindAlias(data.alias);
  7. } else {
  8. return await uniPush.sendMessage({
  9. "getui_alias": data.toUser,
  10. "title": data.title,
  11. "content": data.content,
  12. "force_notification": data.force_notification ? data.force_notification : false,
  13. "payload": data.payload
  14. })
  15. }
  16. }