From dbce83940ffc772894e4a75222caac67b76bf5d8 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Tue, 20 Aug 2024 22:25:04 +0800 Subject: [PATCH] update --- app/hdl/hdl_wx_open.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/hdl/hdl_wx_open.go b/app/hdl/hdl_wx_open.go index 08a0c08..b2728fd 100644 --- a/app/hdl/hdl_wx_open.go +++ b/app/hdl/hdl_wx_open.go @@ -150,26 +150,26 @@ func GetPreAuthCode(c *gin.Context) { } c.Writer.Header().Set("Access-Control-Allow-Origin", "*") - redirectURI := "http://super.advertisement.dengbiao.top/api/wxOpen/getAuthUrlCallBack" + redirectURI := "http://super.advertisement.dengbiao.top/api/wxOpen/getAuthUrlCallBack?masterId=" + masterId if cfg.Prd { - redirectURI = "http://super.advertisement.dengbiao.top/api/wxOpen/getAuthUrlCallBack" + redirectURI = "http://www.baidu.com/api/wxOpen/getAuthUrlCallBack?masterId=" + masterId } // 对redirectURI进行URL编码 - encodedRedirectURI := url.QueryEscape(redirectURI) + //encodedRedirectURI := url.QueryEscape(redirectURI) // 构造微信登录页面的URL baseURL := "https://mp.weixin.qq.com/cgi-bin/componentloginpage" query := url.Values{} query.Add("component_appid", wxOpenThirdPartyAppList.Appid) query.Add("pre_auth_code", preAuthCode) - query.Add("redirect_uri", encodedRedirectURI) - query.Add("auth_type", "1") + query.Add("redirect_uri", redirectURI) + query.Add("auth_type", "2") // 将查询参数附加到基础URL authURL := baseURL + "?" + query.Encode() // 设置JavaScript重定向 - c.Header("Content-Type", "text/html") //TODO::必须指定相应内容为 text/html, 否则浏览器不能正确解析 +t ad c.Header("Content-Type", "text/html") //TODO::必须指定相应内容为 text/html, 否则浏览器不能正确解析 c.String(200, `