diff --git "a/docs/\351\241\271\347\233\256\351\227\256\351\242\230\345\244\215\346\237\245\346\212\245\345\221\212-2026-09-18.md" "b/docs/\351\241\271\347\233\256\351\227\256\351\242\230\345\244\215\346\237\245\346\212\245\345\221\212-2026-09-18.md" new file mode 100644 index 0000000..dfe91c0 --- /dev/null +++ "b/docs/\351\241\271\347\233\256\351\227\256\351\242\230\345\244\215\346\237\245\346\212\245\345\221\212-2026-09-18.md" @@ -0,0 +1,77 @@ +# BITerStore 项目问题复查报告 + +复查日期:2026-09-18(UTC+8) + +复查依据:`项目交接文档.md`、`项目现状复查与问题清单-2026-09-17.md`、`问题修复记录-2026-09-18.md`、`部署验收记录-2026-09-18.md`、`TODO.md` 以及当前工作区代码。 + +## 结论 + +当前代码已经覆盖交接文档中 C01–C09 的主要修复,H5 和微信小程序的本地 lint、类型检查及测试均通过。本次用户反馈的“审核通过通知堆叠”也已定位并修复:消息首页不再逐条渲染审核通知,而是按四个通知分类聚合;分类详情仍保留完整通知明细。 + +项目暂不建议仅凭本地测试视为全部完成。剩余风险主要集中在真实账号/真机联调、并发与恢复演练、CI 首次运行、R2 运维配置和微信平台发布验收。 + +## 本次发现与处理 + +| 编号 | 问题 | 当前状态 | 影响 | +| --- | --- | --- | --- | +| N01 | 消息首页逐条展示系统通知,多个商品审核后卡片大量堆叠 | 已修复 | 首页现在按“赞与收藏、评论与回复、系统通知、新的关注”聚合,并合并未读数量;详情页仍显示每条通知 | +| N02 | 真实私有媒体成功读取尚未完成真机联调 | 待验证 | 未登录 401 检查不能证明登录后的图片下载、缓存和账号切换都正常 | +| N03 | 真实 R2 并发上传、取消、重复完成请求尚未在生产凭据下验证 | 待验证 | 上传高并发或网络中断时仍需要确认幂等、清理和最终对象一致性 | +| N04 | 已读游标并发保护缺少真实 PostgreSQL 压力验证 | 待验证 | 低序号请求与高序号请求并发时,需要确认不会回退阅读进度 | + +## 交接文档中仍未闭环的事项 + +### P0:上线前必须完成 + +1. 合并 PR 并完成合并后的生产门禁和回归验收。 +2. 为本地到 R2 的备份失败增加独立监控、告警和责任人。 +3. 在隔离环境完成 PostgreSQL、R2、BIT-Login SQLite 和生产配置的恢复演练,并保留可审计记录。 +4. 完成真实微信设备登录、授权、扫码、上传、发布、聊天和返回栈验收;目前只完成开发者工具或模拟器链路,未执行上传、提审或发布。 + +### P1:近期运营前完成 + +1. 配置并验证 Cloudflare WAF、Bot 防护、公开列表限流和异常流量告警。 +2. 配置 R2 `pending/` 生命周期清理、异地灾备和恢复责任边界。 +3. 建立 readiness、延迟、Redis/数据库连接、磁盘容量和备份失败监控。 +4. 验证动态上游解析、CSP/favicon 提示以及 Nginx 重建后的自动恢复能力。 +5. 完成首次 GitHub Actions 执行和分支保护必需检查;当前不能把本地或服务器隔离环境结果等同于 GitHub CI 已通过。 + +### P2:功能和体验补齐 + +1. 完成商品治理第二阶段:退回修改、重新提交、审核轮次和完整商品生命周期时间线。 +2. 完成真实私有图片上传、下载、下架、封禁、退出和切换账号场景的真机验证。 +3. 复核 Cookie transport 的跨站域名和 CSRF 策略。 +4. 统计 Open Library 中文教材覆盖率,决定是否增加备用书目源或本地识别兜底。 +5. 评估 Taro/Webpack 传递依赖 advisory,保持当前锁定版本,禁止用 `npm audit fix --force` 绕过兼容性约束。 +6. 补齐聊天图片消息和商品链接分享等仍显示“暂未开放”的功能,或在产品范围中明确排除。 + +## 已完成但需要区分“代码修复”和“外部验收”的事项 + +- C01–C09 已有代码修复和回归测试记录,包括商品复审、上传一致性、恢复脚本、默认昵称、旧会话、私有媒体、已读游标、禁言会话和启动入口。 +- 公开商品、媒体状态过滤、认证失效、刷新令牌竞争、管理员 TOTP 限流、举报幂等、上传魔数校验和安全响应头已有代码或隔离环境验证。 +- 上述结果不能替代真实 R2、真实账号、真实微信设备、生产压力和灾备恢复验证。 + +## 本轮本地验证 + +在现有 Node 22.13.1 环境中执行: + +- Web lint:通过 +- Web 测试:48 项通过 +- MiniProgram lint:通过 +- MiniProgram typecheck:通过 +- MiniProgram 测试:52 项通过 +- `git diff --check`:通过(工作区另有交接文档历史改动和 `Assets/generated/` 未跟随本次功能修改) + +## 建议执行顺序 + +1. 先在测试账号验证本次消息首页四类聚合和详情已读状态。 +2. 再完成真实媒体、审核并发、已读并发和 R2 上传取消场景。 +3. 随后处理备份恢复、监控告警、Cloudflare 和 GitHub Actions 门禁。 +4. 最后进行微信真机验收,再决定是否提审或发布。 + +## 本次执行记录(18:48–18:49) + +- Server:28 个测试文件、178 项测试通过;生产构建通过。 +- Web:生产构建通过。 +- MiniProgram:H5 构建通过,产物入口约 378 KiB;构建过程只有 Webpack 缓存序列化提示,没有编译错误。 +- 仍未执行:真实 R2/生产账号并发验证、PostgreSQL 压力验证、微信真机授权与私有图片验证、GitHub Actions 线上运行、生产发布或提审。 diff --git a/miniProgram/src/pages/messages/index.tsx b/miniProgram/src/pages/messages/index.tsx index 1df309f..eb80cec 100644 --- a/miniProgram/src/pages/messages/index.tsx +++ b/miniProgram/src/pages/messages/index.tsx @@ -13,6 +13,15 @@ import { navigationAdapter } from '@/platform' const noticeGlyphs: Record = { like: 'heart', comment: 'message', system: 'bell', follow: 'user' } +function summarizeNotifications(items: Notification[]): Notification[] { + const labels: Record = { like: ['赞与收藏', '暂无新的赞与收藏'], comment: ['评论与回复', '暂无新的评论与回复'], system: ['系统通知', '暂无新的系统通知'], follow: ['新的关注', '暂无新的关注'] } + return (['like', 'comment', 'system', 'follow'] as const).map((type) => { + const group = items.filter((item) => item.type === type) + const latest = group[0] + return { id: `summary-${type}`, type, title: labels[type][0], subtitle: latest?.subtitle || labels[type][1], unread: group.reduce((total, item) => total + item.unread, 0), createdAt: latest?.createdAt } + }) +} + export default function MessagesPage() { const [threads, setThreads] = useState(() => demoRepository.peekThreads() || []) const [notices, setNotices] = useState(() => demoRepository.peekNotifications() || []) @@ -20,8 +29,9 @@ export default function MessagesPage() { const [loadingMore, setLoadingMore] = useState(false) const load = useCallback(() => { void demoRepository.listThreadsPage().then((page) => { setThreads((current) => preserveSnapshot(current, page.items)); setNextCursor(page.nextCursor) }); void demoRepository.listNotifications().then((next) => setNotices((current) => preserveSnapshot(current, next))) }, []) useDidShow(() => { void requireAccount('登录后才能查看消息').then((allowed) => { if (allowed) return load() }) }) + const summaries = summarizeNotifications(notices) return - {notices.map((notice) => )} + {summaries.map((notice) => )} 私聊消息✓ 站内消息 {threads.map((thread) => { const user = thread.participant || getUser(thread.participantId); const last = thread.messages.at(-1); const campus = user.campus === '未设置' ? '校区未设置' : `${user.campus}校区`; return })} {nextCursor && } diff --git a/web/app/components/mobile-app.tsx b/web/app/components/mobile-app.tsx index f7f5f67..4ae6fdb 100644 --- a/web/app/components/mobile-app.tsx +++ b/web/app/components/mobile-app.tsx @@ -587,7 +587,17 @@ function MessagesPage({ navigate }: { navigate: (to: string) => void }) { const [threads, setThreads] = useState(() => peekThreads() || []); const [items, setItems] = useState(() => peekNotifications() || []); const [nextCursor, setNextCursor] = useState(null); const [loadingMore, setLoadingMore] = useState(false); useEffect(() => { void demoRepository.listThreadsPage().then((page) => { const next = page.items; setThreads((current) => preserveSnapshot(current, next)); setNextCursor(page.nextCursor); }).catch(() => undefined); void demoRepository.listNotifications().then((next) => setItems((current) => preserveSnapshot(current, next))).catch(() => undefined); }, []); const loadMore = async () => { if (!nextCursor || loadingMore) return; setLoadingMore(true); try { const page = await demoRepository.listThreadsPage(nextCursor); setThreads(page.items); setNextCursor(page.nextCursor); } finally { setLoadingMore(false); } }; - return
{items.map((item) => { const Icon = { like: Heart, comment: MessageCircle, system: Bell, follow: UserRound }[item.type]; return ; })}

