修复代码审查反馈:使用 Intl.DateTimeFormat、提取常量、改进错误日志

Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-09 09:16:58 +00:00
parent 7bd40b3e9a
commit f79ead0e71
2 changed files with 17 additions and 9 deletions

View File

@ -63,6 +63,7 @@
<!-- BULLETIN_START -->
| 时间 | 事件 | 详情 |
|------|------|------|
| 03-09 17:15 | 📦 铸渊 (Copilot) | 模块更新: `scripts/` |
| 03-09 17:01 | 📦 铸渊 (ZhùYuān) | 模块更新: `backend-integration/` |
| 03-09 17:01 | 📦 铸渊 (ZhùYuān) | 模块更新: `backend/` |
| 03-09 17:01 | 📦 铸渊 (ZhùYuān) | 模块更新: `cloud-drive/` |
@ -80,7 +81,6 @@
| 03-09 17:01 | 📦 铸渊 (ZhùYuān) | 模块更新: `m15-cloud-drive/` |
| 03-09 17:01 | 📦 铸渊 (ZhùYuān) | 模块更新: `m18-health-check/` |
| 03-09 17:01 | 📦 铸渊 (ZhùYuān) | 模块更新: `notification/` |
| 03-09 17:01 | 📦 铸渊 (ZhùYuān) | 模块更新: `scripts/` |
| 03-09 17:01 | 📦 铸渊 (ZhùYuān) | 模块更新: `status-board/` |
| 03-09 17:01 | 📦 铸渊 (ZhùYuān) | 模块更新: `ticket-system/` |
<!-- BULLETIN_END -->

View File

@ -20,6 +20,7 @@ const MEMORY_PATH = path.join(__dirname, '..', '.github', 'brain', 'memory.json'
const BULLETIN_START = '<!-- BULLETIN_START -->';
const BULLETIN_END = '<!-- BULLETIN_END -->';
const MAX_ENTRIES = 20;
const MAX_GIT_LOG_COMMITS = 30;
/* ── 开发者名册 ─────────────────────────── */
const DEV_MAP = {
@ -54,12 +55,17 @@ function formatTime(ts) {
if (!ts) return '—';
const d = new Date(ts);
if (isNaN(d.getTime())) return ts;
const bj = new Date(d.getTime() + 8 * 3600000);
const mm = String(bj.getUTCMonth() + 1).padStart(2, '0');
const dd = String(bj.getUTCDate()).padStart(2, '0');
const hh = String(bj.getUTCHours()).padStart(2, '0');
const mi = String(bj.getUTCMinutes()).padStart(2, '0');
return `${mm}-${dd} ${hh}:${mi}`;
const fmt = new Intl.DateTimeFormat('zh-CN', {
timeZone: 'Asia/Shanghai',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
hour12: false,
});
const parts = fmt.formatToParts(d);
const get = (type) => (parts.find(p => p.type === type) || {}).value || '';
return `${get('month')}-${get('day')} ${get('hour')}:${get('minute')}`;
}
function statusIcon(result) {
@ -177,7 +183,7 @@ function detectRecentModulePushes() {
try {
const log = execSync(
'git log --oneline --name-only --since="7 days ago" -30 2>/dev/null || true',
`git log --oneline --name-only --since="7 days ago" -${MAX_GIT_LOG_COMMITS} 2>/dev/null || true`,
{ encoding: 'utf8', cwd: path.join(__dirname, '..') }
);
@ -219,7 +225,9 @@ function detectRecentModulePushes() {
detail: `模块更新: \`${mod}/\``,
sortKey: new Date(ts).getTime(),
});
} catch (_) { /* skip */ }
} catch (err) {
console.log(`⚠️ 读取模块 ${mod} 提交信息失败: ${err.message}`);
}
}
} catch (err) {
console.log(`⚠️ Git 日志读取失败: ${err.message}`);