Files
Neo 6f8f12314f feat: 累积功能变更 — 聊天集成、租户管理、小程序更新、ETL 增强、迁移脚本
包含多个会话的累积代码变更:
- backend: AI 聊天服务、触发器调度、认证增强、WebSocket、调度器最小间隔
- admin-web: ETL 状态页、任务管理、调度配置、登录优化
- miniprogram: 看板页面、聊天集成、UI 组件、导航更新
- etl: DWS 新任务(finance_area_daily/board_cache)、连接器增强
- tenant-admin: 项目初始化
- db: 19 个迁移脚本(etl_feiqiu 11 + zqyy_app 8)
- packages/shared: 枚举和工具函数更新
- tools: 数据库工具、报表生成、健康检查
- docs: PRD/架构/部署/合约文档更新

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-06 00:03:48 +08:00

3.2 KiB
Raw Permalink Blame History

P7→NS1/RNS1 缺失项 #7服务记录按天归总的展示格式

简要结论

  • 状态:⚠️ 部分解决
  • 风险等级:🟠
  • 后端 DateGroup 结构完整,日期标签格式为 M月D日(如"3月15日"但缺少星期信息P7 定义的"3月15日 周五"格式);前端直接透传后端 date 字段(YYYY-MM-DD 格式),未做二次格式化。

详细审查

审查范围

  • apps/backend/app/schemas/xcx_performance.py — DateGroup / DateGroupRecord 模型
  • apps/backend/app/services/performance_service.pygroup_records_by_date()_format_date_label()
  • apps/miniprogram/miniprogram/pages/performance-records/performance-records.wxml — 日期标签渲染
  • apps/miniprogram/miniprogram/pages/performance/performance.wxml — 日期标签渲染
  • docs/miniprogram-dev/design-system/DATETIME-DISPLAY-STANDARD.md — 日期展示规范

发现

  1. 后端 DateGroup 结构已定义且完整DateGroup 包含 datetotal_hourstotal_incomerecords 四个字段,DateGroupRecord 包含客户名、时间范围、课时、课程类型、地点、收入等完整字段。

  2. 后端 _format_date_label() 格式为 M月D日:该函数输出如 3月15日,但不包含星期信息。然而实际上 group_records_by_date()date 字段使用的是 YYYY-MM-DD 格式的 date_key,并未调用 _format_date_label()

  3. _format_date_label() 未被 group_records_by_date() 使用group_records_by_date() 直接将 date_keyYYYY-MM-DD)赋值给 date 字段,_format_date_label() 函数虽然存在但未在 DateGroup 构建中被调用。

  4. 前端直接渲染后端返回的 date 字段WXML 中 {{item.date}} 直接展示,未做格式化。因此用户看到的是 2026-03-15 而非 3月15日 周五

  5. 设计规范文档 DATETIME-DISPLAY-STANDARD.md 定义的是相对时间规范(刚刚/N分钟前/N天前/日期),不涉及"M月D日 周X"这种绝对日期+星期的格式。

证据

后端 group_records_by_date() 中日期赋值performance_service.py:130

result.append({
    "date": date_key,  # date_key = settle_time.strftime("%Y-%m-%d")
    "total_hours": f"{total_hours:g}",
    "total_income": f"{total_income:.2f}",
    "records": recs,
})

后端 _format_date_label() 存在但未被 DateGroup 使用performance_service.py:188

def _format_date_label(dt) -> str:
    """格式化日期为 "M月D日" 格式。"""
    if hasattr(dt, "strftime"):
        return f"{dt.month}{dt.day}日"

前端直接渲染performance-records.wxml

<text decode class="dd-date">{{item.date}}&nbsp;&nbsp;</text>

建议

  1. 后端:在 group_records_by_date() 中将 date 字段改为调用 _format_date_label() 并追加星期信息,格式为 M月D日 周X(如"3月15日 周五")。或新增 date_label 字段保留格式化后的展示文本,date 保留 YYYY-MM-DD 用于排序。
  2. 前端:如果后端不改,前端可在 WXS 中增加日期格式化函数,将 YYYY-MM-DD 转为 M月D日 周X
  3. 设计规范:在 DATETIME-DISPLAY-STANDARD.md 中补充"按天归总场景"的日期标签格式规范(M月D日 周X)。