zainali5120
2020-10-23 0f1d49a9cfad6b12399bd4a197ee3ebb9b59f201
去掉提币短信,优化自动转币ROC
2 files modified
37 ■■■■■ changed files
src/main/java/com/xcong/excoin/modules/Sms106Send.java 13 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java 24 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/Sms106Send.java
@@ -16,8 +16,8 @@
public class Sms106Send {
    private static final String URL = "http://www.qf106.com/sms.aspx";
    private static final String ID = "16606";
    private static final String ACCOUNT = "golden";
    private static final String ID = "16624";
    private static final String ACCOUNT = "golden1";
    private static final String PASSWORD = "123456";
@@ -36,18 +36,21 @@
    public static boolean sendRechargeMsg(String phone, String time, String orderNo) {
        String msg = "尊敬的用户,您的帐号于{}有一笔成功充值订单,如有疑问请联系客服,订单编号为{}";
        String content = StrUtil.format(msg, time, orderNo);
        return request(phone, content, "充值");
        return true;
        //return request(phone, content, "充值");
    }
    public static boolean sendWithdrawalMsg(String phone, String time, String orderNo) {
        String msg = "尊敬的用户,您的帐号于{}有一笔成功提现订单,如有疑问请联系客服,订单编号为{}";
        String content = StrUtil.format(msg, time, orderNo);
        return request(phone, content, "提现");
        return true;
       // return request(phone, content, "提现");
    }
    public static boolean sendWithdrawalCoinMsg(String phone, String time) {
        String msg = "尊敬的用户,您的帐号于{}有一笔成功提现订单,如有疑问请联系客服。";
        String content = StrUtil.format(msg, time);
        return request(phone, content, "提币");
        //return request(phone, content, "提币");
        return true;
    }
    private static boolean request(String phone, String content, String tagName) {
src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
@@ -465,7 +465,16 @@
        if(status != 1) {
            return new FebsResponse().fail().message("只有等待审核的状态才能确认!");
        }
        // 转币 需要扣除手续费
        amount = amount.subtract(selectById.getFeeAmount());
        if("ROC".equals(symbol) && !"Y".equals(selectById.getIsInside())){
            // 如果是ROC  则自动转
            String transfer = RocService.transfer(amount, address, "ROC");
            if(!"success".equals(transfer)){
                FebsResponse febsResponse = new FebsResponse();
                return  febsResponse.fail().message(transfer);
            }
        }
        // 查询币币钱包
        MemberWalletCoinEntity walletCoin = memberWalletCoinMapper.findWalletCoinByMemberIdAndWalletCode(memberId, symbol);
        
@@ -488,8 +497,8 @@
            Long aimMemberId = selectByMap.get(0).getMemberId();
            MemberWalletCoinEntity aimWalletCoin = memberWalletCoinMapper.findWalletCoinByMemberIdAndWalletCode(aimMemberId, symbol);
            
            BigDecimal addTotal = aimWalletCoin.getTotalBalance().add(amount.subtract(selectById.getFeeAmount()));
            BigDecimal addAvailable = aimWalletCoin.getAvailableBalance().add(amount.subtract(selectById.getFeeAmount()));
            BigDecimal addTotal = aimWalletCoin.getTotalBalance().add(amount);
            BigDecimal addAvailable = aimWalletCoin.getAvailableBalance().add(amount);
            aimWalletCoin.setTotalBalance(addTotal);
            aimWalletCoin.setAvailableBalance(addAvailable);
            
@@ -498,7 +507,7 @@
            MemberAccountMoneyChangeEntity memberAccountMoneyChangeEntity = new MemberAccountMoneyChangeEntity();
            memberAccountMoneyChangeEntity.setContent("收款");
            memberAccountMoneyChangeEntity.setMemberId(aimMemberId);
            memberAccountMoneyChangeEntity.setAmount(amount.subtract(selectById.getFeeAmount()));
            memberAccountMoneyChangeEntity.setAmount(amount);
            memberAccountMoneyChangeEntity.setStatus(MemberAccountMoneyChangeEntity.STATUS_SUCCESS_INTEGER);
            memberAccountMoneyChangeEntity.setSymbol(selectById.getSymbol());
            memberAccountMoneyChangeEntity.setType(MemberAccountMoneyChangeEntity.TYPE_WALLET_COIN);
@@ -530,12 +539,7 @@
        if(StrUtil.isNotBlank(phone)) {
            Sms106Send.sendWithdrawalCoinMsg(phone, time);
        }
        // 转币 需要扣除手续费
        amount = amount.subtract(selectById.getFeeAmount());
        if("ROC".equals(symbol) && !"Y".equals(selectById.getIsInside())){
            // 如果是ROC  则自动转
            String transfer = RocService.transfer(amount, address, "ROC");
        }else if("USDT".equals(symbol) && !"Y".equals(selectById.getIsInside())){
         if("USDT".equals(symbol) && !"Y".equals(selectById.getIsInside())){
//            EthService ethService = new EthService();
//            // 查询余额是否足够
//            BigDecimal bigDecimal = ethService.tokenGetBalance(EthService.TOTAL_ADDRESS);