From 46def5897de95d01c1606a49da4292f5f1e53760 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 12 Jun 2023 10:14:05 +0800
Subject: [PATCH] twoCoin项目修改

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 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 d952e34..e4d20b4 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
@@ -36,6 +36,7 @@
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import freemarker.template.utility.StringUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -737,28 +738,16 @@
                  * 限制用户买入总额,
                  *  目前每人限一单,总金额限制100U
                  */
-                BigDecimal amountInLast = dappChargeUsdtMapper.selectBySumAmountMemberId(member.getId());
-//                DataDictionaryCustom systemAddressDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
-//                        PoolEnum.SYSTEM_ADDRESS.getType(),
-//                        PoolEnum.SYSTEM_ADDRESS.getCode()
-//                );
-//                if(StrUtil.isNotEmpty(systemAddressDic.getValue())){
-//                    if(getLocalAddress(dappMemberEntity.getAddress())){
-//                        if(BigDecimal.ZERO.compareTo(amountInLast) < 0){
-//                            throw new FebsException("Limit per address 100 USDT");
-//                        }
-//                    }
-//                }else{
-//                    if(BigDecimal.ZERO.compareTo(amountInLast) < 0){
-//                        throw new FebsException("Limit per address 100 USDT");
-//                    }
-//                }
+//                BigDecimal amountInLast = dappChargeUsdtMapper.selectBySumAmountMemberId(member.getId());
+                BigDecimal amountInLast = dappChargeUsdtMapper.selectBySumAmountMemberIdAndDate(member.getId(),DateUtil.today());
                 /**
-                 * 每个地址只能使用一次 限制
+                 * 每个地址只能使用一次 限制总额1000U
                  */
+                BigDecimal amountInAll = amountInLast.add(amountIn);
                 if(getLocalAddress(dappMemberEntity.getAddress())){
-                    if(BigDecimal.ZERO.compareTo(amountInLast) < 0){
-                        throw new FebsException("Address can only be used once");
+                    if(amountInAll.compareTo(new BigDecimal(1000)) > 0){
+                        BigDecimal add = new BigDecimal(1000).subtract(amountInLast).setScale(0, BigDecimal.ROUND_DOWN);
+                        throw new FebsException("Max "+ add.toString());
                     }
                 }
                 /**
@@ -1183,6 +1172,17 @@
             throw new FebsException("请输入正确的地址");
         }
 
+        /**
+         * 转ausdt,只能推广线上
+         */
+        String refererIdsDone = dappMemberEntity.getRefererIds();
+        String inviteIdDone = dappMemberEntity.getInviteId();
+        String refererIdsOther = memberParent.getRefererIds();
+        String inviteId1Other = memberParent.getInviteId();
+        if(!(StrUtil.contains(refererIdsOther,inviteIdDone) || StrUtil.contains(refererIdsDone,inviteId1Other))){
+            throw new FebsException("不满足互转规则");
+        }
+
         BigDecimal coinCnt = roundCoinDto.getCoinCnt();
         if(BigDecimal.ZERO.compareTo(coinCnt) >= 0){
             throw new FebsException("输入正确的数量");

--
Gitblit v1.9.1