新版仿ok交易所-后端
1
zj
2025-10-30 14c1946eae86a86f8d1edee6cf3bdaf7572fc966
trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiChannelBlockchainController.java
@@ -230,42 +230,42 @@
        channelBlockchain.setBlockchain_name(blockchain_name);
        return channelBlockchain;
    }
    @RequestMapping(action +"rechargeCallback.action")
    public ResultMsg rechargeCallback(HttpServletRequest request){
        String timestamp = request.getParameter("timestamp");
        String nonce = request.getParameter("nonce");
        String sign = request.getParameter("sign");
        String body = request.getParameter("body");
        try{
            ObjectMapper objectMapper = new ObjectMapper();
            Map<String, Object> map = objectMapper.readValue(body, HashMap.class);
            double amounts = Double.parseDouble(map.get("amount").toString());  // 假设 amount 的值为 1000
            double decimals = Double.parseDouble(map.get("decimals").toString());
            double success_amount  = amounts / Math.pow(10, decimals);
            String address = map.get("address").toString();
            RechargeBlockchainOrder blockchainOrder = rechargeBlockchainOrderService.getOne(new LambdaQueryWrapper<>(RechargeBlockchainOrder.class)
                    .eq(RechargeBlockchainOrder::getSucceeded, 0)
                    .eq(RechargeBlockchainOrder::getChannelAddress, address).last(" limit 1 "));
            if(ObjectUtil.isEmpty(blockchainOrder)){
                ResultMsg resultMsg = new ResultMsg();
                resultMsg.setCode(200);
                return resultMsg;
            }
                SysUser user = sysUserService.getSysUserById( Long.getLong(blockchainOrder.getPartyId()));
            rechargeBlockchainOrderService.manualReceipt(1,blockchainOrder.getPartyId(), BigDecimal.valueOf(success_amount),user.getUsername());
            ResultMsg resultMsg = new ResultMsg();
            resultMsg.setCode(200);
            return resultMsg;
        }catch (Exception e){
            ResultMsg resultMsg = new ResultMsg();
            resultMsg.setCode(500);
            resultMsg.setMessage("回调处理失败");
            return resultMsg;
        }
    }
    //回调地址关闭
//    @RequestMapping(action +"rechargeCallback.action")
//    public ResultMsg rechargeCallback(HttpServletRequest request){
//        String timestamp = request.getParameter("timestamp");
//        String nonce = request.getParameter("nonce");
//        String sign = request.getParameter("sign");
//        String body = request.getParameter("body");
//        try{
//            ObjectMapper objectMapper = new ObjectMapper();
//            Map<String, Object> map = objectMapper.readValue(body, HashMap.class);
//            double amounts = Double.parseDouble(map.get("amount").toString());  // 假设 amount 的值为 1000
//            double decimals = Double.parseDouble(map.get("decimals").toString());
//            double success_amount  = amounts / Math.pow(10, decimals);
//            String address = map.get("address").toString();
//
//
//            RechargeBlockchainOrder blockchainOrder = rechargeBlockchainOrderService.getOne(new LambdaQueryWrapper<>(RechargeBlockchainOrder.class)
//                    .eq(RechargeBlockchainOrder::getSucceeded, 0)
//                    .eq(RechargeBlockchainOrder::getChannelAddress, address).last(" limit 1 "));
//            if(ObjectUtil.isEmpty(blockchainOrder)){
//                ResultMsg resultMsg = new ResultMsg();
//                resultMsg.setCode(200);
//                return resultMsg;
//            }
//                SysUser user = sysUserService.getSysUserById( Long.getLong(blockchainOrder.getPartyId()));
//            rechargeBlockchainOrderService.manualReceipt(1,blockchainOrder.getPartyId(), BigDecimal.valueOf(success_amount),user.getUsername());
//            ResultMsg resultMsg = new ResultMsg();
//            resultMsg.setCode(200);
//            return resultMsg;
//        }catch (Exception e){
//            ResultMsg resultMsg = new ResultMsg();
//            resultMsg.setCode(500);
//            resultMsg.setMessage("回调处理失败");
//            return resultMsg;
//        }
//    }
    /**
     * 根据第三方充值链接