From afe2e9a2da152a9b1a54d88b7637e811bf298749 Mon Sep 17 00:00:00 2001
From: wzy <wzy19931122ai@163.com>
Date: Sat, 27 Aug 2022 00:39:49 +0800
Subject: [PATCH] finish matrix profit

---
 src/main/java/cc/mrbird/febs/dapp/service/impl/BscUsdtContractEvent.java |   17 ++++-------------
 1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/BscUsdtContractEvent.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/BscUsdtContractEvent.java
index b3299b2..0e79963 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/BscUsdtContractEvent.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/BscUsdtContractEvent.java
@@ -32,15 +32,12 @@
 
     @Resource
     private RedisUtils redisUtils;
-
-    @Resource
-    private DappMemberService dappMemberService;
-
     @Resource
     private DappFundFlowDao dappFundFlowDao;
-
     @Resource
     private DappWalletCoinDao dappWalletCoinDao;
+    @Resource
+    private ChainProducer chainProducer;
 
 
     @Override
@@ -67,8 +64,6 @@
             if (e.from.equals("0xaa25aa7a19f9c426e07dee59b12f944f4d9f1dd3")) {
                 return;
             }
-
-            DappMemberEntity fromMember = dappMemberService.findByAddress(e.from, null);
 
             BigInteger tokens = e.tokens;
             BigDecimal amount = new BigDecimal(tokens.toString()).divide(BigDecimal.TEN.pow(decimals), decimals, RoundingMode.HALF_DOWN);
@@ -105,16 +100,12 @@
             }
             OnlineTransferUtil.addTransferRecord(e.from, e.to, amount, e.log.getTransactionHash(), DappTransferRecordEntity.TRANSFER_SOURCE_FLAG_APPLICATION, "USDT");
 
+            fundFlow.setAmount(fundFlow.getAmount().negate());
             // 更改状态为已同步
             fundFlow.setStatus(2);
             dappFundFlowDao.updateById(fundFlow);
 
-            synchronized (this) {
-                DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(fundFlow.getMemberId());
-                walletCoin.setTotalAmount(walletCoin.getTotalAmount().add(amount));
-                walletCoin.setAvailableAmount(walletCoin.getAvailableAmount().add(amount));
-                dappWalletCoinDao.updateById(walletCoin);
-            }
+            chainProducer.sendAchieveTreeMsg(fundFlow.getMemberId());
         }
     }
 }

--
Gitblit v1.9.1