收藏
回答

为什么生成的链接提示需要手机打开?

我现在正在开发三方网站绑定微信的功能,客户端请求后,生成绑定的链接,这是服务端代码;


@Override

@NoCheck

public Response getQRCodeUrl(String appId,String userAction) throws UnsupportedEncodingException {

List<AppMap> appMaps = sysAppMapService.getAppMapByAppId("bind".equals(userAction)? RequestContext.getAppId() :appId, AccountType.WECHAT);

if (CollectionUtils.isEmpty(appMaps) || appMaps.size() > 1) {

throw GlobalException.PARAM_VERIFY_EXCEPTION;

}

String referer = request.getHeader("Referer");

String redirectUrl = appMaps.get(0).getLoginSuccessRedirectUrl();

if (!HttpUtil.verifyRefer(referer, redirectUrl)) {

throw GlobalException.PARAM_VERIFY_EXCEPTION;

}

wxMpService.switchoverTo(appMaps.get(0).getThirdAppId());

if("bind".equals(userAction)){

String url = wxMpService.getOAuth2Service()

.buildAuthorizationUrl(appMaps.get(0).getLoginRedirectUrl(),"snsapi_userinfo", URLEncoder.encode("bind_wechat", "UTF-8"));

return new Response(url);

}else{

String url = wxMpService.buildQrConnectUrl(appMaps.get(0).getLoginRedirectUrl(), "snsapi_login", MD5Utils.getRandomCode());

return new Response(url);

}

}


为什么生成的链接提示需要在手机上打开?我需要让用户扫描生成的二维码。这是生成的链接:

https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx52de1d519638b502&redirect_uri=https%3A%2F%2Fcv.poemhub.top%2Fpost%2Fwechat%2Flogin%2FalipayCallBack&response_type=code&scope=snsapi_userinfo&state=bind_wechat&connect_redirect=1#wechat_redirect







回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容