From b52ecd08ce2c34f500ec414703dfea89a4f5cf3f Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Fri, 26 Jul 2024 10:36:18 +0800
Subject: [PATCH] 1

---
 src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
index 5ddcdfc..e96899c 100644
--- a/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
+++ b/src/main/java/com/nq/service/impl/UserWithdrawServiceImpl.java
@@ -148,6 +148,7 @@
             userWithdraw.setWithStatus(Integer.valueOf(0));
             BigDecimal withfee = siteSetting.getWithFeePercent().multiply(new BigDecimal(amt)).add(new BigDecimal(siteSetting.getWithFeeSingle().intValue()));
             userWithdraw.setWithFee(withfee);
+            userWithdraw.setAssetsType(accsetType);
             int insertCount = this.userWithdrawMapper.insert(userWithdraw);
             if (insertCount > 0) {
                 return ServerResponse.createBySuccessMsg("提现成功",request);
@@ -221,7 +222,12 @@
             User user = this.userMapper.selectById(userWithdraw.getUserId());
 
 
-            int updateUserCount = this.userMapper.updateById(user);
+            UserAssets userAssets = iUserAssetsServices.assetsByTypeAndUserId("JP", user.getId());
+            if (userAssets == null) {
+                return ServerResponse.createByErrorMsg("用户资金账户不存在");
+            }
+            userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(userWithdraw.getWithAmt()));
+            int updateUserCount = userAssetsMapper.updateById(userAssets);
 
             if (updateUserCount > 0) {
 
@@ -329,7 +335,7 @@
             if (user == null) {
                 return ServerResponse.createByErrorMsg("用户不存在");
             }
-            UserAssets userAssets = iUserAssetsServices.assetsByTypeAndUserId("IN", user.getId());
+            UserAssets userAssets = iUserAssetsServices.assetsByTypeAndUserId("JP", user.getId());
             if (userAssets == null) {
                 return ServerResponse.createByErrorMsg("用户资金账户不存在");
             }

--
Gitblit v1.9.3