diff --git a/backend/routes/feishu.js b/backend/routes/feishu.js index 687cdc80..3450048d 100644 --- a/backend/routes/feishu.js +++ b/backend/routes/feishu.js @@ -117,9 +117,9 @@ router.post('/syslog-receive', async (req, res) => { }); } - const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19); - const safeDevId = String(devId).replace(/[^a-zA-Z0-9_-]/g, ''); - const filename = `SYSLOG-${safeDevId}-${timestamp}.json`; + const timestampStr = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19); + const safeDevId = String(devId).replace(/[^a-zA-Z0-9_-]/g, ''); + const filename = `SYSLOG-${safeDevId}-${timestampStr}.json`; const filePath = `syslog-inbox/${filename}`; const content = Buffer.from(JSON.stringify(syslog, null, 2)).toString('base64'); diff --git a/scripts/bridge/fetch-broadcast.js b/scripts/bridge/fetch-broadcast.js index 1420573a..5e05326c 100644 --- a/scripts/bridge/fetch-broadcast.js +++ b/scripts/bridge/fetch-broadcast.js @@ -137,7 +137,7 @@ async function getPageTitle(pageId, token) { return props[key].title.map(t => t.plain_text).join(''); } } - return 'Untitled'; + return '未命名广播'; } // ══════════════════════════════════════════════════════════ diff --git a/scripts/bridge/upload-pdf.js b/scripts/bridge/upload-pdf.js index a897d09e..d5f8e071 100644 --- a/scripts/bridge/upload-pdf.js +++ b/scripts/bridge/upload-pdf.js @@ -22,6 +22,7 @@ const fs = require('fs'); const path = require('path'); const OUTPUT_DIR = path.join('data', 'broadcasts', 'pdf'); +const SITE_BASE_URL = 'https://guanghulab.com'; // ══════════════════════════════════════════════════════════ // 上传模式 @@ -49,10 +50,10 @@ async function uploadToServer(pdfFiles) { const filename = path.basename(pdfPath); const destPath = path.join(serverDir, filename); + const downloadUrl = `${SITE_BASE_URL}/broadcasts/${filename}`; if (isCI) { // CI 环境:仅记录,由部署脚本负责实际复制 - const downloadUrl = `https://guanghulab.com/broadcasts/${filename}`; results.push({ ...item, download_url: downloadUrl }); console.log(` 📋 ${filename} → ${downloadUrl} (CI模式·待部署)`); } else { @@ -61,7 +62,6 @@ async function uploadToServer(pdfFiles) { fs.mkdirSync(serverDir, { recursive: true }); } fs.copyFileSync(pdfPath, destPath); - const downloadUrl = `https://guanghulab.com/broadcasts/${filename}`; results.push({ ...item, download_url: downloadUrl }); console.log(` ✅ ${filename} → ${destPath}`); } catch (e) {