Helius
2021-05-24 0b10fd71ce7a6c32b70eef96f0ceb5a516306d6b
src/test/java/com/xcong/excoin/XchTest.java
@@ -16,6 +16,9 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@@ -60,7 +63,7 @@
    @Test
    public void orderUsdtProfitTest() {
        xchProfitService.usdtProfitDistributorByOrderId(7L);
        xchProfitService.usdtProfitDistributorByOrderId(17L);
    }
//
//    @Autowired
@@ -97,4 +100,38 @@
        coin.setPageSize(10);
        coinService.coinInList(coin);
    }
    public static void main(String[] args) {
        String s = execCurl("https://api2.chiaexplorer.com/blockchainSummary");
        System.out.println(s);
    }
    private static String execCurl(String url) {
        String[] cmds = {"curl", url
                , "-H", "sec-ch-ua: \" Not A;Brand\";v=\"99\", \"Chromium\";v=\"90\", \"Google Chrome\";v=\"90\""
                ,"-H", "Accept: application/json, text/plain, */*"
                ,"-H", "Referer: https://www.chiaexplorer.com/"
                ,"-H", "sec-ch-ua-mobile: ?0"
                ,"-H", "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"
                ," --compressed"};
        ProcessBuilder process = new ProcessBuilder(cmds);
        Process p;
        try {
            p = process.start();
            BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
            StringBuilder builder = new StringBuilder();
            String line;
            while ((line = reader.readLine()) != null) {
                builder.append(line);
                builder.append(System.getProperty("line.separator"));
            }
            return builder.toString();
        } catch (IOException e) {
            System.out.print("error");
            e.printStackTrace();
        }
        return null;
    }
}