|
@@ -150,12 +150,20 @@ func (this *UserController) GetVerifyCode() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- phoneVerifyCacheSvc := &services.VerifyCacheIncrService{}
|
|
|
- if e := phoneVerifyCacheSvc.VerifyCacheIncr(phoneKey, 15*int(time.Minute.Seconds())); e != nil {
|
|
|
- utils.FileLog.Info(fmt.Sprintf("验证码手机号临时缓存失败, %v", e))
|
|
|
+ // 设置缓存
|
|
|
+ if go_redis.IsExist(phoneKey) {
|
|
|
+ if e := go_redis.Incr(phoneKey); e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("验证码手机号临时缓存失败, %v", e))
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ go_redis.Set(phoneKey, 1, 15*time.Minute)
|
|
|
}
|
|
|
- if e := phoneVerifyCacheSvc.VerifyCacheIncr(phoneCountKey, int(utils.SetKeyExpireToday().Seconds())); e != nil {
|
|
|
- utils.FileLog.Info(fmt.Sprintf("验证码手机号当日缓存失败, %v", e))
|
|
|
+ if go_redis.IsExist(phoneCountKey) {
|
|
|
+ if e := go_redis.Incr(phoneCountKey); e != nil {
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("验证码手机号当日缓存失败, %v", e))
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ go_redis.Set(phoneCountKey, 1, utils.SetKeyExpireToday())
|
|
|
}
|
|
|
|
|
|
br.Ret = 200
|