|
|
@@ -18,6 +18,7 @@ import com.ytpm.arithmetic.service.AppUserService;
|
|
|
import com.ytpm.feign.RiskFeign;
|
|
|
import com.ytpm.general.RepMessage;
|
|
|
import com.ytpm.general.Result;
|
|
|
+import com.ytpm.general.StatusCode;
|
|
|
import com.ytpm.handle.CustomerException;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
@@ -58,16 +59,16 @@ public class WxController {
|
|
|
//根据应用获取配置调用微信接口登录
|
|
|
WxDefaultConfig defaultConfig = appUserMapper.getDefaultConfig(param.getAppType());
|
|
|
if(Objects.isNull(defaultConfig)){
|
|
|
- throw new CustomerException("微信登录失败,未找到相应配置!");
|
|
|
+ return new Result<>(StatusCode.ACCESS_ERR,"微信登录失败,未找到相应配置!");
|
|
|
}
|
|
|
param.setAppId(defaultConfig.getPlatformAppId());
|
|
|
WxLoginResult loginResult = getWechatLoginInfo(param.getWxCode(),param.getAppType(),defaultConfig.getAppId(),defaultConfig.getSecret());
|
|
|
if(Objects.isNull(loginResult)|| StrUtil.isBlank(loginResult.getOpenid())){
|
|
|
- throw new CustomerException("微信登录失败,请刷新授权码!");
|
|
|
+ return new Result<>(StatusCode.ACCESS_ERR,"微信登录失败,请刷新授权码!");
|
|
|
}
|
|
|
WxUserInfo wxUserInfo = getWechatUserInfo(loginResult.getAccess_token(),loginResult.getOpenid());
|
|
|
if(Objects.isNull(wxUserInfo)) {
|
|
|
- throw new CustomerException("微信用户登录失败");
|
|
|
+ return new Result<>(StatusCode.ACCESS_ERR,"微信用户登录失败");
|
|
|
}
|
|
|
param.setLoginIp(getClientIp(request));
|
|
|
YtDyzUser old = appUserService.crudForNewTrans(param,wxUserInfo,loginResult);
|
|
|
@@ -75,7 +76,7 @@ public class WxController {
|
|
|
old.setRiskCode("313");
|
|
|
Result<?> result = riskFeign.checkRisk(old);
|
|
|
if(result.getCode()!=200){
|
|
|
- throw new CustomerException(result.getMessage());
|
|
|
+ return new Result<>(StatusCode.ACCESS_ERR,result.getMessage());
|
|
|
}
|
|
|
return Result.resultOk(RepMessage.LOGIN_SUCCESS, old);
|
|
|
}
|