accept-invite.js 520 B

12345678910111213141516171819202122232425
  1. const {
  2. acceptInvite
  3. } = require('../../lib/utils/fission')
  4. /**
  5. * 接受邀请
  6. * @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#accept-invite
  7. * @param {Object} params
  8. * @param {String} params.inviteCode 邀请码
  9. * @returns
  10. */
  11. module.exports = async function (params = {}) {
  12. const schema = {
  13. inviteCode: 'string'
  14. }
  15. this.middleware.validate(params, schema)
  16. const {
  17. inviteCode
  18. } = params
  19. const uid = this.authInfo.uid
  20. return acceptInvite({
  21. uid,
  22. inviteCode
  23. })
  24. }