From cb2f856ec75b1c468a012a5ce95770d770992d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Fri, 24 Jul 2026 18:31:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(system):=20=E4=BF=AE=E5=A4=8D=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=AF=86=E7=A0=81=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=8F=8A=E9=98=B2=E6=AD=A2=E7=A9=BA=E6=9B=B4=E6=96=B0=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 支付密码使用加密后存储,避免明文入库 - 仅当支付密码非空时才更新密码字段,避免清空原有密码 - 增加更新字段检测,防止无字段更新时报错 - 确保返回当前用户信息时包含支付密码字段状态 --- .../common/system/controller/MainController.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gxwebsoft/common/system/controller/MainController.java b/src/main/java/com/gxwebsoft/common/system/controller/MainController.java index e1f4311..f41a7a5 100644 --- a/src/main/java/com/gxwebsoft/common/system/controller/MainController.java +++ b/src/main/java/com/gxwebsoft/common/system/controller/MainController.java @@ -447,6 +447,12 @@ public class MainController extends BaseController { update.setAddress(user.getAddress()); update.setIntroduction(user.getIntroduction()); + // 支付密码变更(个人中心设置/修改支付密码时透传明文):加密后落库,不允许明文入库 + // 注意:仅当本次提交携带非空 payPassword 才更新,避免清空已有密码 + if (StrUtil.isNotBlank(user.getPayPassword())) { + update.setPayPassword(userService.encodePassword(user.getPayPassword())); + } + // MyBatis-Plus: 如果没有任何可更新字段,会生成 `UPDATE ... WHERE ...`(没有 SET)导致 SQL 报错 // 这里检测一下“确实有字段需要更新”,否则直接返回当前用户信息。 if (ObjectUtil.isAllEmpty( @@ -460,7 +466,8 @@ public class MainController extends BaseController { update.getCity(), update.getRegion(), update.getAddress(), - update.getIntroduction() + update.getIntroduction(), + update.getPayPassword() )) { return success("没有需要更新的字段", userService.getByIdRel(update.getUserId())); }