unbind-qq.js 678 B

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