From 19be3926c88d19645f43dd926d00615225f30802 Mon Sep 17 00:00:00 2001
From: peter <14100000001@qq.com>
Date: Fri, 11 Jul 2025 17:36:46 +0800
Subject: [PATCH] 外汇接口调整
---
trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiUserController.java | 92 +++++++++++++++++++++++++---------------------
1 files changed, 50 insertions(+), 42 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 44c0e0f..2012654 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
@@ -767,7 +767,7 @@
*/
@PostMapping("setSafeword")
@ApiOperation("修改资金密码 用验证码")
- public Result setSafeword(String safeword, String verifcode_type, String verifcode) {
+ public Result setSafeword(String safeword, String verifcode_type, String verifcode, String odl_safeword) {
if (StringUtils.isEmptyString(safeword)) {
throw new YamiShopBindException("资金密码不能为空");
@@ -778,54 +778,62 @@
if (StringUtils.isEmptyString(verifcode_type)) {
throw new YamiShopBindException("验证类型不能为空");
}
- if (StringUtils.isEmptyString(verifcode)) {
- throw new YamiShopBindException("验证码不能为空");
+ if (StringUtils.isEmptyString(odl_safeword)) {
+ throw new YamiShopBindException("旧密码不能为空");
}
+// if (StringUtils.isEmptyString(verifcode)) {
+// throw new YamiShopBindException("验证码不能为空");
+// }
String loginPartyId = SecurityUtils.getUser().getUserId();
User party = userService.getById(loginPartyId);
// 根据验证类型获取验证key verifcode_type: 1/手机;2/邮箱;3/谷歌验证器;
- String key = "";
- String errMsg = "";
- if ("1".equals(verifcode_type)) {
- key = StringUtils.isEmptyString(party.getUserMobile()) || false == party.isUserMobileBind() ? "" : party.getUserMobile();
- errMsg = "未绑定手机号";
- } else if ("2".equals(verifcode_type)) {
- key = StringUtils.isEmptyString(party.getUserMail()) || false == party.isMailBind() ? "" : party.getUserMail();
- errMsg = "未绑定邮箱";
- } else if ("3".equals(verifcode_type)) {
- key = StringUtils.isEmptyString(party.getGoogleAuthSecret()) || false == party.isGoogleAuthBind() ? "" : party.getGoogleAuthSecret();
- errMsg = "未绑定谷歌验证器";
- }
- if (StringUtils.isEmptyString(key)) {
- throw new YamiShopBindException(errMsg);
- }
+// String key = "";
+// String errMsg = "";
+// if ("1".equals(verifcode_type)) {
+// key = StringUtils.isEmptyString(party.getUserMobile()) || false == party.isUserMobileBind() ? "" : party.getUserMobile();
+// errMsg = "未绑定手机号";
+// } else if ("2".equals(verifcode_type)) {
+// key = StringUtils.isEmptyString(party.getUserMail()) || false == party.isMailBind() ? "" : party.getUserMail();
+// errMsg = "未绑定邮箱";
+// } else if ("3".equals(verifcode_type)) {
+// key = StringUtils.isEmptyString(party.getGoogleAuthSecret()) || false == party.isGoogleAuthBind() ? "" : party.getGoogleAuthSecret();
+// errMsg = "未绑定谷歌验证器";
+// }
+// if (StringUtils.isEmptyString(key)) {
+// throw new YamiShopBindException(errMsg);
+// }
// 验证
- boolean passed = false;
- if ("1".equals(verifcode_type) || "2".equals(verifcode_type)) {
- String authcode = this.identifyingCodeTimeWindowService.getAuthCode(key);
- if ((null != authcode) && (authcode.equals(verifcode))) {
- passed = true;
- this.identifyingCodeTimeWindowService.delAuthCode(key);
- }
- } else if ("3".equals(verifcode_type)) {
- long t = System.currentTimeMillis();
- GoogleAuthenticator ga = new GoogleAuthenticator();
- ga.setWindowSize(5);
- boolean flag = ga.check_code(party.getGoogleAuthSecret(), Long.valueOf(verifcode), t);
- if (flag) {
- passed = true;
- }
- }
+// boolean passed = false;
+// if ("1".equals(verifcode_type) || "2".equals(verifcode_type)) {
+// String authcode = this.identifyingCodeTimeWindowService.getAuthCode(key);
+// if ((null != authcode) && (authcode.equals(verifcode))) {
+// passed = true;
+// this.identifyingCodeTimeWindowService.delAuthCode(key);
+// }
+// } else if ("3".equals(verifcode_type)) {
+// long t = System.currentTimeMillis();
+// GoogleAuthenticator ga = new GoogleAuthenticator();
+// ga.setWindowSize(5);
+// boolean flag = ga.check_code(party.getGoogleAuthSecret(), Long.valueOf(verifcode), t);
+// if (flag) {
+// passed = true;
+// }
+// }
// 如果是演示用户,则不判断验证码
- if (!"GUEST".contentEquals(party.getRoleName())) {
- if (!passed) {
- throw new YamiShopBindException("验证码不正确");
- }
+// if (!"GUEST".contentEquals(party.getRoleName())) {
+// if (!passed) {
+// throw new YamiShopBindException("验证码不正确");
+// }
+// }
+ if(userService.checkLoginSafeword(party.getUserId(), odl_safeword)){
+ party.setSafePassword(passwordEncoder.encode(safeword));
+ // 更新密码
+ userService.updateById(party);
+ return Result.succeed(null);
+ }else {
+ throw new YamiShopBindException("旧密码不正确");
}
- party.setSafePassword(passwordEncoder.encode(safeword));
- // 更新密码
- userService.updateById(party);
- return Result.succeed(null);
+
}
/**
--
Gitblit v1.9.3