|
@@ -482,6 +482,13 @@ func PcSendEmailCode(email string) (err error, errMsg string) {
|
|
|
err = errors.New("邮箱格式错误,请重新输入")
|
|
|
return
|
|
|
}
|
|
|
+ cacheKey := utils.HONGZEYB_ + "REPORT_SMS_CODE_PC:PcSendEmailCode:" + email
|
|
|
+ smsCodeStr, _ := global.Redis.Get(context.TODO(), cacheKey).Result()
|
|
|
+ if smsCodeStr != "" {
|
|
|
+ err = errors.New("请勿频繁发送验证码")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
msgCode := utils.GetRandDigit(4)
|
|
|
content := "尊敬的用户:</br>您好,感谢您使用弘则研究,您正在进行邮箱验证,本次请求的验证码为:" + msgCode + "(为了保障您账号的安全性,请在15分钟内完成验证。)</br>弘则研究团队 </br>" + time.Now().Format(utils.FormatDateCN)
|
|
|
title := "弘则研究登陆验证"
|
|
@@ -498,6 +505,7 @@ func PcSendEmailCode(email string) (err error, errMsg string) {
|
|
|
LastUpdatedTime: time.Time{},
|
|
|
}
|
|
|
err = item.Create()
|
|
|
+ global.Redis.Set(context.TODO(), cacheKey, msgCode, 60*time.Second)
|
|
|
} else {
|
|
|
err = errors.New("发送失败")
|
|
|
}
|