From d1e60882ec52178aad707f7808549f0172868b6a Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 28 May 2021 16:40:50 +0800
Subject: [PATCH] 20210528
---
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..129b791 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(444L);
}
@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