refactor(account): 移除卡类型字段、优化账号列表查询和权限检查
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m18s

- 移除 IoT 卡和号卡的 card_type 字段(数据库迁移)
- 优化账号列表查询,支持按店铺和企业筛选
- 账号响应增加店铺名称和企业名称字段
- 实现批量加载店铺和企业名称,避免 N+1 查询
- 更新权限检查中间件,完善权限验证逻辑
- 更新相关测试用例,确保功能正确性
This commit is contained in:
2026-02-03 10:59:44 +08:00
parent ad6d43e0cd
commit fba8e9e76b
31 changed files with 409 additions and 145 deletions

View File

@@ -113,6 +113,12 @@ func (s *AccountStore) List(ctx context.Context, opts *store.QueryOptions, filte
if status, ok := filters["status"].(int); ok {
query = query.Where("status = ?", status)
}
if shopID, ok := filters["shop_id"].(uint); ok && shopID > 0 {
query = query.Where("shop_id = ?", shopID)
}
if enterpriseID, ok := filters["enterprise_id"].(uint); ok && enterpriseID > 0 {
query = query.Where("enterprise_id = ?", enterpriseID)
}
// 计算总数
if err := query.Count(&total).Error; err != nil {