package controllers import ( "fmt" "hongze/hongze_mobile_admin/utils" "net/url" ) //不需要授权的基类 type BaseNotAuth struct { BaseCommon } func (c *BaseNotAuth) Prepare() { var requestBody string method := c.Ctx.Input.Method() if method == "GET" { requestBody = c.Ctx.Request.RequestURI } else { requestBody, _ = url.QueryUnescape(string(c.Ctx.Input.RequestBody)) } fmt.Println("requestBody:", requestBody) ip := c.Ctx.Input.IP() fmt.Println("ip:", ip) //apiLog.Println("请求地址:", c.Ctx.Input.URI(), "RequestBody:", requestBody, "IP:", ip) authorization := c.Ctx.Input.Header("Authorization") if authorization == "" { cookie := c.Ctx.GetCookie("rddp_access_token") utils.FileLog.Info("authorization:%s,cookie:%s", authorization, cookie) authorization = cookie } uri := c.Ctx.Input.URI() utils.FileLog.Info("URI:%s", uri) //if strings.Contains(uri, "/h5adminapi/wechat/login") { // authorization = "" //} }