From 4f4ae78168655d3c2c8e54d4c17aff9fad66f634 Mon Sep 17 00:00:00 2001 From: zhangli <123879394@qq.com> Date: Sat, 12 Jul 2025 23:58:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/sczx/user/service/impl/UserServiceImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/sczx/user/service/impl/UserServiceImpl.java b/src/main/java/com/sczx/user/service/impl/UserServiceImpl.java index b8d6ef7..f48af25 100644 --- a/src/main/java/com/sczx/user/service/impl/UserServiceImpl.java +++ b/src/main/java/com/sczx/user/service/impl/UserServiceImpl.java @@ -1,5 +1,6 @@ package com.sczx.user.service.impl; +import com.sczx.user.exception.BizException; import com.sczx.user.model.LoginRequest; import com.sczx.user.service.IUserService; import com.sczx.user.util.JwtUtil; @@ -76,7 +77,7 @@ public class UserServiceImpl implements IUserService { public String miniProgramLogin(String code) { String openid = WECHAT_CODE_TO_OPENID.get(code); if (openid == null) { - throw new RuntimeException("无效的微信登录code"); + throw new BizException("无效的微信登录code"); } // 存入 Redis return jwtUtil.generateToken(openid, "USER"); @@ -86,7 +87,7 @@ public class UserServiceImpl implements IUserService { public String miniProgramRegister(String code, String username, String password) { String openid = WECHAT_CODE_TO_OPENID.get(code); if (openid == null) { - throw new RuntimeException("无效的微信登录code"); + throw new BizException("无效的微信登录code"); } // 模拟注册逻辑 // userRepository.save(new User(openid, username, password)); @@ -97,7 +98,7 @@ public class UserServiceImpl implements IUserService { public String alipayMiniProgramLogin(String userId) { String realUserId = ALIPAY_ID_TO_USERID.get(userId); if (realUserId == null) { - throw new RuntimeException("无效的支付宝用户ID"); + throw new BizException("无效的支付宝用户ID"); } return jwtUtil.generateToken(realUserId, "USER"); } @@ -106,7 +107,7 @@ public class UserServiceImpl implements IUserService { public String alipayMiniProgramRegister(String userId, String username, String password) { String realUserId = ALIPAY_ID_TO_USERID.get(userId); if (realUserId == null) { - throw new RuntimeException("无效的支付宝用户ID"); + throw new BizException("无效的支付宝用户ID"); } // 模拟注册逻辑 // userRepository.save(new User(realUserId, username, password));