rdluck 4 年之前
父節點
當前提交
823bfe6121
共有 1 個文件被更改,包括 5 次插入7 次删除
  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()