官方加工后的h5页面
小于 1 分钟languagewechat
经官方带code
服务号菜单项上的网址链接不可直接赋予目的链接,要类似下面
String devToolUrl = "https://www.xdfznh.club/wxpadfe/devtools";
String en = URLEncoder.encode(devToolUrl);
String fullUrl_devTools="https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
DevMaterial.XDFSOFT.APPID +
"&redirect_uri=" + en + "&response_type=code&scope=snsapi_base&state=1#wechat_redirect";
经过微信官方加工后转跳到目的页面,微信官方会在地址连接上追加 code ,后端使用该 code 请求来当前微信用户的 openid ,否则无法获取微信用户的 openid
# 例如目标URL是:https://你的域名/wxpadfe/meter/SchedulingPlan.html
# 那么替换后的地址是:
https://open.weixin.qq.com/connect/oauth2/authorize?appid=你的服务号APPID&redirect_uri=https://你的域名/wxpadfe/meter/SchedulingPlan.html&response_type=code&scope=snsapi_base&state=123#wechat_redirect
在微信开发者工具中同样可以通过上面加工过的地址获得 code 来正常执行业务。即该URL的原始模板是
https:/connect/oauth2/authorize?appid=你的公众号appid&redirect_uri=实际要访问页面的URL地址&response_type=code&scope=snsapi_base&state=123#wechat_redirect
