const.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. package common
  2. const (
  3. // success
  4. Success = 200
  5. // parameters invalid
  6. InvalidParametes = 1001
  7. // 记录创建失败
  8. DbInsertErr = 1011
  9. // 记录更新失败
  10. DbUpdateErr = 1012
  11. // 记录删除失败
  12. DbDeleteErr = 1013
  13. // 记录查询失败
  14. DbRecordNotFound = 1014
  15. // 系统用户不存在
  16. SystemHasNoUser = 1022
  17. // 手机号码重复
  18. MobileRepeat = 1023
  19. // 手机号无效或密码错误
  20. MobileInvalidPwdError = 1024
  21. // 无效的验证码
  22. SmsCodeInvalid = 1025
  23. // 验证码已失效
  24. SmsCodeExpired = 1026
  25. // 手机号码格式有误
  26. MobileFormatError = 1027
  27. // 无效的文件内容
  28. InvalidFileContent = 1031
  29. // 文件大小超出最大限制
  30. FileSizeOverLimit = 1032
  31. // 文件保存失败
  32. FileSaveFailed = 1033
  33. )
  34. const (
  35. QueryStateSuccess = 0 // 从myssql中查询到了记录
  36. QueryStateNone = 2 // 未查询到任何记录
  37. )
  38. const (
  39. // sms expire seconds
  40. SmsExpiredSeconds = 600
  41. // default gender
  42. GenderUnknow = 0
  43. )
  44. const (
  45. SmsTypeRegister = 1 // 注册
  46. SmsTypeGetback = 2 // 找回密码
  47. SmsTypeBindMobile = 3 // 绑定手机号
  48. SmsTypeQuickLogin = 4 // 快捷登录
  49. )
  50. const (
  51. LoginTypeMobile = 1 // 手机号登录
  52. LoginTypeQuick = 2 // 快捷登录
  53. LoginTypeThirdParty = 3 // 第三方登录
  54. )
  55. const (
  56. BindTypeWechat = 10 // 绑定微信
  57. BindTypeQQ = 11 // 绑定QQ
  58. BindTypeWeibo = 12 // 绑定微博
  59. )
  60. // 微信第三方登录必备
  61. const (
  62. WxAppId = "wx88fe165b2e4236b6"
  63. WxAppSecret = "647520760882a91fe2754cffded4b1f5"
  64. )
  65. /// 阿里短信配置
  66. const (
  67. RegionId = "cn-hangzhou"
  68. AccessKeyId = "LTAI4GEM9Zz2Tsvb8nicmwXV"
  69. AccessSecret = "kNVHucWT57Wl7PP1ds2QCxilTSjaY0"
  70. SignName = "荔枝悦动"
  71. )
  72. /// 腾讯云短信配置
  73. const (
  74. SdkAppId = "1400081008"
  75. SdkAppKey = "83427541ad50e54450725d789cf396eb"
  76. SdkSmsUrl = "https://yun.tim.qq.com/v5/tlssmssvr/sendsms"
  77. SdkTemplId = 105107
  78. )
  79. /// 阿里云短信模板定义
  80. const (
  81. TemplateCodeRegister = "SMS_193055376"
  82. TemplateCodeFindPwd = "SMS_193055375"
  83. TemplateCodeBindMobile = "SMS_196618124"
  84. TemplateCodeLogin = "SMS_193055378"
  85. )
  86. var SmsTemplateCodeMap = map[int]string{
  87. SmsTypeRegister: TemplateCodeRegister,
  88. SmsTypeGetback: TemplateCodeFindPwd,
  89. SmsTypeBindMobile: TemplateCodeBindMobile,
  90. SmsTypeQuickLogin: TemplateCodeLogin,
  91. }
  92. const SmsValidSeconds = 60