From 689ad881b1ac1d9cf24dcecce1bad260af676368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Tue, 24 Sep 2024 13:48:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=BE=AE=E4=BF=A1=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=92=8C=E6=94=AF=E4=BB=98=E5=AE=9D=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=99=BB=E5=BD=95=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/cashierservice/alipayUtil/AlipayUtil.java | 2 +- .../system/cashierservice/controller/LoginContoller.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/alipayUtil/AlipayUtil.java b/src/main/java/com/chaozhanggui/system/cashierservice/alipayUtil/AlipayUtil.java index 2ede67d..2a22de2 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/alipayUtil/AlipayUtil.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/alipayUtil/AlipayUtil.java @@ -66,7 +66,7 @@ public class AlipayUtil { * @param code 用户信息授权码 * @return openId */ - public String getOpenId(String code) throws AlipayApiException{ + public String getOpenId(String code) throws Exception{ AlipaySystemOauthTokenRequest req = new AlipaySystemOauthTokenRequest(); //SDK已经封装掉了公共参数,这里只需要传入业务参数 req.setCode(code); diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/LoginContoller.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/LoginContoller.java index 0d08fc5..b0eee31 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/controller/LoginContoller.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/LoginContoller.java @@ -118,15 +118,18 @@ public class LoginContoller { return loginService.wxCustomLogin(openid, "", "", "", IpUtil.getIpAddr(request)); } catch (Exception e) { e.printStackTrace(); + log.error("登录失败:",e); } }else if(AuthSource.ALIPAY.getValue().equals(source)){ try { String openId = alipayUtil.getOpenId(code); return loginService.alipayCustomLogin(openId); }catch (AlipayApiException e){ + log.error("登录失败:",e); return Result.fail("登录失败:"+e.getErrMsg()); }catch (Exception e){ e.printStackTrace(); + log.error("登录失败:",e); } } return Result.fail("登录失败");