Browse Source

233-登录验证码获取限制-验证码限制

gmy 3 months ago
parent
commit
277470e4d0
2 changed files with 5 additions and 1 deletions
  1. 4 0
      controller/pc/pc.go
  2. 1 1
      models/tables/rddp/msg_code/query.go

+ 4 - 0
controller/pc/pc.go

@@ -702,6 +702,10 @@ func PcLogin(c *gin.Context) {
 			response.Fail("手机验证码错误,请重新输入", c)
 			return
 		}
+		if item.Code != req.SmsCode {
+			response.Fail("验证码失效,请重新最新验证码", c)
+			return
+		}
 
 		wxUser, err := wx_user.GetByMobile(req.Mobile)
 		if err != nil {

+ 1 - 1
models/tables/rddp/msg_code/query.go

@@ -6,6 +6,6 @@ import (
 
 // GetMsgCode 根据token获取信息
 func GetMsgCode(mobile, code string) (item *MsgCode, err error) {
-	err = rddp.GetDb().Where("mobile = ? and code = ? and FROM_UNIXTIME(expired_in)>=NOW() ", mobile, code).First(&item).Error
+	err = rddp.GetDb().Where("mobile = ? and FROM_UNIXTIME(expired_in)>=NOW() ", mobile).Order("msg_code_id DESC").First(&item).Error
 	return
 }