From 3c1a3bb702693a70487154c8804c648be8c29630 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 07 Jun 2023 18:08:16 +0800
Subject: [PATCH] twoCoin项目修改

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
index cb58f86..d952e34 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -636,6 +636,9 @@
 //            System.out.println(2);
 //        }
 //        getLocalAddress("0x2bBAD0d2362a8dbdc655fBa5A0cd51d5379e38f7");
+        BigDecimal amountIn = BigDecimal.valueOf(951);
+        BigDecimal result = amountIn.divide(BigDecimal.valueOf(100));
+        System.out.println(result.remainder(BigDecimal.ONE).equals(BigDecimal.ZERO));
     }
 
     @Override
@@ -711,8 +714,22 @@
                  *  每人总共入金100U
                  */
                 BigDecimal amountIn = transferADto.getAmount();
-                if(amountIn.compareTo(new BigDecimal(100)) != 0){
-                    throw new FebsException("Limit per address 100 USDT");
+//                if(amountIn.compareTo(new BigDecimal(100)) != 0){
+//                    throw new FebsException("Limit per address 100 USDT");
+//                }
+                /**
+                 * 每单金额得大于100 小于1000 限制
+                 */
+                if(amountIn.compareTo(new BigDecimal(100)) < 0){
+                    throw new FebsException("Min 100");
+                }
+                if(amountIn.compareTo(new BigDecimal(1000)) > 0){
+                    throw new FebsException("Max 1000");
+                }
+
+                BigDecimal result = amountIn.divide(BigDecimal.valueOf(100));
+                if(!result.remainder(BigDecimal.ONE).equals(BigDecimal.ZERO)){
+                    throw new FebsException("Please enter an integer multiple of 100");
                 }
 
 //                BigDecimal amountInLast = dappChargeUsdtMapper.selectByMaxAmountMemberId(member.getId());
@@ -736,9 +753,12 @@
 //                        throw new FebsException("Limit per address 100 USDT");
 //                    }
 //                }
+                /**
+                 * 每个地址只能使用一次 限制
+                 */
                 if(getLocalAddress(dappMemberEntity.getAddress())){
                     if(BigDecimal.ZERO.compareTo(amountInLast) < 0){
-                        throw new FebsException("Limit per address 100 USDT");
+                        throw new FebsException("Address can only be used once");
                     }
                 }
                 /**

--
Gitblit v1.9.1