feat(api-keys): 支持独立密钥额度重置(手动+定时自动)

- 新增手动重置接口 PATCH /api/admin/api-keys/{id}/reset-usage
- 前端 ApiKeys 页面增加重置按钮,支持确认后归零已使用额度
- 新增独立密钥额度定时自动重置任务,支持配置周期和执行时间
- 支持 all/selected 两种重置模式,selected 模式可指定密钥
- 移除已废弃的 CleanupScheduler 兼容别名
This commit is contained in:
fawney19
2026-02-26 02:16:48 +08:00
parent 1a1bb0a99c
commit 0ecf8b703e
11 changed files with 646 additions and 17 deletions

View File

@@ -518,6 +518,14 @@ export const adminApi = {
return response.data
},
// 重置独立余额Key的已使用额度
async resetApiKeyUsage(keyId: string): Promise<AdminApiKey & { message: string }> {
const response = await apiClient.patch<AdminApiKey & { message: string }>(
`/api/admin/api-keys/${keyId}/reset-usage`
)
return response.data
},
// 获取API密钥详情可选包含完整密钥
async getApiKeyDetail(keyId: string, includeKey: boolean = false): Promise<AdminApiKey & { key?: string }> {
const response = await apiClient.get<AdminApiKey & { key?: string }>(