constants.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. const db = uniCloud.database()
  2. const dbCmd = db.command
  3. const userCollectionName = 'uni-id-users'
  4. const userCollection = db.collection(userCollectionName)
  5. const verifyCollectionName = 'opendb-verify-codes'
  6. const verifyCollection = db.collection(verifyCollectionName)
  7. const deviceCollectionName = 'uni-id-device'
  8. const deviceCollection = db.collection(deviceCollectionName)
  9. const openDataCollectionName = 'opendb-open-data'
  10. const openDataCollection = db.collection(openDataCollectionName)
  11. const frvLogsCollectionName = 'opendb-frv-logs'
  12. const frvLogsCollection = db.collection(frvLogsCollectionName)
  13. const USER_IDENTIFIER = {
  14. _id: 'uid',
  15. username: 'username',
  16. mobile: 'mobile',
  17. email: 'email',
  18. wx_unionid: 'wechat-account',
  19. 'wx_openid.app': 'wechat-account',
  20. 'wx_openid.mp': 'wechat-account',
  21. 'wx_openid.h5': 'wechat-account',
  22. 'wx_openid.web': 'wechat-account',
  23. qq_unionid: 'qq-account',
  24. 'qq_openid.app': 'qq-account',
  25. 'qq_openid.mp': 'qq-account',
  26. ali_openid: 'alipay-account',
  27. apple_openid: 'alipay-account',
  28. identities: 'idp'
  29. }
  30. const USER_STATUS = {
  31. NORMAL: 0,
  32. BANNED: 1,
  33. AUDITING: 2,
  34. AUDIT_FAILED: 3,
  35. CLOSED: 4
  36. }
  37. const CAPTCHA_SCENE = {
  38. REGISTER: 'register',
  39. LOGIN_BY_PWD: 'login-by-pwd',
  40. LOGIN_BY_SMS: 'login-by-sms',
  41. RESET_PWD_BY_SMS: 'reset-pwd-by-sms',
  42. RESET_PWD_BY_EMAIL: 'reset-pwd-by-email',
  43. SEND_SMS_CODE: 'send-sms-code',
  44. SEND_EMAIL_CODE: 'send-email-code',
  45. BIND_MOBILE_BY_SMS: 'bind-mobile-by-sms',
  46. SET_PWD_BY_SMS: 'set-pwd-by-sms'
  47. }
  48. const LOG_TYPE = {
  49. LOGOUT: 'logout',
  50. LOGIN: 'login',
  51. REGISTER: 'register',
  52. RESET_PWD_BY_SMS: 'reset-pwd',
  53. RESET_PWD_BY_EMAIL: 'reset-pwd',
  54. BIND_MOBILE: 'bind-mobile',
  55. BIND_WEIXIN: 'bind-weixin',
  56. BIND_QQ: 'bind-qq',
  57. BIND_APPLE: 'bind-apple',
  58. BIND_ALIPAY: 'bind-alipay',
  59. UNBIND_WEIXIN: 'unbind-weixin',
  60. UNBIND_QQ: 'unbind-qq',
  61. UNBIND_ALIPAY: 'unbind-alipay',
  62. UNBIND_APPLE: 'unbind-apple'
  63. }
  64. const SMS_SCENE = {
  65. LOGIN_BY_SMS: 'login-by-sms',
  66. RESET_PWD_BY_SMS: 'reset-pwd-by-sms',
  67. BIND_MOBILE_BY_SMS: 'bind-mobile-by-sms',
  68. SET_PWD_BY_SMS: 'set-pwd-by-sms'
  69. }
  70. const EMAIL_SCENE = {
  71. REGISTER: 'register',
  72. LOGIN_BY_EMAIL: 'login-by-email',
  73. RESET_PWD_BY_EMAIL: 'reset-pwd-by-email',
  74. BIND_EMAIL: 'bind-email'
  75. }
  76. const REAL_NAME_STATUS = {
  77. NOT_CERTIFIED: 0,
  78. WAITING_CERTIFIED: 1,
  79. CERTIFIED: 2,
  80. CERTIFY_FAILED: 3
  81. }
  82. const EXTERNAL_DIRECT_CONNECT_PROVIDER = 'externalDirectConnect'
  83. module.exports = {
  84. db,
  85. dbCmd,
  86. userCollection,
  87. verifyCollection,
  88. deviceCollection,
  89. openDataCollection,
  90. frvLogsCollection,
  91. USER_IDENTIFIER,
  92. USER_STATUS,
  93. CAPTCHA_SCENE,
  94. LOG_TYPE,
  95. SMS_SCENE,
  96. EMAIL_SCENE,
  97. REAL_NAME_STATUS,
  98. EXTERNAL_DIRECT_CONNECT_PROVIDER
  99. }