From dab541253155333bd065c83f04c1dd9228b8a1d2 Mon Sep 17 00:00:00 2001
From: zyy <zyy@email.com>
Date: Fri, 30 Jan 2026 17:58:17 +0800
Subject: [PATCH] 充值

---
 trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiChannelBlockchainController.java |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 54 insertions(+), 1 deletions(-)

diff --git a/trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiChannelBlockchainController.java b/trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiChannelBlockchainController.java
index 8186285..e299f2f 100644
--- a/trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiChannelBlockchainController.java
+++ b/trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiChannelBlockchainController.java
@@ -3,6 +3,8 @@
 import cn.hutool.core.lang.Console;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.qrcode.QrCodeUtil;
+import cn.hutool.extra.qrcode.QrConfig;
 import cn.hutool.http.HttpStatus;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
@@ -123,7 +125,7 @@
     /**
      * 根据币种获取链地址
      */
-    @GetMapping(action + "getBlockchainName.action")
+    /*@GetMapping(action + "getBlockchainName.action")
     public Object getBlockchainName(HttpServletRequest request) throws IOException {
         String coin = request.getParameter("coin");
         List<ChannelBlockchain> data = new ArrayList<ChannelBlockchain>();
@@ -179,6 +181,57 @@
         }
 
         return Result.succeed(data);
+    }*/
+
+    /**
+     * 根据币种获取链地址
+     */
+    @GetMapping(action + "getBlockchainName.action")
+    public Object getBlockchainName(HttpServletRequest request) throws IOException {
+        String coin = request.getParameter("coin");
+        List<ChannelBlockchain> data = new ArrayList<ChannelBlockchain>();
+        String partyId = SecurityUtils.getUser().getUserId();
+        User party = userService.getById(partyId);
+        if (0 == this.sysparaService.find("can_recharge").getInteger()) {
+            return Result.failed("请联系客服充值");
+        }
+        List<PartyBlockchain> list = partyBlockchainService.findByUserNameAndCoinSymbol(party.getUserName(), coin);
+        if (null != list && !list.isEmpty()) {
+            data = list.stream().map(dict -> {
+                String qrImage = dict.getQrImage();
+                String chainAddress = dict.getAddress();
+                String chainName = dict.getChainName();
+                String coinSymbol = dict.getCoinSymbol();
+                String autoStr = dict.getAuto();
+                boolean auto = autoStr.equals("Y") ? true : false;
+                ChannelBlockchain cbc = new ChannelBlockchain();
+                cbc.setBlockchain_name(chainName);
+                cbc.setAddress(chainAddress);
+                cbc.setCoin(coinSymbol);
+                cbc.setAuto(auto);
+                cbc.setImg(qrImage);
+                return cbc;
+            }).collect(Collectors.toList());
+        }
+        if (data.isEmpty()) data = this.channelBlockchainService.findByCoin(coin.toLowerCase());
+        for (int i = 0; i < data.size(); i++) {
+            data.get(i).setBlockchain_name(data.get(i).getBlockchainName());
+            if (1 == this.sysparaService.find("can_recharge").getInteger()) {
+                if (!StringUtils.isNullOrEmpty(data.get(i).getImg())) {
+                    QrConfig config = new QrConfig(150, 150);
+                    config.setMargin(3);
+                    String qr = QrCodeUtil.generateAsBase64(data.get(i).getAddress(), config, "png");
+                    data.get(i).setImgStr(qr);
+//                    data.get(i).setImgStr("/public/showimg!showImg.action?imagePath=" + data.get(i).getImg());
+//                    data.get(i).setImg(path);
+                }
+            } else {
+                data.get(i).setImg(null);
+                data.get(i).setImgStr(null);
+                data.get(i).setAddress(null);
+            }
+        }
+        return Result.succeed(data);
     }
 
     @PostMapping(action +"rechargeCallback.action")

--
Gitblit v1.9.3