diff --git a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/common/enums/BtcEnums.java b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/common/enums/BtcEnums.java index bb77d9d..847b57c 100644 --- a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/common/enums/BtcEnums.java +++ b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/common/enums/BtcEnums.java @@ -3,6 +3,7 @@ package com.blockchain.server.btc.common.enums; public enum BtcEnums { ADDRESS_ERROR(7000, "请输入有效的地址", "Please enter a valid address.", "請輸入有效的地址"), AMOUNT_NULL(7001, "请输入数量", "Please input quantity.", "請輸入數量"), + RESET_ERROR(7001, "查无初始额度设置,充值失败", "Check no initial limit Settings, recharge failed", "查無初始額度設置,充值失敗"), SENDTOADDRESS_ERROR(7002, "交易失败", "Transaction failure.", "交易失敗"), GET_NEW_ADDRESS_ERROR(7003, "生成地址失败", "Request success", "生成地址失敗"), LIST_UNSPENT_ERROR(7004, "获取UTXO失败", "Failed to get UTXO", "獲取UTXO失敗"), diff --git a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java index fc03aa4..a849ff0 100644 --- a/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java +++ b/blockchain-server/blockchain-server-btc/src/main/java/com/blockchain/server/btc/service/impl/BtcWalletServiceImpl.java @@ -205,6 +205,9 @@ public class BtcWalletServiceImpl implements BtcWalletService { walletInitConfig.setCoin(tokenId); walletInitConfig.setWalletType(walletType); WalletInitConfig config = walletInitConfigMapper.selectOne(walletInitConfig); + if(config==null || config.getBalance()==null){ + throw new BtcException(BtcEnums.RESET_ERROR); + } btcWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date()); return 1; diff --git a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/common/enums/EosWalletEnums.java b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/common/enums/EosWalletEnums.java index 1c3be7a..6acc7ee 100644 --- a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/common/enums/EosWalletEnums.java +++ b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/common/enums/EosWalletEnums.java @@ -2,6 +2,7 @@ package com.blockchain.server.eos.common.enums; public enum EosWalletEnums { SESSION_ERROR(201, "操作失败,用户未登录!", "The operation failed and the user is not logged in!", "操作失敗,用戶未登錄!"), + RESET_ERROR(7001, "查无初始额度设置,充值失败", "Check no initial limit Settings, recharge failed", "查無初始額度設置,充值失敗"), EOSWALLET_GETWALLET_ERROR(202, "该钱包不存在!", "The wallet does not exist!", "該錢包不存在!"), ERROR(203, "操作失败!", "operation failure!", "操作失敗!"), BALANCE_AMOUNT_ERROR(204, "操作失败,余额不足!", "The operation failed and the balance is insufficient!", "操作失敗,餘額不足!"), diff --git a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java index 86e4ec3..14f2189 100644 --- a/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java +++ b/blockchain-server/blockchain-server-eos/src/main/java/com/blockchain/server/eos/service/impl/EosWalletServiceImpl.java @@ -437,6 +437,10 @@ public class EosWalletServiceImpl implements EosWalletService, ITxTransaction { walletInitConfig.setCoin(tokenId); walletInitConfig.setWalletType(walletType); WalletInitConfig config = walletInitConfigMapper.selectOne(walletInitConfig); + + if(config==null || config.getBalance()==null){ + throw new EosWalletException(EosWalletEnums.RESET_ERROR); + } // 修改钱包插入充值记录 walletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date()); } diff --git a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/common/enums/EthWalletEnums.java b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/common/enums/EthWalletEnums.java index 9fa053c..11c8c74 100644 --- a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/common/enums/EthWalletEnums.java +++ b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/common/enums/EthWalletEnums.java @@ -2,6 +2,7 @@ package com.blockchain.server.eth.common.enums; public enum EthWalletEnums { SUCCESS(200, "请求成功", "Request success", ""), + RESET_ERROR(7001, "查无初始额度设置,充值失败", "Check no initial limit Settings, recharge failed", "查無初始額度設置,充值失敗"), NO_LOGIN(201, "未登录", "No login", ""), NOT_PERFECT(500, "接口未完善", "Not perfect", ""), NOT_WALLETPASSWORD(800, "你还没有设置资金密码", "You have not set the fund password", "妳還沒有設置資金密碼"), diff --git a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java index 519ac5d..13c996b 100644 --- a/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java +++ b/blockchain-server/blockchain-server-eth/src/main/java/com/blockchain/server/eth/service/impl/EthWalletServiceImpl.java @@ -424,6 +424,9 @@ public class EthWalletServiceImpl implements IEthWalletService, ITxTransaction { WalletInitConfig config = walletInitConfigMapper.selectOne(walletInitConfig); ethWalletMapper.updateWalletBalanceByUserOpenId(config.getBalance(),userOpenId,tokenId,walletType,new Date()); + if(config==null || config.getBalance()==null){ + throw new EthWalletException(EthWalletEnums.RESET_ERROR); + } EthWalletDTO walletDTO = selectByAddrAndTokenAddrAndWalletType(addr, addr, walletType); return walletDTO;