Browse Source

update

master
dengbiao 4 months ago
parent
commit
dbce83940f
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      app/hdl/hdl_wx_open.go

+ 6
- 6
app/hdl/hdl_wx_open.go View File

@@ -150,26 +150,26 @@ func GetPreAuthCode(c *gin.Context) {
} }


c.Writer.Header().Set("Access-Control-Allow-Origin", "*") 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 { if cfg.Prd {
redirectURI = "http://super.advertisement.dengbiao.top/api/wxOpen/getAuthUrlCallBack"
redirectURI = "http://www.baidu.com/api/wxOpen/getAuthUrlCallBack?masterId=" + masterId
} }
// 对redirectURI进行URL编码 // 对redirectURI进行URL编码
encodedRedirectURI := url.QueryEscape(redirectURI)
//encodedRedirectURI := url.QueryEscape(redirectURI)


// 构造微信登录页面的URL // 构造微信登录页面的URL
baseURL := "https://mp.weixin.qq.com/cgi-bin/componentloginpage" baseURL := "https://mp.weixin.qq.com/cgi-bin/componentloginpage"
query := url.Values{} query := url.Values{}
query.Add("component_appid", wxOpenThirdPartyAppList.Appid) query.Add("component_appid", wxOpenThirdPartyAppList.Appid)
query.Add("pre_auth_code", preAuthCode) 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 // 将查询参数附加到基础URL
authURL := baseURL + "?" + query.Encode() authURL := baseURL + "?" + query.Encode()


// 设置JavaScript重定向 // 设置JavaScript重定向
c.Header("Content-Type", "text/html") //TODO::必须指定相应内容为 text/html, 否则浏览器不能正确解析
t ad c.Header("Content-Type", "text/html") //TODO::必须指定相应内容为 text/html, 否则浏览器不能正确解析
c.String(200, ` c.String(200, `


<script> <script>


Loading…
Cancel
Save