Browse Source

fix:象屿登录

Roc 1 year ago
parent
commit
1c261bf0bb
2 changed files with 10 additions and 2 deletions
  1. 8 0
      controller/auth.go
  2. 2 2
      models/request/auth.go

+ 8 - 0
controller/auth.go

@@ -77,6 +77,10 @@ func (a *AuthController) GetEtaToken(c *gin.Context) {
 	if authCode == `` {
 		authCode = req.Code
 	}
+	if authCode == `` {
+		resp.FailData("参数解析失败", "code or auth_code为空", c)
+		return
+	}
 
 	key := fmt.Sprint(utils.CACHE_ETA_AUTH_CODE_PREFIX, authCode)
 	adminName, e := global.Rc.RedisString(key)
@@ -197,6 +201,10 @@ func (a *AuthController) GetCrmToken(c *gin.Context) {
 		resp.FailData("参数解析失败", errs.Translate(global.Trans), c)
 		return
 	}
+	if req.AuthCode == `` {
+		resp.FailData("参数解析失败", "auth_code为空", c)
+		return
+	}
 
 	key := fmt.Sprint(utils.CACHE_CRM_AUTH_CODE_PREFIX, req.AuthCode)
 	adminName, e := global.Rc.RedisString(key)

+ 2 - 2
models/request/auth.go

@@ -6,6 +6,6 @@ type CreateAuthCodeReq struct {
 }
 
 type TokenLoginReq struct {
-	AuthCode string `json:"auth_code" form:"auth_code" binding:"required"`
-	Code     string `json:"code" form:"code" binding:"required"`
+	AuthCode string `json:"auth_code" form:"auth_code"`
+	Code     string `json:"code" form:"code"`
 }