| | |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.common.utils.SpringContextUtil; |
| | | import cc.mrbird.febs.dapp.chain.ChainEnum; |
| | | import cc.mrbird.febs.dapp.chain.ChainService; |
| | | import cc.mrbird.febs.dapp.dto.SystemDto; |
| | | import cc.mrbird.febs.dapp.entity.*; |
| | | import cc.mrbird.febs.dapp.mapper.*; |
| | |
| | | |
| | | // 如果是复投的,则需奖励 |
| | | if (isReIn == 1) { |
| | | member.setOutCnt(member.getOutCnt() + 1); |
| | | dappMemberDao.updateById(member); |
| | | List<DappMemberEntity> directCnt = dappMemberDao.selectChildMemberDirectOrNot(member.getInviteId(), 1, 1); |
| | | |
| | | dappWalletService.updateWalletCoinWithLock(new BigDecimal(190), member.getId(), 1); |
| | | boolean hasNewDirect = false; |
| | | if (directCnt.size() < 3) { |
| | | DappMemberEntity newestDirect = dappMemberDao.selectNewestDirectMember(member.getInviteId()); |
| | | DappFundFlowEntity fundFlow = dappFundFlowDao.selectNewestFundFlow(memberId, 9); |
| | | |
| | | DappFundFlowEntity matrixProfitFlow = new DappFundFlowEntity(memberId, new BigDecimal("190"), 2, 2, null, null); |
| | | dappFundFlowDao.insert(matrixProfitFlow); |
| | | if (newestDirect != null && fundFlow != null) { |
| | | if (newestDirect.getCreateTime().after(fundFlow.getCreateTime())) { |
| | | hasNewDirect = true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 复投后,推一个拿一轮,推两个拿两轮,推三个后终身有效。 |
| | | * 按规则每轮未能提取的奖金分配: |
| | | * 50%直接进入TFC底池 |
| | | * 20%给到推荐人 |
| | | * 30%留下待提。 |
| | | */ |
| | | if (directCnt.size() < 3 && member.getOutCnt() != 0 && member.getOutCnt() - 1 == directCnt.size() && !hasNewDirect) { |
| | | BigDecimal amount = new BigDecimal("190"); |
| | | |
| | | BigDecimal sourcePool = amount.multiply(new BigDecimal("0.5")); |
| | | BigDecimal directAmount = amount.multiply(new BigDecimal("0.2")); |
| | | |
| | | BigDecimal remain = amount.subtract(sourcePool).subtract(directAmount); |
| | | |
| | | // ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer("", sourcePool); |
| | | |
| | | if (parent != null) { |
| | | dappWalletService.updateWalletCoinWithLock(directAmount, parent.getId(), 1); |
| | | |
| | | DappFundFlowEntity direct = new DappFundFlowEntity(parent.getId(), directAmount, 3, 2, null, null); |
| | | dappFundFlowDao.insert(direct); |
| | | } |
| | | |
| | | dappWalletService.addFrozenAmountWithLock(remain, memberId); |
| | | } else { |
| | | dappWalletService.releaseFrozenAmountWithLock(memberId); |
| | | |
| | | member.setOutCnt(member.getOutCnt() + 1); |
| | | dappMemberDao.updateById(member); |
| | | |
| | | dappWalletService.updateWalletCoinWithLock(new BigDecimal(190), member.getId(), 1); |
| | | |
| | | DappFundFlowEntity matrixProfitFlow = new DappFundFlowEntity(memberId, new BigDecimal("190"), 2, 2, null, null); |
| | | dappFundFlowDao.insert(matrixProfitFlow); |
| | | } |
| | | |
| | | DappFundFlowEntity rePutInFlow = new DappFundFlowEntity(memberId, new BigDecimal("100").negate(), 1, 2, null, null); |
| | | dappFundFlowDao.insert(rePutInFlow); |