|
|
@@ -94,7 +94,7 @@ public class AuthorizationController {
|
|
|
private final EquipmentDistributeService equipDistributeService;
|
|
|
|
|
|
@GetMapping(value = "/weChat")
|
|
|
- public void base(String url, Long sharedId, Integer dsType, Long popularizeId, String authType, HttpServletResponse response) throws Exception {
|
|
|
+ public void base(String url, Long sharedId, String sCode, Integer dsType, Long popularizeId, String authType, HttpServletResponse response) throws Exception {
|
|
|
|
|
|
log.info("微信授权转跳. url: {},authType:{}",url,authType);
|
|
|
|
|
|
@@ -104,7 +104,7 @@ public class AuthorizationController {
|
|
|
|
|
|
Long mappingId = SEQUENCE.nextId();
|
|
|
redisService.set(mappingId.toString(),url,60*60*24L);
|
|
|
- AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId).setSharedId(sharedId).setDsType(dsType).setPid(popularizeId);
|
|
|
+ AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId).setSharedId(sharedId).setSCode(sCode).setDsType(dsType).setPid(popularizeId);
|
|
|
String state = Codec.DoBase64.custom().setData(Jsons.toJson(redirect)).encodeAsText();
|
|
|
|
|
|
response.sendRedirect(authorizationService.createUrl(state,authType));
|
|
|
@@ -130,7 +130,7 @@ public class AuthorizationController {
|
|
|
GzhOAuth2UserInfo userinfo = weChatService.getUserInfo(token.getAccessToken(), token.getOpenid());
|
|
|
|
|
|
//保存用户信息
|
|
|
- User user = userService.saveAuth(userinfo, re.getSharedId(), re.getDsType(), re.getPid());
|
|
|
+ User user = userService.saveAuth(userinfo, re.getSharedId(), re.getSCode(), re.getDsType(), re.getPid());
|
|
|
if (user == null) {
|
|
|
throw BusinessRuntimeException.getInstance("系统错误,请重新授权");
|
|
|
}
|
|
|
@@ -253,9 +253,9 @@ public class AuthorizationController {
|
|
|
* 网页扫描微信公众号二维码 临时凭证ticket 关注后登录
|
|
|
*/
|
|
|
@GetMapping("/wx/gzh/login/qrCode")
|
|
|
- public Result<WxGzhQrCodeTicketRep> getWxGzhQrCode(Long sharedId, Integer dsType, Long popularizeId) throws Exception {
|
|
|
+ public Result<WxGzhQrCodeTicketRep> getWxGzhQrCode(Long sharedId, String sCode, Integer dsType, Long popularizeId) throws Exception {
|
|
|
//获取gzh带参数的二维码
|
|
|
- WxGzhQrCodeTicketRep result = weChatService.getWxGzhQrCode(sharedId, dsType, popularizeId);
|
|
|
+ WxGzhQrCodeTicketRep result = weChatService.getWxGzhQrCode(sharedId, sCode, dsType, popularizeId);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(result);
|
|
|
}
|
|
|
|
|
|
@@ -406,6 +406,9 @@ public class AuthorizationController {
|
|
|
//默认头像
|
|
|
user.setHeadimgurl(Constant.DEFAULT_HEAD_IMG);
|
|
|
userService.save(user);
|
|
|
+ if (sharedId == null && StrUtil.isNotBlank(loginPhoneReq.getSCode())) {
|
|
|
+ sharedId = Long.parseLong(loginPhoneReq.getSCode(), 16) - Constant.HEX_NUMBER;
|
|
|
+ }
|
|
|
//新用户分销
|
|
|
if (sharedId != null) {
|
|
|
distributeService.saveDistributionInvitation(sharedId, user.getId());
|