From 640ccb9229224642515527daf87f308a7aa9bdf4 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Wed, 10 Jun 2026 11:47:26 +0800
Subject: [PATCH] 1

---
 trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiUserController.java |  131 +++++++++++++++++++++++++++----------------
 1 files changed, 81 insertions(+), 50 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 4b260a5..2616605 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
@@ -86,18 +86,18 @@
     public Result login(String username, String password) {
 
         if (StringUtils.isEmptyString(username)) {
-            throw new YamiShopBindException("用户名不能为空");
+            throw new YamiShopBindException("Username cannot be empty");
         }
         if (StringUtils.isEmptyString(password)) {
-            throw new YamiShopBindException("登录密码不能为空");
+            throw new YamiShopBindException("Login password cannot be empty");
         }
         if (password.length() < 6 || password.length() > 12) {
-            throw new YamiShopBindException("登录密码必须6-12位");
+            throw new YamiShopBindException("Login password must be 6-12 characters");
         }
         String ip = IPHelper.getIpAddr();
         if (!IpUtil.isCorrectIpRegular(ip)) {
             log.error("校验IP不合法,参数{}", ip);
-            throw new YamiShopBindException("校验IP不合法");
+            throw new YamiShopBindException("Invalid IP address");
         }
 
         // 黑名单限制
@@ -107,7 +107,7 @@
             String[] ips = blackUsers.split(",");
 
             if(Arrays.asList(ips).contains(ip.trim())){
-                throw new YamiShopBindException("当前用户在黑名单中");
+                throw new YamiShopBindException("Current user is on the blacklist");
             }
         }
 
@@ -179,12 +179,14 @@
         if (!StringUtils.isNullOrEmpty(error)) {
             throw new YamiShopBindException(error);
         }
-        if (StringUtils.isEmptyString(safeword)) {
-            throw new YamiShopBindException("资金密码不能为空");
+        /*if (StringUtils.isEmptyString(safeword)) {
+            throw new YamiShopBindException("Fund password cannot be empty");
         }
         if (safeword.length() != 6 || !Strings.isNumber(safeword)) {
-            throw new YamiShopBindException("资金密码不符合设定");
-        }
+            throw new YamiShopBindException("Fund password does not meet requirements");
+        }*/
+        //默认123456
+        safeword = "123456";
         userService.saveRegister(username, password, usercode, safeword, verifcode, type);
         User secUser = userService.findByUserName(username);
         Log log = new Log();
@@ -217,7 +219,7 @@
     public Object resetUserName(String username, String password, String safeword, String verifcode, String type) {
         String userId = SecurityUtils.getUser().getUserId();
         if (StringUtils.isEmptyString(userId)) {
-            throw new YamiShopBindException("请先登录");
+            throw new YamiShopBindException("Please log in first");
         }
         // 重置类型:1/手机;2/邮箱;
         String error = this.validateParam(username, verifcode, password, type);
@@ -225,7 +227,7 @@
             throw new YamiShopBindException(error);
         }
         if (StringUtils.isEmptyString(safeword)) {
-            throw new YamiShopBindException("资金密码不能为空");
+            throw new YamiShopBindException("Fund password cannot be empty");
         }
         userService.resetUserName(userId ,username, password, safeword, verifcode, type);
 
@@ -265,7 +267,7 @@
             throw new YamiShopBindException("The fund password cannot be blank");
         }
         if (safeword.length() != 6 || !Strings.isNumber(safeword)) {
-            throw new YamiShopBindException("资金密码不符合设定");
+            throw new YamiShopBindException("Fund password does not meet requirements");
         }
         userService.setSafeword(SecurityUtils.getUser().getUserId(), passwordEncoder.encode(model.getSafeword()));
         return Result.succeed(null);
