|
|
@@ -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, ` |
|
|
|
|
|
|
|
<script> |
|
|
|