All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m39s
1.2 KiB
1.2 KiB
1. 修复店铺创建逻辑
- 1.1 在
internal/service/shop/service.go的Create方法中,找到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,验证响应中每条记录的username和phone字段均返回正确值(非空)