| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import kernel.web.Page; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | import okhttp3.Request; |
| | | import okhttp3.RequestBody; |
| | | import okhttp3.Response; |
| | | import org.web3j.abi.datatypes.Int; |
| | | import project.Constants; |
| | | import project.blockchain.ChannelBlockchain; |
| | | import project.blockchain.ChannelBlockchainService; |
| | |
| | | |
| | | try { |
| | | if(data.isEmpty()) data=this.channelBlockchainService.findByCoin(coin); |
| | | |
| | | for (int i = 0; i < data.size(); i++) { |
| | | if (1 == this.sysparaService.find("can_recharge").getInteger()) { |
| | | |
| | |
| | | data.get(i).setAddress(null); |
| | | } |
| | | } |
| | | List<Map<String, Object>> listMap = getStringListMap(); |
| | | // resultObject.setData(data); |
| | | resultObject.setData(listMap); |
| | | |
| | | Map<String, List<Map<String, Object>>> coinMap = getStringListMap(); |
| | | List<Map<String, Object>> result = getCoinData(coinMap, coin); |
| | | resultObject.setData(result); |
| | | |
| | | } catch (BusinessException e) { |
| | | resultObject.setCode("1"); |
| | | resultObject.setMsg(e.getMessage()); |
| | |
| | | } |
| | | |
| | | @NotNull |
| | | private static List<Map<String, Object>> getStringListMap() { |
| | | private static Map<String, List<Map<String, Object>>> getStringListMap() { |
| | | List<Map<String, Object>> ethData = new ArrayList<>(); |
| | | ethData.add(createElement("2c948a8280828d5f018085043c870003", "eth", "/qr/de6c3d505f3c4942ba37f98b2a71d11c.png", "0x887c3253bC8a1Bf36985F9919CD4D9F98C719a3C","ETH")); |
| | | |
| | | List<Map<String, Object>> btcData = new ArrayList<>(); |
| | | btcData.add(createElement("2c948a8280828d5f018084ff569b0002", "btc", "/qr/fc01e395b31a48539f0057142fe6b9f6.png", "19yJBFdSNM4PUD9G9Mi4agzYEVEdpK9KbN","BTC")); |
| | | |
| | | List<Map<String, Object>> usdtData = new ArrayList<>(); |
| | | usdtData.add(createElement("2c948a8280828d5f01808203eacd0004", 0,null, "USDT","ERC20","https://www.bingxz.com/wap/public/showimg!showImg.action?imagePath=/qr/7745a981e92448e7bc9660033ddb558b.png","/public/showimg!showImg.action?imagePath=/qr/7745a981e92448e7bc9660033ddb558b.png","TBA4W8wtt7eZuGUDMBzdpFT4gQTVtznmQY",false)); |
| | | usdtData.add(createElement("2c948a8280828d5f01808203eacd0004", 0,null, "USDT","TRC20","https://www.bingxz.com/wap/public/showimg!showImg.action?imagePath=/qr/9a00130ae16d41afa33416183ce2ac55.png","/public/showimg!showImg.action?imagePath=/qr/9a00130ae16d41afa33416183ce2ac55.png","TBA4W8wtt7eZuGUDMBzdpFT4gQTVtznmQY",false)); |
| | | return usdtData; |
| | | usdtData.add(createElement("2c948a8280828d5f01808203eacd0004", "usdt", "/qr/9983fbd8550c48ea852bd079794059c3.png", "0x887c3253bC8a1Bf36985F9919CD4D9F98C719a3C","ERC20")); |
| | | usdtData.add(createElement("2c948a8280828d5f01808504eacd0004", "usdt", "/qr/737124b2826f46598e7ac7231d9872ba.png", "TESGCY3weZJgqH64NPMTRL5AXCfNKVR4Tw","TRC20")); |
| | | |
| | | List<Map<String, Object>> usdcData = new ArrayList<>(); |
| | | usdcData.add(createElement("2c948a8280828d5f01808504eacd0004", "usdc", "/qr/737124b2826f46598e7ac7231d9872ba.png", "TFms9AcjHNS6DRVn7xc3gTi5xwnvaxgBTP","TRC20")); |
| | | usdcData.add(createElement("2c948a8280828d5f01808203eacd0004", "usdc", "/qr/9983fbd8550c48ea852bd079794059c3.png", "0x887c3253bC8a1Bf36985F9919CD4D9F98C719a3C","ERC20")); |
| | | |
| | | Map<String, List<Map<String, Object>>> coinMap = new HashMap<>(); |
| | | coinMap.put("eth", ethData); |
| | | coinMap.put("btc", btcData); |
| | | coinMap.put("usdt", usdtData); |
| | | coinMap.put("usdc", usdcData); |
| | | return coinMap; |
| | | } |
| | | |
| | | private static Map<String, Object> createElement(String id, int entityVersion, String timestamp, String coin, String blockchainName, String img, String imgStr , String address, boolean auto) { |
| | | private static Map<String, Object> createElement(String id, String coin, String img, String address,String blockchain_name) { |
| | | Map<String, Object> element = new HashMap<>(); |
| | | element.put("id", id); |
| | | element.put("entityVersion", entityVersion); |
| | | element.put("timestamp", timestamp); |
| | | element.put("coin", coin); |
| | | element.put("blockchain_name", blockchainName); |
| | | element.put("img", img); |
| | | element.put("img_str", imgStr); |
| | | element.put("address", address); |
| | | element.put("auto", auto); |
| | | element.put("blockchain_name", blockchain_name); |
| | | return element; |
| | | } |
| | | |
| | | private static List<Map<String, Object>> getCoinData(Map<String, List<Map<String, Object>>> coinMap, String coin) { |
| | | return coinMap.getOrDefault(coin, new ArrayList<>()); |
| | | } |
| | | |
| | | /** |
| | | * 根据第三方充值链接 |
| | | */ |