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-cards` - `POST /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 - [x] `allocate-cards` 接口接受 `selection_type=list` + `iccids`,行为与改动前一致 - [x] `allocate-cards` 接口接受 `selection_type=range` + 号段,批量授权号段内所有匹配的卡 - [x] `allocate-cards` 接口接受 `selection_type=filter` + 过滤条件,批量授权所有匹配的卡 - [x] `recall-cards` 接口同样支持三种模式,分别正确收回对应卡的企业授权 - [x] filter/range 模式下代理用户只能操作自己店铺的卡,超出范围的卡进入失败列表 - [x] 任何模式下尝试授权"已授权给其他企业"的卡,该卡进入失败列表并附带原因 - [x] 响应中 `success_count`、`fail_count`、`failed_items` 准确反映实际执行结果 ## Blocked by - `issues/01-card-enterprise-auth-unique-constraint.md`