调整py脚本
This commit is contained in:
@@ -14,8 +14,8 @@ public class BocaiApplication {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
ApplicationContext context = SpringApplication.run(BocaiApplication.class, args);
|
ApplicationContext context = SpringApplication.run(BocaiApplication.class, args);
|
||||||
|
|
||||||
// BetSchedule betSchedule = context.getBean(BetSchedule.class);
|
BetSchedule betSchedule = context.getBean(BetSchedule.class);
|
||||||
// betSchedule.placeBet();
|
betSchedule.placeBet();
|
||||||
|
|
||||||
// // 依次执行三个任务
|
// // 依次执行三个任务
|
||||||
//
|
//
|
||||||
@@ -25,9 +25,9 @@ public class BocaiApplication {
|
|||||||
// crawlerSchedule.executeLotteryDraw();
|
// crawlerSchedule.executeLotteryDraw();
|
||||||
//
|
//
|
||||||
// 3. 执行ExBetScriptSchedule方法
|
// 3. 执行ExBetScriptSchedule方法
|
||||||
System.out.println("\n=== 开始执行ExBetScriptSchedule任务 ===");
|
// System.out.println("\n=== 开始执行ExBetScriptSchedule任务 ===");
|
||||||
ExBetScriptSchedule exBetScriptSchedule = context.getBean(ExBetScriptSchedule.class);
|
// ExBetScriptSchedule exBetScriptSchedule = context.getBean(ExBetScriptSchedule.class);
|
||||||
exBetScriptSchedule.executePythonScript();
|
// exBetScriptSchedule.executePythonScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,11 @@
|
|||||||
package com.tem.bocai.schedules;
|
package com.tem.bocai.schedules;
|
||||||
|
|
||||||
import com.tem.bocai.service.LoginService;
|
|
||||||
import com.tem.bocai.util.TokenCacheService;
|
import com.tem.bocai.util.TokenCacheService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.http.HttpClient;
|
import java.net.http.HttpClient;
|
||||||
@@ -17,12 +14,9 @@ import java.net.http.HttpResponse;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.JSONTokener;
|
|
||||||
import com.tem.bocai.entity.LoginInfoResult;
|
import com.tem.bocai.entity.LoginInfoResult;
|
||||||
import com.tem.bocai.entity.BetRecord;
|
import com.tem.bocai.entity.BetRecord;
|
||||||
import com.tem.bocai.repository.CompletedTodayRepository;
|
import com.tem.bocai.repository.CompletedTodayRepository;
|
||||||
@@ -135,9 +129,9 @@ public class BetSchedule {
|
|||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
String currentTime = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
String currentTime = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
|
||||||
// 2. 从BetRecord中获取最新的一条记录(根据betTime排序,且betTime大于等于当前时间)
|
// 2. 从BetRecord中获取第一条记录(根据betTime排序)
|
||||||
System.out.println(" - 从BetRecord中获取最新的一条记录...");
|
System.out.println(" - 从BetRecord中获取第一条记录...");
|
||||||
Optional<BetRecord> optionalBetRecord = betRecordRepository.findFirstByBetTimeGreaterThanEqualOrderByBetTimeDesc(currentTime);
|
Optional<BetRecord> optionalBetRecord = betRecordRepository.findFirstByOrderByBetTimeDesc();
|
||||||
|
|
||||||
if (optionalBetRecord.isPresent()) {
|
if (optionalBetRecord.isPresent()) {
|
||||||
BetRecord betRecord = optionalBetRecord.get();
|
BetRecord betRecord = optionalBetRecord.get();
|
||||||
@@ -155,6 +149,12 @@ public class BetSchedule {
|
|||||||
// 记录投注结果
|
// 记录投注结果
|
||||||
System.out.println(" - 记录投注结果...");
|
System.out.println(" - 记录投注结果...");
|
||||||
recordBetResult(betData, betResult);
|
recordBetResult(betData, betResult);
|
||||||
|
|
||||||
|
// 投注成功后删除BetRecord记录
|
||||||
|
if (betResult == null) {
|
||||||
|
betRecordRepository.delete(betRecord);
|
||||||
|
System.out.println(" - 已删除投注记录,期数: " + betRecord.getBetNum());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println(" - 未找到投注记录");
|
System.out.println(" - 未找到投注记录");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ public class ExBetScriptSchedule {
|
|||||||
|
|
||||||
// 设置固定字段
|
// 设置固定字段
|
||||||
betObject.put("amount", 1);
|
betObject.put("amount", 1);
|
||||||
|
// betObject.put("amount", value);
|
||||||
betObject.put("odds", 9.599);
|
betObject.put("odds", 9.599);
|
||||||
|
|
||||||
// 设置标题
|
// 设置标题
|
||||||
|
|||||||
Reference in New Issue
Block a user