Files
junhong_cmp_fiber/openspec/changes/archive/2026-04-17-fix-fund-summary-primary-account/tasks.md
huang 4aab0bcbf2
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m39s
提案以及归档
2026-04-18 09:10:29 +08:00

1.2 KiB
Raw Blame History

1. 修复店铺创建逻辑

  • 1.1 在 internal/service/shop/service.goCreate 方法中,找到 account := &model.Account{...} 的赋值块,添加 IsPrimary: true 字段
  • 1.2 运行 lsp_diagnostics 确认 shop/service.go 无错误

2. 数据库迁移(历史数据修复)

  • 2.1 在 migrations/ 目录创建迁移文件,包含以下 UP SQL对每个 shop 取 created_at 最早的代理账号(user_type = 3, deleted_at IS NULL)执行 UPDATE tb_account SET is_primary = true WHERE id = <earliest_id> AND is_primary = false
  • 2.2 执行迁移,使用 PostgreSQL MCP 验证:查询 SELECT shop_id, COUNT(*) as primary_count FROM tb_account WHERE is_primary = true AND deleted_at IS NULL GROUP BY shop_id,确认每个 shop 有且仅有一条 is_primary = true 的账号

3. 接口验证

  • 3.1 使用 PostgreSQL MCP 验证:SELECT username, phone FROM tb_account WHERE is_primary = true AND deleted_at IS NULL,确认用户名和手机号均非空
  • 3.2 调用 GET /api/admin/shops/fund-summary?page=1&page_size=20,验证响应中每条记录的 usernamephone 字段均返回正确值(非空)