@@ -20,6 +20,7 @@ const (
20
20
getComponentInfoURL = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info?component_access_token=%s"
21
21
componentLoginURL = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=%s&pre_auth_code=%s&redirect_uri=%s&auth_type=%d&biz_appid=%s"
22
22
bindComponentURL = "https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&auth_type=%d&no_scan=1&component_appid=%s&pre_auth_code=%s&redirect_uri=%s&biz_appid=%s#wechat_redirect"
23
+ bindComponentURLV2 = "https://open.weixin.qq.com/wxaopen/safe/bindcomponent?action=bindcomponent&auth_type=%d&no_scan=1&component_appid=%s&pre_auth_code=%s&redirect_uri=%s&biz_appid=%s#wechat_redirect"
23
24
// TODO 获取授权方选项信息
24
25
// getComponentConfigURL = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_option?component_access_token=%s"
25
26
// TODO 获取已授权的账号信息
@@ -137,6 +138,20 @@ func (ctx *Context) GetBindComponentURL(redirectURI string, authType int, bizApp
137
138
return ctx .GetBindComponentURLContext (context .Background (), redirectURI , authType , bizAppID )
138
139
}
139
140
141
+ // GetBindComponentURLV2Context 获取新版本第三方公众号授权链接(链接跳转,适用移动端)
142
+ func (ctx * Context ) GetBindComponentURLV2Context (stdCtx context.Context , redirectURI string , authType int , bizAppID string ) (string , error ) {
143
+ code , err := ctx .GetPreCodeContext (stdCtx )
144
+ if err != nil {
145
+ return "" , err
146
+ }
147
+ return fmt .Sprintf (bindComponentURLV2 , authType , ctx .AppID , code , url .QueryEscape (redirectURI ), bizAppID ), nil
148
+ }
149
+
150
+ // GetBindComponentURLV2 获取新版本第三方公众号授权链接(链接跳转,适用移动端)
151
+ func (ctx * Context ) GetBindComponentURLV2 (redirectURI string , authType int , bizAppID string ) (string , error ) {
152
+ return ctx .GetBindComponentURLContext (context .Background (), redirectURI , authType , bizAppID )
153
+ }
154
+
140
155
// ID 微信返回接口中各种类型字段
141
156
type ID struct {
142
157
ID int `json:"id"`
0 commit comments