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())); }