From a7969286fc26143d8dcd9edbde3798433d71dab1 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Tue, 25 May 2021 19:43:08 +0800 Subject: [PATCH] Merge branch 'yunding' of http://120.27.238.55:7000/r/exchange into yunding --- src/test/java/com/xcong/excoin/XchTest.java | 36 ++++++++++++++++++++++++++++++++++-- 1 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/xcong/excoin/XchTest.java b/src/test/java/com/xcong/excoin/XchTest.java index a0244e6..370729f 100644 --- a/src/test/java/com/xcong/excoin/XchTest.java +++ b/src/test/java/com/xcong/excoin/XchTest.java @@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.http.HttpRequest; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.xcong.excoin.modules.coin.parameter.dto.CoinInListDto; import com.xcong.excoin.modules.coin.service.CoinService; @@ -15,10 +16,12 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.util.ClassUtils; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +import java.io.LineNumberReader; import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -34,6 +37,11 @@ @Test public void usdtReturnTest() { xchProfitService.agentUsdtProfitDistributor(); + } + + @Test + public void becomeDy() { + xchProfitService.autoBeAgent(447L); } @Test @@ -102,8 +110,11 @@ } public static void main(String[] args) { - String s = execCurl("https://api2.chiaexplorer.com/blockchainSummary"); - System.out.println(s); +// String s = execCurl("https://api2.chiaexplorer.com/blockchainSummary"); +// System.out.println(s); + + String body = HttpRequest.get("https://api2.chiaexplorer.com/blockchainSummary").execute().body(); + System.out.println(body); } private static String execCurl(String url) { @@ -134,4 +145,25 @@ } return null; } + + @Test + public void pyExec() { + String result = ""; + String path = ClassUtils.getDefaultClassLoader().getResource("").getPath(); + String filePath = path + "static/xch.py"; + System.out.println(filePath); + try { + Process process = Runtime.getRuntime().exec("python " + filePath); + process.waitFor(); + InputStreamReader ir = new InputStreamReader(process.getInputStream()); + LineNumberReader input = new LineNumberReader(ir); + result = input.readLine(); + input.close(); + ir.close(); +// process.waitFor(); + } catch (IOException | InterruptedException e) { + System.out.println(11); + } + System.out.println(result); + } } -- Gitblit v1.9.1