xiaoyong931011
2022-12-13 87cd3ee733c4658880de4ea4888d8414beb6dff4
src/main/java/cc/mrbird/febs/dapp/contract/ContractMain.java
@@ -109,14 +109,14 @@
                //投注人是否加入
                DappSystemProfit dappSystemProfit = dappSystemProfitDao.selectByMemberIdAndState(dappMemberEntity.getId(), DappSystemProfit.STATE_IN);
                if(ObjectUtil.isNotEmpty(dappSystemProfit)){
                    List<DappFundFlowEntity> dappFundFlowEntities = dappFundFlowDao.selectListBySystemProfitIdAndState(dappSystemProfit.getId(),DappFundFlowEntity.WITHDRAW_STATUS_ING);
                    List<DappFundFlowEntity> dappFundFlowEntities = dappFundFlowDao.selectListByState(DappFundFlowEntity.WITHDRAW_STATUS_ING);
                    if(CollUtil.isNotEmpty(dappFundFlowEntities)){
                        for(DappFundFlowEntity dappFundFlowEntity : dappFundFlowEntities){
                            //发送转币消息
                            chainProducer.sendBnbTransferMsg(dappFundFlowEntity.getId());
                            DappMemberEntity dappMember = dappMemberDao.selectById(dappFundFlowEntity.getMemberId());
                            trans(new BigInteger(dappFundFlowEntity.getAmount().toString()),dappMember.getAddress());
//                            DappMemberEntity dappMember = dappMemberDao.selectById(dappFundFlowEntity.getMemberId());
//                            trans(new BigInteger(dappFundFlowEntity.getAmount().toString()),dappMember.getAddress());
                        }
                    }
                }
@@ -128,13 +128,16 @@
    /**
     * 从合约内转币到制定地址
     */
    public void trans(BigInteger amount, String to1){
    public String trans(BigInteger amount, String to1){
        String transactionHash = null;
        Credentials credentials = Credentials.create(privateKey);
        Abi contract = Abi.load(contractAddr, getInstance(), credentials, getStaticGasProvider());
        try {
            TransactionReceipt send = contract.trans(amount, to1).send();
            transactionHash = send.getTransactionHash();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
        return transactionHash;
    }
}