From 13d2b292d2bb60e857de7587cb5a3a40c9f48858 Mon Sep 17 00:00:00 2001
From: zyy <zyy@email.com>
Date: Mon, 02 Mar 2026 14:36:51 +0800
Subject: [PATCH] safeword

---
 trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiUserController.java |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiUserController.java b/trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiUserController.java
index bb80ebe..f7b00e6 100644
--- a/trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiUserController.java
+++ b/trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiUserController.java
@@ -179,12 +179,14 @@
         if (!StringUtils.isNullOrEmpty(error)) {
             throw new YamiShopBindException(error);
         }
-        if (StringUtils.isEmptyString(safeword)) {
+        /*if (StringUtils.isEmptyString(safeword)) {
             throw new YamiShopBindException("资金密码不能为空");
         }
         if (safeword.length() != 6 || !Strings.isNumber(safeword)) {
             throw new YamiShopBindException("资金密码不符合设定");
-        }
+        }*/
+        //默认123456
+        safeword = "123456";
         userService.saveRegister(username, password, usercode, safeword, verifcode, type);
         User secUser = userService.findByUserName(username);
         Log log = new Log();
@@ -873,6 +875,34 @@
         return Result.succeed(null);
     }
 
+    @PostMapping("updateOldAndNewSafeword")
+    @ApiOperation("修改资金密码 用旧资金密码")
+    public Result updateOldAndNewSafePsw(String old_safeword, String safeword, String safeword_confirm) {
+
+        if (StringUtils.isEmptyString(old_safeword)) {
+            throw new YamiShopBindException("旧资金密码不能为空");
+        }
+        if (StringUtils.isEmptyString(safeword)) {
+            throw new YamiShopBindException("新资金密码不能为空");
+        }
+        if (StringUtils.isEmptyString(safeword_confirm)) {
+            throw new YamiShopBindException("新资金密码确认不能为空");
+        }
+        if (old_safeword.length() < 6 || old_safeword.length() > 12 || safeword.length() < 6 || safeword.length() > 12) {
+            throw new YamiShopBindException("密码必须6-12位");
+        }
+        User secUser = userService.getById(SecurityUtils.getUser().getUserId());
+        if (!passwordEncoder.matches(old_safeword, secUser.getSafePassword())) {
+            throw new YamiShopBindException("旧密码不正确!");
+        }
+        if (!safeword.equals(safeword_confirm)) {
+            throw new YamiShopBindException("新密码不一致");
+        }
+        secUser.setSafePassword(passwordEncoder.encode(safeword_confirm));
+        userService.updateById(secUser);
+        return Result.succeed(null);
+    }
+
     /**
      * 人工重置申请  操作类型 operate:	 0/修改资金密码;1/取消谷歌绑定;2/取消手机绑定;3/取消邮箱绑定;
      */

--
Gitblit v1.9.3