accept-invite.js 520 字节
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
const {
  acceptInvite
} = require('../../lib/utils/fission')

/**
 * 接受邀请
 * @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#accept-invite
 * @param {Object} params
 * @param {String} params.inviteCode  邀请码
 * @returns
 */
module.exports = async function (params = {}) {
  const schema = {
    inviteCode: 'string'
  }
  this.middleware.validate(params, schema)
  const {
    inviteCode
  } = params
  const uid = this.authInfo.uid
  return acceptInvite({
    uid,
    inviteCode
  })
}