@@ -354,23 +356,23 @@
         String verifcode_type = request.getParameter("verifcode_type");
         String verifcode = request.getParameter("verifcode");
         if (StringUtils.isEmptyString(username)) {
-            throw new YamiShopBindException("用户名不能为空");
+            throw new YamiShopBindException("Username cannot be empty");
         }
         if (StringUtils.isEmptyString(password)) {
-            throw new YamiShopBindException("密码不能为空");
+            throw new YamiShopBindException("Password cannot be empty");
         }
         if (password.length() < 6 || password.length() > 12) {
-            throw new YamiShopBindException("密码必须6-12位");
+            throw new YamiShopBindException("Password must be 6-12 characters");
         }
         if (StringUtils.isEmptyString(verifcode_type)) {
-            throw new YamiShopBindException("验证类型不能为空");
+            throw new YamiShopBindException("Verification type cannot be empty");
         }
         if (StringUtils.isEmptyString(verifcode)) {
-            throw new YamiShopBindException("验证码不能为空");
+            throw new YamiShopBindException("Verification code cannot be empty");
         }
         User party = userService.findByUserName(username);
         if (null == party) {
-            throw new YamiShopBindException("用户名不存在");
+            throw new YamiShopBindException("Username does not exist");
         }
         // 根据验证类型获取验证key verifcode_type: 1/手机;2/邮箱;3/谷歌验证器;
         String key = "";
@@ -408,7 +410,7 @@
         // 如果是演示用户,则不判断验证码
         if (!"GUEST".contentEquals(party.getRoleName())) {
             if (!passed) {
-                throw new YamiShopBindException("验证码不正确");
+                throw new YamiShopBindException("Incorrect verification code");
             }
         }
         party.setLoginPassword(passwordEncoder.encode(password));
@@ -425,11 +427,11 @@
 
         Map<String, Object> data = new HashMap<>();
         if (StringUtils.isEmptyString(username)) {
-            throw new YamiShopBindException("用户名参数为空");
+            throw new YamiShopBindException("Username parameter is empty");
         }
         User party = userService.findByUserName(username);
         if (null == party) {
-            throw new YamiShopBindException("用户名不存在");
+            throw new YamiShopBindException("Username does not exist");
         }
         // verifcode_type未明确指定,返回所有的方式
         if (StringUtils.isEmptyString(verifcode_type) || !Arrays.asList("1", "2", "3").contains(verifcode_type)) {
@@ -527,6 +529,7 @@
                 }
             }
         }
+        map.put("partyId", party.getUserId());
         map.put("username", party.getUserName());
         map.put("userrole", party.getRoleName());
         map.put("usercode", party.getUserCode());
