|
|
@@ -99,7 +99,7 @@ public class CpsBackLoginController {
|
|
|
* cps后台微信授权登录
|
|
|
*/
|
|
|
@GetMapping("/wx/authLogin")
|
|
|
- public Result<CpsAuthDto> wxAuthorize() throws Exception {
|
|
|
+ public Result<CpsAuthDto> wxAuthorize(String redirectUrl) throws Exception {
|
|
|
Object authUrlObj = redisService.get(RedisService.key.WX_LOGIN_AUTH_URI.getNameFormat("cps", wxOpenPlatYHLXLoginConfig.getAppId()));
|
|
|
if (authUrlObj != null) {
|
|
|
CpsAuthDto cpsAuthDto = Jsons.parseObject(authUrlObj.toString(), CpsAuthDto.class);
|
|
|
@@ -110,6 +110,7 @@ public class CpsBackLoginController {
|
|
|
String authState = mappingId.toString();
|
|
|
redisService.set(authState, authState, 60 * 60 * 24L);
|
|
|
AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId);
|
|
|
+ redirect.setUrl(redirectUrl);
|
|
|
String state = Codec.DoBase64.custom().setData(Jsons.toJson(redirect)).encodeAsText();
|
|
|
String wxAuthUrl = authorizationService.createWxAuthLoginUrl(state, wxOpenPlatYHLXLoginConfig.getAppId(), wxOpenPlatYHLXLoginConfig.getCpsRedirectUri());
|
|
|
cpsAuthDto.setAuthUrl(wxAuthUrl);
|
|
|
@@ -140,9 +141,14 @@ public class CpsBackLoginController {
|
|
|
if (user == null) throw BusinessRuntimeException.getInstance("用户信息不存在");
|
|
|
UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class).eq(UserDistribute::getUserId, user.getId()).eq(UserDistribute::getDeleted, 1).select(UserDistribute::getId).last("limit 1"));
|
|
|
if (userDistribute == null) throw BusinessRuntimeException.getInstance("只支持渠道分销用户登录");
|
|
|
- JSONObject res = new JSONObject();
|
|
|
StpCpsManageUser.login(user.getId());
|
|
|
String cpsToken = StpCpsManageUser.getTokenValue();
|
|
|
+ String url = re.getUrl();
|
|
|
+ if (StrUtil.isNotBlank(url)) {
|
|
|
+ response.sendRedirect(url.contains("?") ? url + "&t=" + cpsToken : url + "?t=" + cpsToken);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ JSONObject res = new JSONObject();
|
|
|
res.putOpt("satoken-cpsUser", cpsToken);
|
|
|
res.putOpt("img", user.getHeadimgurl());
|
|
|
res.putOpt("nickname", user.getNickname());
|