| | |
| | | BigDecimal balance = ChainService.getInstance(ChainEnum.BSC_TFC.name()).balanceOf(e.from); |
| | | fromMember.setBalance(balance); |
| | | dappMemberService.updateById(fromMember); |
| | | } else { |
| | | fromMember = dappMemberService.insertMember(e.from, null); |
| | | } |
| | | |
| | | BigInteger tokens = e.tokens; |
| | | BigDecimal amount = BigDecimal.valueOf(tokens.intValue()).divide(BigDecimal.TEN.pow(decimals), decimals, RoundingMode.HALF_DOWN); |
| | | BigDecimal amount = new BigDecimal(tokens.toString()).divide(BigDecimal.TEN.pow(decimals), decimals, RoundingMode.HALF_DOWN); |
| | | |
| | | // 如果转账对象地址不为源池地址,且对象地址在系统中存在并未激活,则激活用户 |
| | | // 如果转账对象地址不为源池地址,注册该用户并绑定上下级关系 |
| | | if (!e.to.equals(ChainEnum.BSC_TFC_SOURCE.getAddress().toLowerCase())) { |
| | | DappMemberEntity toMember = dappMemberDao.selectByAddress(e.to, null); |
| | | if (toMember == null) { |
| | | // toMember = dappMemberService.insertMember(e.to, fromMember.getInviteId()); |
| | | return; |
| | | toMember = dappMemberService.insertMember(e.to, fromMember.getInviteId()); |
| | | } |
| | | |
| | | if (toMember.getActiveStatus() == 2) { |
| | | toMember.setActiveStatus(1); |
| | | } |
| | | // if (toMember.getActiveStatus() == 2) { |
| | | // toMember.setActiveStatus(1); |
| | | // } |
| | | // 更新余额 |
| | | BigDecimal balance = ChainService.getInstance(ChainEnum.BSC_TFC.name()).balanceOf(e.to); |
| | | toMember.setBalance(balance); |
| | |
| | | boolean hasFlow = false; |
| | | for (DappFundFlowEntity flow : flows) { |
| | | if (flow.getStatus() == 1) { |
| | | if (amount.compareTo(flow.getTargetAmount()) == 0) { |
| | | if (amount.compareTo(flow.getAmount()) == 0) { |
| | | hasFlow = true; |
| | | fundFlow = flow; |
| | | fundFlow.setFromHash(e.log.getTransactionHash()); |
| | |
| | | } |
| | | OnlineTransferUtil.addTransferRecord(e.from, e.to, amount, e.log.getTransactionHash(), DappTransferRecordEntity.TRANSFER_SOURCE_FLAG_APPLICATION, AppContants.SYMBOL_COIN); |
| | | |
| | | if (fundFlow.getAmount().add(fundFlow.getFee()).compareTo(amount) != 0) { |
| | | return; |
| | | } |
| | | |
| | | BigDecimal newPrice = fundFlow.getNewestPrice(); |
| | | BigDecimal transferAmount = amount.multiply(newPrice); |
| | | |