|
@@ -81,9 +81,6 @@ public class SysLoginController
|
|
|
@Value("${gzh.appSecret}")
|
|
|
private String gzhAppSecret;
|
|
|
|
|
|
- private String appid;
|
|
|
-
|
|
|
- private String appSecret;
|
|
|
|
|
|
@Value("${xcx.appId}")
|
|
|
private String xcxAppid;
|
|
@@ -129,35 +126,6 @@ public class SysLoginController
|
|
|
return Response.success(tokenDTO);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- */
|
|
|
- @PostMapping("/login/code")
|
|
|
- @ApiOperation("app微信用户授权码模式登录")
|
|
|
- public Response<TokenDTO> loginByWxAuthorizationCode(String authorizationCode ){
|
|
|
- String wxResultStr = wxService.getWxToken(appid, appSecret, authorizationCode, "authorization_code");
|
|
|
- logger.info("微信授权码登录返回值:"+wxResultStr);
|
|
|
- WxResult wxResult = JSONObject.parseObject(wxResultStr,WxResult.class);
|
|
|
-
|
|
|
- // 生成令牌
|
|
|
- if (wxResult.getErrcode() != null){
|
|
|
- throw new CustomException("微信授权无效,请重新授权");
|
|
|
- }
|
|
|
-
|
|
|
- String userInfoStr = wxService.getUserInfo("zh_CN", wxResult.getAccess_token(), wxResult.getOpenid());
|
|
|
- WxUserInfo wxUserInfo = JSONObject.parseObject(userInfoStr,WxUserInfo.class);
|
|
|
- ServletUtils.getRequest().setAttribute("headImage",wxUserInfo.getHeadimgurl());
|
|
|
- ServletUtils.getRequest().setAttribute("nickName",wxUserInfo.getNickname());
|
|
|
- ServletUtils.getRequest().setAttribute("openid",wxUserInfo.getOpenid());
|
|
|
- String token = loginService.login(wxUserInfo.getUnionid(),null, StudentLoginTypeEnum.AUTHORIZATION_CODE_LOGIN.getCode());
|
|
|
- TokenDTO tokenDTO = new TokenDTO();
|
|
|
- tokenDTO.setToken(token);
|
|
|
- tokenDTO.setThirdResult(wxUserInfo);
|
|
|
- return Response.success(tokenDTO) ;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 用户 openid登录
|