This commit is contained in:
50
src/api/modules/pollingConcurrency.ts
Normal file
50
src/api/modules/pollingConcurrency.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* 轮询并发控制 API
|
||||
*/
|
||||
import { BaseService } from '../BaseService'
|
||||
import type { BaseResponse } from '@/types/api'
|
||||
import type {
|
||||
PollingConcurrency,
|
||||
PollingConcurrencyListResponse,
|
||||
UpdateConcurrencyParams,
|
||||
ResetConcurrencyParams
|
||||
} from '@/types/api/pollingConcurrency'
|
||||
|
||||
/**
|
||||
* 轮询并发控制服务
|
||||
*/
|
||||
export class PollingConcurrencyService extends BaseService {
|
||||
/**
|
||||
* 获取轮询并发配置列表
|
||||
* @returns 并发配置列表
|
||||
*/
|
||||
static getConcurrencyList(): Promise<BaseResponse<PollingConcurrencyListResponse>> {
|
||||
return this.get<BaseResponse<PollingConcurrencyListResponse>>('/api/admin/polling-concurrency')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定任务类型的并发配置
|
||||
* @param taskType 任务类型
|
||||
* @returns 并发配置
|
||||
*/
|
||||
static getConcurrencyByType(taskType: string): Promise<BaseResponse<PollingConcurrency>> {
|
||||
return this.get<BaseResponse<PollingConcurrency>>(`/api/admin/polling-concurrency/${taskType}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新轮询并发配置
|
||||
* @param taskType 任务类型
|
||||
* @param params 更新参数
|
||||
*/
|
||||
static updateConcurrency(taskType: string, params: UpdateConcurrencyParams): Promise<BaseResponse<void>> {
|
||||
return this.put<BaseResponse<void>>(`/api/admin/polling-concurrency/${taskType}`, params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置轮询并发计数
|
||||
* @param params 重置参数
|
||||
*/
|
||||
static resetConcurrency(params?: ResetConcurrencyParams): Promise<BaseResponse<void>> {
|
||||
return this.post<BaseResponse<void>>('/api/admin/polling-concurrency/reset', params || {})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user