|
|
@@ -34,11 +34,11 @@ import com.cyksj.model.response.WxGzhQrCodeTicketRep;
|
|
|
import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.authorization.AuthorizationService;
|
|
|
import com.cyksj.service.distribute.DistributeService;
|
|
|
-import com.cyksj.service.distribute.equipment.EquipmentDistributeService;
|
|
|
+import com.cyksj.service.mail.MailService;
|
|
|
import com.cyksj.service.template.TemplateCommonService;
|
|
|
+import com.cyksj.service.user.UserHexService;
|
|
|
import com.cyksj.service.user.UserService;
|
|
|
import com.cyksj.service.wechat.WeChatService;
|
|
|
-import com.cyksj.service.mail.MailService;
|
|
|
import com.cyksj.web.util.StpUserUtil;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -91,11 +91,10 @@ public class AuthorizationController {
|
|
|
|
|
|
private final DistributeService distributeService;
|
|
|
|
|
|
- private final EquipmentDistributeService equipDistributeService;
|
|
|
+ private final UserHexService userHexService;
|
|
|
|
|
|
@GetMapping(value = "/weChat")
|
|
|
- public void base(String url, Long sharedId, String sCode, Integer dsType, Long popularizeId, String authType, HttpServletResponse response) throws Exception {
|
|
|
-
|
|
|
+ public void base(String url, Long sharedId, String sid, Integer dsType, Long popularizeId, String authType, HttpServletResponse response) throws Exception {
|
|
|
log.info("微信授权转跳. url: {},authType:{}",url,authType);
|
|
|
|
|
|
// 无论是否为老用户 均转跳到授权页面
|
|
|
@@ -104,7 +103,7 @@ public class AuthorizationController {
|
|
|
|
|
|
Long mappingId = SEQUENCE.nextId();
|
|
|
redisService.set(mappingId.toString(),url,60*60*24L);
|
|
|
- AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId).setSharedId(sharedId).setSCode(sCode).setDsType(dsType).setPid(popularizeId);
|
|
|
+ AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId).setSharedId(sharedId).setSid(sid).setDsType(dsType).setPid(popularizeId);
|
|
|
String state = Codec.DoBase64.custom().setData(Jsons.toJson(redirect)).encodeAsText();
|
|
|
|
|
|
response.sendRedirect(authorizationService.createUrl(state,authType));
|
|
|
@@ -130,7 +129,7 @@ public class AuthorizationController {
|
|
|
GzhOAuth2UserInfo userinfo = weChatService.getUserInfo(token.getAccessToken(), token.getOpenid());
|
|
|
|
|
|
//保存用户信息
|
|
|
- User user = userService.saveAuth(userinfo, re.getSharedId(), re.getSCode(), re.getDsType(), re.getPid());
|
|
|
+ User user = userService.saveAuth(userinfo, re.getSharedId(), re.getSid(), re.getDsType(), re.getPid());
|
|
|
if (user == null) {
|
|
|
throw BusinessRuntimeException.getInstance("系统错误,请重新授权");
|
|
|
}
|
|
|
@@ -253,9 +252,9 @@ public class AuthorizationController {
|
|
|
* 网页扫描微信公众号二维码 临时凭证ticket 关注后登录
|
|
|
*/
|
|
|
@GetMapping("/wx/gzh/login/qrCode")
|
|
|
- public Result<WxGzhQrCodeTicketRep> getWxGzhQrCode(Long sharedId, String sCode, Integer dsType, Long popularizeId) throws Exception {
|
|
|
+ public Result<WxGzhQrCodeTicketRep> getWxGzhQrCode(Long sharedId, String sid, Integer dsType, Long popularizeId) throws Exception {
|
|
|
//获取gzh带参数的二维码
|
|
|
- WxGzhQrCodeTicketRep result = weChatService.getWxGzhQrCode(sharedId, sCode, dsType, popularizeId);
|
|
|
+ WxGzhQrCodeTicketRep result = weChatService.getWxGzhQrCode(sharedId, sid, dsType, popularizeId);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(result);
|
|
|
}
|
|
|
|
|
|
@@ -406,9 +405,8 @@ 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;
|
|
|
- }
|
|
|
+ String sid = loginPhoneReq.getSid();
|
|
|
+ sharedId = userHexService.handleUserPopularizeId(sharedId, sid);
|
|
|
//新用户分销
|
|
|
if (sharedId != null) {
|
|
|
distributeService.saveDistributionInvitation(sharedId, user.getId());
|