fix: since 用本地时间格式 'YYYY-MM-DD HH:MM:SS' 匹配 MySQL datetime
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -6,6 +6,7 @@ let autoDone = 0;
|
||||
let autoFailed = 0;
|
||||
let autoRemaining = 0;
|
||||
let autoStartTime = "";
|
||||
let localSinceStr = "";
|
||||
let pollInterval = null;
|
||||
let timeoutTimers = {}; // record_id → timer
|
||||
const TIMEOUT_MS = 10000;
|
||||
@@ -48,7 +49,15 @@ async function startAuto() {
|
||||
autoDone = 0;
|
||||
autoFailed = 0;
|
||||
autoRemaining = count;
|
||||
autoStartTime = new Date().toISOString(); // 记录开始时间
|
||||
autoStartTime = new Date().toISOString(); // 记录开始时间 (UTC)
|
||||
// MySQL 存的是本地时间,需要转本地格式传给后端过滤
|
||||
const now = new Date();
|
||||
localSinceStr = now.getFullYear() + "-" +
|
||||
String(now.getMonth() + 1).padStart(2, "0") + "-" +
|
||||
String(now.getDate()).padStart(2, "0") + " " +
|
||||
String(now.getHours()).padStart(2, "0") + ":" +
|
||||
String(now.getMinutes()).padStart(2, "0") + ":" +
|
||||
String(now.getSeconds()).padStart(2, "0");
|
||||
|
||||
// 显示开始时间
|
||||
document.getElementById("auto-time").style.display = "block";
|
||||
@@ -114,7 +123,7 @@ async function pollProgress() {
|
||||
if (!autoRunning) return;
|
||||
|
||||
try {
|
||||
const resp = await fetch(`/api/automation/${DNT_ID}/progress?since=${encodeURIComponent(autoStartTime)}`);
|
||||
const resp = await fetch(`/api/automation/${DNT_ID}/progress?since=${encodeURIComponent(localSinceStr)}`);
|
||||
const data = await resp.json();
|
||||
const stats = data.stats;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user