私聊消息

站内消息
{threads.map((thread) => { const user = thread.participant || getUser(thread.participantId); const last = thread.messages.at(-1); return ; })}
{nextCursor && }{threads.length === 0 &&
暂无私聊消息

还没有私聊消息

从一本感兴趣的书开始聊聊吧。

}
Tobby 消息提醒Tobby 提醒:及时回复消息,能提升成交率哦~
; + const notices = summarizeNotifications(items); + return
{notices.map((item) => { const Icon = { like: Heart, comment: MessageCircle, system: Bell, follow: UserRound }[item.type]; return ; })}

私聊消息

站内消息
{threads.map((thread) => { const user = thread.participant || getUser(thread.participantId); const last = thread.messages.at(-1); return ; })}
{nextCursor && }{threads.length === 0 &&
暂无私聊消息

还没有私聊消息

从一本感兴趣的书开始聊聊吧。

}
Tobby 消息提醒Tobby 提醒:及时回复消息,能提升成交率哦~
; +} + +function summarizeNotifications(items: Notification[]): Notification[] { + const labels: Record = { like: ['赞与收藏', '暂无新的赞与收藏'], comment: ['评论与回复', '暂无新的评论与回复'], system: ['系统通知', '暂无新的系统通知'], follow: ['新的关注', '暂无新的关注'] }; + return (['like', 'comment', 'system', 'follow'] as const).map((type) => { + const group = items.filter((item) => item.type === type); + const latest = group[0]; + return { id: `summary-${type}`, type, title: labels[type][0], subtitle: latest?.subtitle || labels[type][1], unread: group.reduce((total, item) => total + item.unread, 0), createdAt: latest?.createdAt }; + }); } function NotificationDetailPage({ type, navigate }: { type: string; navigate: (to: string) => void }) {