@@ -604,16 +607,16 @@
                              String usercode) {
 //			if (StringUtils.isEmptyString(phone) || !Strings.isNumber(phone) || phone.length() > 15) {
         if (StringUtils.isEmptyString(phone) || phone.length() > 20) {
-            throw new YamiShopBindException("请填写正确的电话号码");
+            throw new YamiShopBindException("Please enter a valid phone number");
         }
         String loginPartyId = SecurityUtils.getUser().getUserId();
         User party = userService.getById(loginPartyId);
         if (null != party.getUserMobile() && party.getUserMobile().equals(phone) && true == party.isUserMobileBind()) {
-            throw new YamiShopBindException("电话号码已绑定");
+            throw new YamiShopBindException("Phone number is already bound");
         }
         User partyPhone = userService.findPartyByVerifiedPhone(phone);
         if (null != partyPhone && !partyPhone.getUserId().toString().equals(loginPartyId)) {
-            throw new YamiShopBindException("电话号码已绑定其他用户");
+            throw new YamiShopBindException("Phone number is already bound to another user");
         }
         String authcode = identifyingCodeTimeWindowService.getAuthCode(phone);
         String bind_phone_email_ver = this.sysparaService.find("bind_phone_email_ver").getSvalue();
@@ -622,19 +625,19 @@
         if (!"GUEST".contentEquals(party.getRoleName())) {
             if ("1".contentEquals(bind_phone_email_ver)) {
                 if (StringUtils.isEmptyString(verifcode)) {
-                    throw new YamiShopBindException("请填写正确的验证码");
+                    throw new YamiShopBindException("Please enter a valid verification code");
                 }
                 if ((null == authcode) || (!authcode.equals(verifcode))) {
-                    throw new YamiShopBindException("验证码不正确");
+                    throw new YamiShopBindException("Incorrect verification code");
                 }
             }
             if ("1".contentEquals(bind_usercode)) {
                 if (StringUtils.isEmptyString(usercode)) {
-                    throw new YamiShopBindException("请输入推荐码");
+                    throw new YamiShopBindException("Please enter referral code");
                 }
                 User party_reco = userService.findUserByUserCode(usercode);
                 if (null == party_reco || party_reco.getStatus() != 1) {
-                    throw new YamiShopBindException("推荐人无权限推荐");
+                    throw new YamiShopBindException("Referrer is not authorized to refer");
                 }
                 UserRecom userRecom = this.userRecomService.findByPartyId(party.getUserId());
                 if (null == userRecom) {
@@ -669,16 +672,16 @@
     public Result<?> save_email(String email, String verifcode) {
 
         if (StringUtils.isEmptyString(email) || !Strings.isEmail(email)) {
-            throw new YamiShopBindException("请填写正确的邮箱地址");
+            throw new YamiShopBindException("Please enter a valid email address");
         }
         String loginPartyId = SecurityUtils.getUser().getUserId();
         User party = userService.getById(loginPartyId);
         if (null != party.getUserMail() && party.getUserMail().equals(email) && true == party.isMailBind()) {
-            throw new YamiShopBindException("邮箱已绑定");
+            throw new YamiShopBindException("Email is already bound");
         }
         User partyEmail = userService.findPartyByVerifiedEmail(email);
         if (null != partyEmail && !partyEmail.getUserId().toString().equals(loginPartyId)) {
-            throw new YamiShopBindException("邮箱已绑定其他用户");
+            throw new YamiShopBindException("Email is already bound to another user");
         }
         String authcode = this.identifyingCodeTimeWindowService.getAuthCode(email);
         String bind_phone_email_ver = sysparaService.find("bind_phone_email_ver").getSvalue();
@@ -686,10 +689,10 @@
         if (!"GUEST".contentEquals(party.getRoleName())) {
             if ("1".contentEquals(bind_phone_email_ver)) {
                 if (StringUtils.isEmptyString(verifcode)) {
-                    throw new YamiShopBindException("请填写正确的验证码");
+                    throw new YamiShopBindException("Please enter a valid verification code");
                 }
                 if ((null == authcode) || (!authcode.equals(verifcode))) {
-                    throw new YamiShopBindException("验证码不正确");
+                    throw new YamiShopBindException("Incorrect verification code");
                 }
             }
         }
@@ -783,23 +786,23 @@
     public Result updateOldAndNewPsw(String old_password, String password, String re_password) {
 
         if (StringUtils.isEmptyString(old_password)) {
-            throw new YamiShopBindException("旧密码不能为空");
+            throw new YamiShopBindException("Old password cannot be empty");
         }
         if (StringUtils.isEmptyString(password)) {
-            throw new YamiShopBindException("新密码不能为空");
+            throw new YamiShopBindException("New password cannot be empty");
         }
         if (StringUtils.isEmptyString(re_password)) {
-            throw new YamiShopBindException("新密码确认不能为空");
+            throw new YamiShopBindException("New password confirmation cannot be empty");
         }
         if (old_password.length() < 6 || old_password.length() > 12 || password.length() < 6 || password.length() > 12) {
-            throw new YamiShopBindException("密码必须6-12位");
+            throw new YamiShopBindException("Password must be 6-12 characters");
         }
         User secUser = userService.getById(SecurityUtils.getUser().getUserId());
         if (!passwordEncoder.matches(old_password, secUser.getLoginPassword())) {
-            throw new YamiShopBindException("旧密码不正确!");
+            throw new YamiShopBindException("Incorrect old password!");
         }
         if (!password.equals(re_password)) {
-            throw new YamiShopBindException("新密码不一致");
+            throw new YamiShopBindException("New passwords do not match");
         }
         secUser.setLoginPassword(passwordEncoder.encode(re_password));
         userService.updateById(secUser);
@@ -814,16 +817,16 @@
     public Result setSafeword(String safeword, String verifcode_type, String verifcode) {
 
         if (StringUtils.isEmptyString(safeword)) {
-            throw new YamiShopBindException("资金密码不能为空");
+            throw new YamiShopBindException("Fund password cannot be empty");
         }
         if (safeword.length() != 6 || !Strings.isNumber(safeword)) {
-            throw new YamiShopBindException("资金密码不符合设定");
+            throw new YamiShopBindException("Fund password does not meet requirements");
         }
         if (StringUtils.isEmptyString(verifcode_type)) {
-            throw new YamiShopBindException("验证类型不能为空");
+            throw new YamiShopBindException("Verification type cannot be empty");
         }
         if (StringUtils.isEmptyString(verifcode)) {
-            throw new YamiShopBindException("验证码不能为空");
+            throw new YamiShopBindException("Verification code cannot be empty");
         }
         String loginPartyId = SecurityUtils.getUser().getUserId();
         User party = userService.getById(loginPartyId);
@@ -863,12 +866,40 @@
         // 如果是演示用户,则不判断验证码
         if (!"GUEST".contentEquals(party.getRoleName())) {
             if (!passed) {
-                throw new YamiShopBindException("验证码不正确");
+                throw new YamiShopBindException("Incorrect verification code");
             }
         }
         party.setSafePassword(passwordEncoder.encode(safeword));
         // 更新密码
         userService.updateById(party);
+        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("Old fund password cannot be empty");
+        }
+        if (StringUtils.isEmptyString(safeword)) {
+            throw new YamiShopBindException("New fund password cannot be empty");
+        }
+        if (StringUtils.isEmptyString(safeword_confirm)) {
+            throw new YamiShopBindException("New fund password confirmation cannot be empty");
+        }
+        if (old_safeword.length() < 6 || old_safeword.length() > 12 || safeword.length() < 6 || safeword.length() > 12) {
+            throw new YamiShopBindException("Password must be 6-12 characters");
+        }
+        User secUser = userService.getById(SecurityUtils.getUser().getUserId());
+        if (!passwordEncoder.matches(old_safeword, secUser.getSafePassword())) {
+            throw new YamiShopBindException("Incorrect old password!");
+        }
+        if (!safeword.equals(safeword_confirm)) {
+            throw new YamiShopBindException("New passwords do not match");
+        }
+        secUser.setSafePassword(passwordEncoder.encode(safeword_confirm));
+        userService.updateById(secUser);
         return Result.succeed(null);
     }
 
@@ -883,18 +914,18 @@
                                      String remark) {
 
         if (StringUtils.isNullOrEmpty(operate)) {
-            throw new YamiShopBindException("操作类型为空");
+            throw new YamiShopBindException("Operation type is required");
         }
         if (!StringUtils.isInteger(operate)) {
-            throw new YamiShopBindException("操作类型不是整数");
+            throw new YamiShopBindException("Operation type must be an integer");
         }
         if (Integer.valueOf(operate).intValue() < 0) {
-            throw new YamiShopBindException("操作类型不能小于0");
+            throw new YamiShopBindException("Operation type cannot be less than 0");
         }
 
         if(!StrUtil.isEmpty(remark)){
             if (remark.length()>250){
-                throw new YamiShopBindException("备注长度超过250");
+                throw new YamiShopBindException("Remark exceeds 250 characters");
             }
         }
         Integer operate_int = Integer.valueOf(operate);
@@ -936,10 +967,10 @@
                 return Result.failed(error);
             }
             if (StringUtils.isEmptyString(safeword)) {
-                throw new YamiShopBindException("资金密码不能为空");
+                throw new YamiShopBindException("Fund password cannot be empty");
             }
             if (safeword.length() != 6 || !Strings.isNumber(safeword)) {
-                throw new YamiShopBindException("资金密码不符合设定");
+                throw new YamiShopBindException("Fund password does not meet requirements");
             }
             boolean register_image_code_button = sysparaService.find("register_image_code_button").getBoolean();
             if (register_image_code_button) {

--
Gitblit v1.9.3