unbind-apple.js 625 字节
Newer Older
study夏羽's avatar
study夏羽 已提交
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 26 27 28 29 30 31 32
const {
  preUnBind,
  postUnBind
} = require('../../lib/utils/relate')
const {
  LOG_TYPE, dbCmd
} = require('../../common/constants')

/**
 * 解绑apple
 * @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#unbind-apple
 * @returns
 */
module.exports = async function () {
  const { uid } = this.authInfo

  await preUnBind.call(this, {
    uid,
    unBindAccount: {
      apple_openid: dbCmd.exists(true)
    },
    logType: LOG_TYPE.UNBIND_APPLE
  })

  return await postUnBind.call(this, {
    uid,
    unBindAccount: {
      apple_openid: dbCmd.remove()
    },
    logType: LOG_TYPE.UNBIND_APPLE
  })
}