From affb22a6376905513e9555c5924e9c5987b16120 Mon Sep 17 00:00:00 2001 From: mzl92 Date: Thu, 27 Aug 2026 16:04:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=94=B9=E5=8C=97=E4=BA=AC=E6=97=B6=E9=97=B4?= =?UTF-8?q?=20Y-m-d=20H:i:s=20=E6=A0=BC=E5=BC=8F(=E6=8A=93=E5=8F=96/?= =?UTF-8?q?=E6=9B=B4=E6=96=B0/=E6=89=93=E6=8B=9B=E5=91=BC=E6=97=B6?= =?UTF-8?q?=E9=97=B4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/smoke.js | 4 +++- server.js | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/smoke.js b/scripts/smoke.js index 1b5b7e3..8fb3f54 100644 --- a/scripts/smoke.js +++ b/scripts/smoke.js @@ -81,7 +81,9 @@ const sleep = (ms) => new Promise(r => setTimeout(r, ms)); console.log('== 5. 候选人详情弹窗 =='); await p.evaluate(() => document.querySelector('#tbody tr')?.click()); await sleep(800); - ok('弹窗打开且含简历全文', (await $('#detailBody').innerText()).includes('简历全文')); + const detText = await $('#detailBody').innerText(); + ok('弹窗打开且含简历全文', detText.includes('简历全文')); + ok('时间格式为 Y-m-d H:i:s', /\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/.test(detText)); await p.screenshot({ path: '/tmp/smoke-shots/03-detail.png' }); await p.evaluate(() => document.getElementById('detailModal').classList.add('hidden')); diff --git a/server.js b/server.js index 4fc512f..7a19e60 100644 --- a/server.js +++ b/server.js @@ -197,6 +197,10 @@ app.get('/api/candidates/:id', requireAuth, (req, res) => { raw_text, education_detail, work_detail, cert_detail, score_details, notes, scraped_at, updated_at FROM candidates WHERE id = ?`).get(req.params.id); if (!row) return res.status(404).json({ error: '不存在' }); + const bj = (s) => s ? new Date(new Date(s).getTime() + 8 * 3600e3).toISOString().slice(0, 19).replace('T', ' ') : s; + row.scraped_at = bj(row.scraped_at); + row.updated_at = bj(row.updated_at); + if (row.greeted_at) row.greeted_at = bj(row.greeted_at); res.json(row); });