feat: 允许管理员为持有有效订阅的用户绑定订阅类型分组

之前管理员无法通过 API 密钥管理将用户绑定到订阅类型分组(直接返回错误)。
现在改为检查用户是否持有该分组的有效订阅,有则允许绑定,无则拒绝。

- admin_service: 新增 userSubRepo 依赖,替换硬拒绝为订阅校验
- admin_service: 区分 ErrSubscriptionNotFound 和内部错误,避免 DB 故障被误报
- wire_gen/api_contract_test: 同步新增参数
- UserApiKeysModal: 管理员分组下拉不再过滤订阅类型分组

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ischanx
2026-03-10 00:51:43 +08:00
parent c8eff34388
commit 767a41e263
4 changed files with 13 additions and 6 deletions

View File

@@ -162,8 +162,7 @@ const load = async () => {
const loadGroups = async () => {
try {
const groups = await adminAPI.groups.getAll()
// 过滤掉订阅类型分组(需通过订阅管理流程绑定)
allGroups.value = groups.filter((g) => g.subscription_type !== 'subscription')
allGroups.value = groups
} catch (error) {
console.error('Failed to load groups:', error)
}