Merge branch 'tkk' into test
This commit is contained in:
@@ -66,7 +66,7 @@ public class AlipayUtil {
|
|||||||
* @param code 用户信息授权码
|
* @param code 用户信息授权码
|
||||||
* @return openId
|
* @return openId
|
||||||
*/
|
*/
|
||||||
public String getOpenId(String code) throws AlipayApiException{
|
public String getOpenId(String code) throws Exception{
|
||||||
AlipaySystemOauthTokenRequest req = new AlipaySystemOauthTokenRequest();
|
AlipaySystemOauthTokenRequest req = new AlipaySystemOauthTokenRequest();
|
||||||
//SDK已经封装掉了公共参数,这里只需要传入业务参数
|
//SDK已经封装掉了公共参数,这里只需要传入业务参数
|
||||||
req.setCode(code);
|
req.setCode(code);
|
||||||
|
|||||||
@@ -118,15 +118,18 @@ public class LoginContoller {
|
|||||||
return loginService.wxCustomLogin(openid, "", "", "", IpUtil.getIpAddr(request));
|
return loginService.wxCustomLogin(openid, "", "", "", IpUtil.getIpAddr(request));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
log.error("登录失败:",e);
|
||||||
}
|
}
|
||||||
}else if(AuthSource.ALIPAY.getValue().equals(source)){
|
}else if(AuthSource.ALIPAY.getValue().equals(source)){
|
||||||
try {
|
try {
|
||||||
String openId = alipayUtil.getOpenId(code);
|
String openId = alipayUtil.getOpenId(code);
|
||||||
return loginService.alipayCustomLogin(openId);
|
return loginService.alipayCustomLogin(openId);
|
||||||
}catch (AlipayApiException e){
|
}catch (AlipayApiException e){
|
||||||
|
log.error("登录失败:",e);
|
||||||
return Result.fail("登录失败:"+e.getErrMsg());
|
return Result.fail("登录失败:"+e.getErrMsg());
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
log.error("登录失败:",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Result.fail("登录失败");
|
return Result.fail("登录失败");
|
||||||
|
|||||||
Reference in New Issue
Block a user