调整金额

This commit is contained in:
2026-01-29 17:54:53 +08:00
parent eaccc78eff
commit 97adad8d28
9 changed files with 63 additions and 50 deletions

View File

@@ -17,7 +17,7 @@ public class BocaiApplication {
// // 依次执行三个任务
//
// // 1. 执行CrawlerSchedule方法
// 1. 执行CrawlerSchedule方法
System.out.println("\n=== 开始执行CrawlerSchedule任务 ===");
CrawlerSchedule crawlerSchedule = context.getBean(CrawlerSchedule.class);
crawlerSchedule.executeLotteryDraw();

View File

@@ -12,7 +12,7 @@ public class TessConfig {
Tesseract instance = new Tesseract();
instance.setLanguage("oci"); // 设置语言包,这里使用英语
instance.setDatapath("src/main/resources/tessdata"); // 设置语言包路径
instance.setDatapath("tessdata"); // 设置语言包路径
return instance;
}
}

View File

@@ -2,6 +2,7 @@ package com.tem.bocai.schedules;
import com.tem.bocai.util.TokenCacheService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -142,7 +143,7 @@ public class BetSchedule {
// 调用投注接口
System.out.println(" - 提交投注...");
String betResult = callBetApi(betData, loginInfo);
String betResult = callBetApi(betData, null);
System.out.println(" - 投注结果: " + betResult);
// 记录投注结果
@@ -167,7 +168,7 @@ public class BetSchedule {
/**
* 调用投注接口
*/
private String callBetApi(String betData, LoginInfoResult loginInfo) throws IOException, InterruptedException {
private String callBetApi(String betData, String token) throws IOException, InterruptedException {
// 假设投注接口地址为http://localhost:8080/api/bet
String apiUrl = "https://4701268539-esh.qdk63ayw8g.com/member/bet";
@@ -176,7 +177,7 @@ public class BetSchedule {
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
.uri(URI.create(apiUrl))
.header("Content-Type", "application/json")
.header("cookie", "token=" + tokenCacheService.getToken());
.header("cookie", "token=" + (StringUtils.isBlank(token)?tokenCacheService.getToken():token));
HttpRequest request = requestBuilder
.POST(HttpRequest.BodyPublishers.ofString(betData))
@@ -187,10 +188,14 @@ public class BetSchedule {
// 解析响应
if (response.statusCode() == 200) {
log.info("投注成功");
return null;
} else {
}else if (response.statusCode() == 302){
String tokenSqlite = tokenCacheService.getTokenSqlite();
callBetApi(betData, tokenSqlite);
return null;
}
else {
return "error: " + response.statusCode();
}
}