koishi-plugin-tmp-bot 1.21.1 → 1.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -285,6 +285,45 @@ function setData(apiData) {
285
285
 
286
286
  listEl.innerHTML = '';
287
287
 
288
+ // === DEBUG: 诊断信息输出到页面 ===
289
+ const debugEl = document.createElement('div');
290
+ debugEl.id = 'debug-info';
291
+ debugEl.style.cssText = 'color:#0f0;font-size:11px;padding:6px 10px;background:#111;margin:4px 10px;border-radius:4px;font-family:monospace;white-space:pre-wrap;';
292
+ listEl.appendChild(debugEl);
293
+
294
+ const dbg = [];
295
+ dbg.push('now=' + Date.now() + ' new Date=' + new Date().toISOString());
296
+ dbg.push('timezone=' + Intl.DateTimeFormat().resolvedOptions().timeZone);
297
+ dbg.push('offset(min)=' + new Date().getTimezoneOffset());
298
+
299
+ const first = servers[0];
300
+ if (first && first.playerHistory && first.playerHistory.length > 0) {
301
+ const sample = first.playerHistory[0];
302
+ dbg.push('sample.updateTime=' + JSON.stringify(sample.updateTime));
303
+ const replaced = sample.updateTime.replace(' ', 'T');
304
+ dbg.push('replaced=' + replaced);
305
+ dbg.push('new Date(str).getTime()=' + new Date(replaced).getTime());
306
+ dbg.push('new Date(str)=' + new Date(replaced).toISOString());
307
+
308
+ // 手动解析
309
+ const [datePart, timePart] = sample.updateTime.trim().replace('T', ' ').split(' ');
310
+ const [y, m, d] = datePart.split('-').map(Number);
311
+ const parts = timePart.split(':').map(Number);
312
+ const h = parts[0] || 0, min = parts[1] || 0;
313
+ const manualTs = new Date(y, m - 1, d, h, min, 0).getTime();
314
+ dbg.push('manual parse: y=' + y + ' m=' + m + ' d=' + d + ' h=' + h + ' min=' + min);
315
+ dbg.push('manualTs=' + manualTs + ' ISO=' + new Date(manualTs).toISOString());
316
+
317
+ // normalizeHistory 结果
318
+ const normalized = normalizeHistory(first.playerHistory);
319
+ const nonZero = normalized.filter(v => v !== 0);
320
+ dbg.push('normalized.len=' + normalized.length + ' nonZero=' + nonZero.length);
321
+ dbg.push('first5=' + JSON.stringify(normalized.slice(0, 5)));
322
+ dbg.push('last5=' + JSON.stringify(normalized.slice(-5)));
323
+ }
324
+ debugEl.innerText = dbg.join('\n');
325
+ // === END DEBUG ===
326
+
288
327
  servers.forEach(server => {
289
328
  listEl.appendChild(createServerCard(server));
290
329
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-tmp-bot",
3
3
  "description": "欧洲卡车模拟2 TMP查询插件,不会部署的可以直接使用此机器人->QQ:3523283907",
4
- "version": "1.21.1",
4
+ "version": "1.21.2",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "homepage": "https://github.com/79887143/koishi-plugin-tmp-bot",