unbind-apple.js 625 B

1234567891011121314151617181920212223242526272829303132
  1. const {
  2. preUnBind,
  3. postUnBind
  4. } = require('../../lib/utils/relate')
  5. const {
  6. LOG_TYPE, dbCmd
  7. } = require('../../common/constants')
  8. /**
  9. * 解绑apple
  10. * @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#unbind-apple
  11. * @returns
  12. */
  13. module.exports = async function () {
  14. const { uid } = this.authInfo
  15. await preUnBind.call(this, {
  16. uid,
  17. unBindAccount: {
  18. apple_openid: dbCmd.exists(true)
  19. },
  20. logType: LOG_TYPE.UNBIND_APPLE
  21. })
  22. return await postUnBind.call(this, {
  23. uid,
  24. unBindAccount: {
  25. apple_openid: dbCmd.remove()
  26. },
  27. logType: LOG_TYPE.UNBIND_APPLE
  28. })
  29. }