rdluck 4 éve
szülő
commit
823bfe6121
1 módosított fájl, 5 hozzáadás és 7 törlés
  1. 5 7
      controllers/base_auth.go

+ 5 - 7
controllers/base_auth.go

@@ -33,13 +33,11 @@ func (this *BaseAuthController) Prepare() {
 	if method != "HEAD" {
 		if method == "POST" || method == "GET" {
 			authorization := this.Ctx.Input.Header("Authorization")
-			utils.FileLog.Info("authorization:%s,cookie:%s", authorization)
-			//cookie := this.Ctx.GetCookie("rddp_access_token")
-			//utils.FileLog.Info("authorization:%s,cookie:%s", authorization, cookie)
-			//if authorization == "" {
-			//	authorization = cookie
-			//}
-			//fmt.Println("authorization:", authorization)
+			if authorization == "" {
+				cookie := this.Ctx.GetCookie("rddp_access_token")
+				utils.FileLog.Info("authorization:%s,cookie:%s", authorization, cookie)
+				authorization = cookie
+			}
 			if authorization == "" {
 				this.JSON(models.BaseResponse{Ret: 408, Msg: "请重新授权!", ErrMsg: "请重新授权:Token is empty or account is empty"}, false, false)
 				this.StopRun()