KKSU
2024-04-17 829f629756e5402bcd3e9f6ef1f9c6dbffbabb11
src/main/java/com/xcong/excoin/quartz/job/UsdtCnyExchangePriceUpdateJob.java
@@ -37,7 +37,7 @@
        // 模拟浏览器
        String userAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36";
        try {
            URL url = new URL("https://otc-api-hk.eiijo.cn/v1/data/config/purchase-price?coinId=2&currencyId=1&matchType=0");
            URL url = new URL("https://freecurrencyrates.com/api/action.php?s=fcr&iso=USD-CNH&f=USD&v=1&do=cvals&ln=zh-hans");
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");
            connection.setReadTimeout(30000);
@@ -53,13 +53,13 @@
            }
            reader.close();
            result = sbf.toString();
            JSONObject jsonObject = (JSONObject) JSONObject.parse(result);
            String code = jsonObject.getString("code");
            if ("200".equals(code)) {
                JSONObject jsonData = (JSONObject) jsonObject.get("data");
                cnyUsdtExchangeDao.updateUsdt(BigDecimal.valueOf(jsonData.getDouble("price")));
            }
//            String code = jsonObject.getString("code");
//            if ("200".equals(code)) {
//                JSONObject jsonData = (JSONObject) jsonObject.get("data");
//                cnyUsdtExchangeDao.updateUsdt(BigDecimal.valueOf(jsonData.getDouble("price")));
//            }
            cnyUsdtExchangeDao.updateUsdt(new BigDecimal(jsonObject.getString("CNH")));
        } catch (Exception e) {
            e.printStackTrace();
        }