xiaoyong931011
2023-05-29 e076175063449fb70bc9d6b5e5ef362666f46ec9
twoCoin项目修改
4 files modified
129 ■■■■ changed files
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java 3 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/job/BnbTransferJob.java 2 ●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappMemberDao.xml 2 ●●● patch | view | raw | blame | history
src/test/java/cc/mrbird/febs/ChainTest.java 122 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
@@ -1569,7 +1569,7 @@
            return;
        }
        //金额
        BigDecimal amount = dappFundFlowEntity.getAmount();
        BigDecimal amount = dappFundFlowEntity.getAmount().setScale(4,BigDecimal.ROUND_DOWN);
        Long memberId = dappFundFlowEntity.getMemberId();
        DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId);
@@ -1930,6 +1930,7 @@
        }
        log.info("{},{}",id,hash);
        dappFundFlow.setFromHash(hash);
        dappFundFlow.setStatus(2);
        dappFundFlowDao.updateById(dappFundFlow);
    }
src/main/java/cc/mrbird/febs/job/BnbTransferJob.java
@@ -48,7 +48,7 @@
    @Scheduled(cron = "0/30 * * * * ? ")
    public void ABTransferAgain() {
        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectByStateAndVersionAndFromHashTwoLimitOne(2,2);
        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectByStateAndVersionAndFromHashTwoLimitOne(1,2);
        if(ObjectUtil.isNotEmpty(dappFundFlowEntity)){
            Integer isReturn = dappFundFlowEntity.getIsReturn();
            if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == isReturn){
src/main/resources/mapper/dapp/DappMemberDao.xml
@@ -232,7 +232,7 @@
    </select>
    <select id="selectAllAchieveByInviteId" resultType="java.math.BigDecimal">
        select sum(IFNULL(a.achieve_amount, 0))
        select IFNULL(sum(IFNULL(a.achieve_amount, 0)),0)
        from dapp_usdt_perk a
        inner join dapp_member b on a.member_id = b.id
        where find_in_set(#{inviteId}, b.referer_ids) or b.invite_id = #{inviteId}
src/test/java/cc/mrbird/febs/ChainTest.java
@@ -40,72 +40,72 @@
@SpringBootTest
public class ChainTest {
    @Autowired
    private BscUsdtContractEvent bscUsdtContractEvent;
    @Autowired
    private BscCoinContractEvent bscCoinContractEvent;
    @Test
    public void chainListener(){
        ChainService.contractEventListener(new BigInteger("22934633"), new BigInteger("22934633"), bscUsdtContractEvent, ChainEnum.BSC_USDT.name());
//        ChainService.contractEventListener(new BigInteger("20860178"), new BigInteger("20860178"), bscCoinContractEvent, ChainEnum.BSC_TFC.name());
    }
    @Test
    public void wssChainListener(){
        ChainService.wssContractEventListener(new BigInteger("23591200"), bscUsdtContractEvent, ChainEnum.BSC_USDT.name());
    }
    @Test
    public void wssBaseChainListener(){
//        WebSocketService ws = null;
//        WebSocketClient webSocketClient = null;
//        Web3j web3j = null;
        try {
//            webSocketClient = new WebSocketClient(new URI("wss://bsc-mainnet.nodereal.io/ws/v1/78074065950e4915aef4f12b6f357d16"));
//            ws = new WebSocketService(webSocketClient, true);
//            ws.connect();
//            web3j = Web3j.build(ws);
            HttpService service = new HttpService("https://bsc-dataseed1.ninicoin.io");
            Web3j web3j = Web3j.build(service);
//            EthFilter filter = getFilter(startBlock, null, "0xd9076245473060dda1a65f5f3d89a4d0598995e6");
//    @Autowired
//    private BscUsdtContractEvent bscUsdtContractEvent;
//
//            Flowable<Log> eventFlowable = web3j.ethLogFlowable(filter);
//            Disposable subscribe = eventFlowable.subscribe(log -> {
//    @Autowired
//    private BscCoinContractEvent bscCoinContractEvent;
//
//    @Test
//    public void chainListener(){
//        ChainService.contractEventListener(new BigInteger("22934633"), new BigInteger("22934633"), bscUsdtContractEvent, ChainEnum.BSC_USDT.name());
//
////        ChainService.contractEventListener(new BigInteger("20860178"), new BigInteger("20860178"), bscCoinContractEvent, ChainEnum.BSC_TFC.name());
//
//    }
//
//
//    @Test
//    public void wssChainListener(){
//        ChainService.wssContractEventListener(new BigInteger("23591200"), bscUsdtContractEvent, ChainEnum.BSC_USDT.name());
//    }
//
//
//    @Test
//    public void wssBaseChainListener(){
////        WebSocketService ws = null;
////        WebSocketClient webSocketClient = null;
////        Web3j web3j = null;
//
//        try {
////            webSocketClient = new WebSocketClient(new URI("wss://bsc-mainnet.nodereal.io/ws/v1/78074065950e4915aef4f12b6f357d16"));
////            ws = new WebSocketService(webSocketClient, true);
////            ws.connect();
////            web3j = Web3j.build(ws);
//
//
//            HttpService service = new HttpService("https://bsc-dataseed1.ninicoin.io");
//            Web3j web3j = Web3j.build(service);
//
////            EthFilter filter = getFilter(startBlock, null, "0xd9076245473060dda1a65f5f3d89a4d0598995e6");
////
////            Flowable<Log> eventFlowable = web3j.ethLogFlowable(filter);
////            Disposable subscribe = eventFlowable.subscribe(log -> {
////                System.out.println(1111111);
////                System.out.println(log);
////            }, error -> {
////                log.error("币安监听异常", error);
////            });
//                System.out.println(1111111);
//                System.out.println(log);
//            Disposable subscription = web3j.blockFlowable(true).subscribe(block -> {
//                System.out.println(111);
//            }, error -> {
//                log.error("币安监听异常", error);
//            });
            System.out.println(1111111);
            Disposable subscription = web3j.blockFlowable(true).subscribe(block -> {
                System.out.println(111);
            }, error -> {
                System.out.println(2222);
            });
//            Disposable subscribe = web3j.replayPastAndFutureTransactionsFlowable(new DefaultBlockParameterNumber(startBlock)).subscribe(tx -> {
//                System.out.println(1111);
//            });
//            Disposable subscribe = web3j.transactionFlowable().subscribe(tx -> {
//                System.out.println(1111);
//                System.out.println(2222);
//            });
//
//            subscription.dispose();
        } catch (Exception e) {
            System.out.println(2222222);
            e.printStackTrace();
        }
    }
////            Disposable subscribe = web3j.replayPastAndFutureTransactionsFlowable(new DefaultBlockParameterNumber(startBlock)).subscribe(tx -> {
////                System.out.println(1111);
////            });
////            Disposable subscribe = web3j.transactionFlowable().subscribe(tx -> {
////                System.out.println(1111);
////            });
////
////            subscription.dispose();
//        } catch (Exception e) {
//            System.out.println(2222222);
//            e.printStackTrace();
//        }
//    }
//    @Autowired
//    private ProfitDailyJob profitDailyJob;