添加投注记录
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,8 @@
|
||||
package com.tem.bocai.schedules;
|
||||
|
||||
import com.tem.bocai.service.LoginService;
|
||||
import com.tem.bocai.util.TokenCacheService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@@ -27,11 +29,12 @@ import com.tem.bocai.repository.CompletedTodayRepository;
|
||||
import com.tem.bocai.repository.LoginInfoRepository;
|
||||
import com.tem.bocai.repository.BetRecordRepository;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class BetSchedule {
|
||||
|
||||
@Autowired
|
||||
private LoginService loginService;
|
||||
private TokenCacheService tokenCacheService;
|
||||
|
||||
@Autowired
|
||||
private LoginInfoRepository loginInfoRepository;
|
||||
@@ -174,7 +177,7 @@ public class BetSchedule {
|
||||
HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
|
||||
.uri(URI.create(apiUrl))
|
||||
.header("Content-Type", "application/json")
|
||||
.header("cookie", "token=" + loginService.completedToday());
|
||||
.header("cookie", "token=" + tokenCacheService.getToken());
|
||||
|
||||
HttpRequest request = requestBuilder
|
||||
.POST(HttpRequest.BodyPublishers.ofString(betData))
|
||||
@@ -185,8 +188,9 @@ public class BetSchedule {
|
||||
|
||||
// 解析响应
|
||||
if (response.statusCode() == 200) {
|
||||
JSONObject responseBody = new JSONObject(response.body());
|
||||
return responseBody.getString("result");
|
||||
|
||||
log.info("投注成功");
|
||||
return null;
|
||||
} else {
|
||||
return "error: " + response.statusCode();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class GenBetRecordSchedule {
|
||||
}
|
||||
|
||||
// 每天6:30执行
|
||||
@Scheduled(cron = "0 30 6 * * ?")
|
||||
// @Scheduled(cron = "0 30 6 * * ?")
|
||||
public void processBetPredictions() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String currentTime = now.format(
|
||||
|
||||
Reference in New Issue
Block a user