All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m9s
- 企业卡授权唯一约束:新增 DB 迁移(000154),卡级部分唯一索引防止同一张卡被多个企业同时持有,Service 层新增跨企业冲突检测 - 单卡列表新增 network_status 过滤参数 - 单卡/设备列表新增 asset_status、asset_status_name、generation 响应字段 - 单卡/设备列表新增企业维度过滤(authorized_enterprise_id、is_authorized_to_enterprise)及响应中企业授权信息(批量加载,无 N+1) - 主钱包流水/退款列表新增 asset_identifier 精确过滤参数 - 企业卡授权/收回接口升级为三模式(list/range/filter),企业设备授权/收回升级为双模式(list/filter) - 升级 sonic v1.14.2 → v1.15.2 以兼容 Go 1.26 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.1 KiB
2.1 KiB
Status: ready-for-human
Parent
.scratch/enterprise-auth-and-asset-enhancements/PRD.md
What to build
将企业卡授权和收回接口升级为支持 list/range/filter 三种模式批量选取卡,替代原来只接受精确 ICCID 列表的方式。
涉及接口:
POST /api/admin/enterprises/{id}/allocate-cardsPOST /api/admin/enterprises/{id}/recall-cards
AllocateCardsReq 重构为:
selection_type string(必填,list、range或filter)- list 模式:
iccids []string(ICCID 列表,最多1000个) - range 模式:
iccid_start string+iccid_end string(号段范围) - filter 模式过滤字段:
iccid string(模糊)、batch_no string、carrier_id *uint、shop_id *uint、shop_ids []uint remark string(备注,所有模式均可选)
RecallCardsReq 重构为:
selection_type string(必填,list、range或filter)- list 模式:
iccids []string - range 模式:
iccid_start string+iccid_end string - filter 模式过滤字段:
iccid string(模糊)、batch_no string、carrier_id *uint
filter 和 range 模式下,allocate 操作的候选卡集受操作者权限约束(代理用户只能授权自己店铺的卡),与 applyStandaloneFilters 中的 ApplyShopFilter 逻辑保持一致。
Acceptance criteria
allocate-cards接口接受selection_type=list+iccids,行为与改动前一致allocate-cards接口接受selection_type=range+ 号段,批量授权号段内所有匹配的卡allocate-cards接口接受selection_type=filter+ 过滤条件,批量授权所有匹配的卡recall-cards接口同样支持三种模式,分别正确收回对应卡的企业授权- filter/range 模式下代理用户只能操作自己店铺的卡,超出范围的卡进入失败列表
- 任何模式下尝试授权"已授权给其他企业"的卡,该卡进入失败列表并附带原因
- 响应中
success_count、fail_count、failed_items准确反映实际执行结果
Blocked by
issues/01-card-enterprise-auth-unique-constraint.md