This commit is contained in:
77
src/api/modules/alert.ts
Normal file
77
src/api/modules/alert.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* 轮询告警管理 API
|
||||
*/
|
||||
import { BaseService } from '../BaseService'
|
||||
import type { BaseResponse } from '@/types/api'
|
||||
import type {
|
||||
PollingAlertRule,
|
||||
PollingAlertHistory,
|
||||
CreatePollingAlertRuleRequest,
|
||||
UpdatePollingAlertRuleRequest,
|
||||
PollingAlertHistoryQueryParams
|
||||
} from '@/types/api/alert'
|
||||
|
||||
export class PollingAlertService extends BaseService {
|
||||
/**
|
||||
* 获取告警规则列表
|
||||
*/
|
||||
static getPollingAlertRules(): Promise<BaseResponse<{ items: PollingAlertRule[] }>> {
|
||||
return this.get<BaseResponse<{ items: PollingAlertRule[] }>>('/api/admin/polling-alert-rules')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取告警规则详情
|
||||
*/
|
||||
static getPollingAlertRuleById(id: number): Promise<BaseResponse<PollingAlertRule>> {
|
||||
return this.get<BaseResponse<PollingAlertRule>>(`/api/admin/polling-alert-rules/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建告警规则
|
||||
*/
|
||||
static createPollingAlertRule(
|
||||
data: CreatePollingAlertRuleRequest
|
||||
): Promise<BaseResponse<PollingAlertRule>> {
|
||||
return this.post<BaseResponse<PollingAlertRule>>('/api/admin/polling-alert-rules', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新告警规则
|
||||
*/
|
||||
static updatePollingAlertRule(
|
||||
id: number,
|
||||
data: UpdatePollingAlertRuleRequest
|
||||
): Promise<BaseResponse<null>> {
|
||||
return this.put<BaseResponse<null>>(`/api/admin/polling-alert-rules/${id}`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除告警规则
|
||||
*/
|
||||
static deletePollingAlertRule(id: number): Promise<BaseResponse<null>> {
|
||||
return this.delete<BaseResponse<null>>(`/api/admin/polling-alert-rules/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取告警历史列表
|
||||
*/
|
||||
static getPollingAlertHistory(params?: PollingAlertHistoryQueryParams): Promise<
|
||||
BaseResponse<{
|
||||
items: PollingAlertHistory[]
|
||||
page: number
|
||||
page_size: number
|
||||
total: number
|
||||
total_pages: number
|
||||
}>
|
||||
> {
|
||||
return this.get<
|
||||
BaseResponse<{
|
||||
items: PollingAlertHistory[]
|
||||
page: number
|
||||
page_size: number
|
||||
total: number
|
||||
total_pages: number
|
||||
}>
|
||||
>('/api/admin/polling-alert-history', params)
|
||||
}
|
||||
}
|
||||
103
src/api/modules/dataCleanup.ts
Normal file
103
src/api/modules/dataCleanup.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* 数据清理管理 API
|
||||
*/
|
||||
import { BaseService } from '../BaseService'
|
||||
import type { BaseResponse } from '@/types/api'
|
||||
import type {
|
||||
DataCleanupConfig,
|
||||
CreateDataCleanupConfigRequest,
|
||||
UpdateDataCleanupConfigRequest,
|
||||
DataCleanupLog,
|
||||
DataCleanupLogQueryParams,
|
||||
DataCleanupPreviewItem,
|
||||
DataCleanupProgress,
|
||||
TriggerDataCleanupRequest
|
||||
} from '@/types/api/dataCleanup'
|
||||
|
||||
export class DataCleanupService extends BaseService {
|
||||
/**
|
||||
* 获取数据清理配置列表
|
||||
*/
|
||||
static getDataCleanupConfigs(): Promise<BaseResponse<{ items: DataCleanupConfig[] }>> {
|
||||
return this.get<BaseResponse<{ items: DataCleanupConfig[] }>>('/api/admin/data-cleanup-configs')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据清理配置详情
|
||||
*/
|
||||
static getDataCleanupConfigById(id: number): Promise<BaseResponse<DataCleanupConfig>> {
|
||||
return this.get<BaseResponse<DataCleanupConfig>>(`/api/admin/data-cleanup-configs/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据清理配置
|
||||
*/
|
||||
static createDataCleanupConfig(
|
||||
data: CreateDataCleanupConfigRequest
|
||||
): Promise<BaseResponse<DataCleanupConfig>> {
|
||||
return this.post<BaseResponse<DataCleanupConfig>>('/api/admin/data-cleanup-configs', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新数据清理配置
|
||||
*/
|
||||
static updateDataCleanupConfig(
|
||||
id: number,
|
||||
data: UpdateDataCleanupConfigRequest
|
||||
): Promise<BaseResponse<null>> {
|
||||
return this.put<BaseResponse<null>>(`/api/admin/data-cleanup-configs/${id}`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据清理配置
|
||||
*/
|
||||
static deleteDataCleanupConfig(id: number): Promise<BaseResponse<null>> {
|
||||
return this.delete<BaseResponse<null>>(`/api/admin/data-cleanup-configs/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据清理日志列表
|
||||
*/
|
||||
static getDataCleanupLogs(params?: DataCleanupLogQueryParams): Promise<
|
||||
BaseResponse<{
|
||||
items: DataCleanupLog[]
|
||||
page: number
|
||||
page_size: number
|
||||
total: number
|
||||
total_pages: number
|
||||
}>
|
||||
> {
|
||||
return this.get<
|
||||
BaseResponse<{
|
||||
items: DataCleanupLog[]
|
||||
page: number
|
||||
page_size: number
|
||||
total: number
|
||||
total_pages: number
|
||||
}>
|
||||
>('/api/admin/data-cleanup-logs', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览待清理数据
|
||||
*/
|
||||
static previewDataCleanup(): Promise<BaseResponse<{ items: DataCleanupPreviewItem[] }>> {
|
||||
return this.get<BaseResponse<{ items: DataCleanupPreviewItem[] }>>(
|
||||
'/api/admin/data-cleanup/preview'
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据清理进度
|
||||
*/
|
||||
static getDataCleanupProgress(): Promise<BaseResponse<DataCleanupProgress>> {
|
||||
return this.get<BaseResponse<DataCleanupProgress>>('/api/admin/data-cleanup/progress')
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动触发数据清理
|
||||
*/
|
||||
static triggerDataCleanup(data?: TriggerDataCleanupRequest): Promise<BaseResponse<null>> {
|
||||
return this.post<BaseResponse<null>>('/api/admin/data-cleanup/trigger', data || {})
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,13 @@ export { AssetService } from './asset'
|
||||
export { AgentRechargeService } from './agentRecharge'
|
||||
export { WechatConfigService } from './wechatConfig'
|
||||
export { ExchangeService } from './exchange'
|
||||
export { RefundService } from './refund'
|
||||
export { DataCleanupService } from './dataCleanup'
|
||||
export { PollingAlertService } from './alert'
|
||||
export { PollingConcurrencyService } from './pollingConcurrency'
|
||||
export { PollingConfigService } from './pollingConfig'
|
||||
export { ManualTriggerService } from './manualTrigger'
|
||||
export { PollingMonitorService } from './pollingMonitor'
|
||||
|
||||
// TODO: 按需添加其他业务模块
|
||||
// export { SettingService } from './setting'
|
||||
|
||||
88
src/api/modules/manualTrigger.ts
Normal file
88
src/api/modules/manualTrigger.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* 手动触发相关 API
|
||||
*/
|
||||
|
||||
import { BaseService } from '../BaseService'
|
||||
import type {
|
||||
ManualTriggerLog,
|
||||
BatchManualTriggerRequest,
|
||||
ConditionManualTriggerRequest,
|
||||
SingleManualTriggerRequest,
|
||||
CancelManualTriggerRequest,
|
||||
ManualTriggerHistoryQueryParams,
|
||||
ManualTriggerHistoryResponse,
|
||||
ManualTriggerStatusResponse,
|
||||
BaseResponse
|
||||
} from '@/types/api'
|
||||
|
||||
export class ManualTriggerService extends BaseService {
|
||||
/**
|
||||
* 批量手动触发
|
||||
* POST /api/admin/polling-manual-trigger/batch
|
||||
*/
|
||||
static batchTrigger(
|
||||
data: BatchManualTriggerRequest
|
||||
): Promise<BaseResponse<ManualTriggerLog>> {
|
||||
return this.post<BaseResponse<ManualTriggerLog>>(
|
||||
'/api/admin/polling-manual-trigger/batch',
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件筛选触发
|
||||
* POST /api/admin/polling-manual-trigger/by-condition
|
||||
*/
|
||||
static conditionTrigger(
|
||||
data: ConditionManualTriggerRequest
|
||||
): Promise<BaseResponse<ManualTriggerLog>> {
|
||||
return this.post<BaseResponse<ManualTriggerLog>>(
|
||||
'/api/admin/polling-manual-trigger/by-condition',
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 单卡手动触发
|
||||
* POST /api/admin/polling-manual-trigger/single
|
||||
*/
|
||||
static singleTrigger(
|
||||
data: SingleManualTriggerRequest
|
||||
): Promise<BaseResponse<ManualTriggerLog>> {
|
||||
return this.post<BaseResponse<ManualTriggerLog>>(
|
||||
'/api/admin/polling-manual-trigger/single',
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消手动触发任务
|
||||
* POST /api/admin/polling-manual-trigger/cancel
|
||||
*/
|
||||
static cancelTrigger(data: CancelManualTriggerRequest): Promise<BaseResponse<void>> {
|
||||
return this.post<BaseResponse<void>>('/api/admin/polling-manual-trigger/cancel', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取手动触发历史
|
||||
* GET /api/admin/polling-manual-trigger/history
|
||||
*/
|
||||
static getHistory(
|
||||
params?: ManualTriggerHistoryQueryParams
|
||||
): Promise<BaseResponse<ManualTriggerHistoryResponse>> {
|
||||
return this.get<BaseResponse<ManualTriggerHistoryResponse>>(
|
||||
'/api/admin/polling-manual-trigger/history',
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取手动触发状态
|
||||
* GET /api/admin/polling-manual-trigger/status
|
||||
*/
|
||||
static getStatus(): Promise<BaseResponse<ManualTriggerStatusResponse>> {
|
||||
return this.get<BaseResponse<ManualTriggerStatusResponse>>(
|
||||
'/api/admin/polling-manual-trigger/status'
|
||||
)
|
||||
}
|
||||
}
|
||||
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 || {})
|
||||
}
|
||||
}
|
||||
90
src/api/modules/pollingConfig.ts
Normal file
90
src/api/modules/pollingConfig.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* 轮询配置管理 API
|
||||
*/
|
||||
import { BaseService } from '../BaseService'
|
||||
import type { BaseResponse } from '@/types/api'
|
||||
import type {
|
||||
PollingConfig,
|
||||
PollingConfigQueryParams,
|
||||
PollingConfigListResponse,
|
||||
CreatePollingConfigRequest,
|
||||
UpdatePollingConfigRequest,
|
||||
UpdatePollingConfigStatusRequest
|
||||
} from '@/types/api/pollingConfig'
|
||||
|
||||
/**
|
||||
* 轮询配置管理服务
|
||||
*/
|
||||
export class PollingConfigService extends BaseService {
|
||||
/**
|
||||
* 获取轮询配置列表
|
||||
* @param params 查询参数
|
||||
* @returns 配置列表
|
||||
*/
|
||||
static getPollingConfigs(
|
||||
params?: PollingConfigQueryParams
|
||||
): Promise<BaseResponse<PollingConfigListResponse>> {
|
||||
return this.get<BaseResponse<PollingConfigListResponse>>('/api/admin/polling-configs', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取轮询配置详情
|
||||
* @param id 配置ID
|
||||
* @returns 配置详情
|
||||
*/
|
||||
static getPollingConfigById(id: number): Promise<BaseResponse<PollingConfig>> {
|
||||
return this.get<BaseResponse<PollingConfig>>(`/api/admin/polling-configs/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建轮询配置
|
||||
* @param data 创建参数
|
||||
* @returns 创建的配置
|
||||
*/
|
||||
static createPollingConfig(
|
||||
data: CreatePollingConfigRequest
|
||||
): Promise<BaseResponse<PollingConfig>> {
|
||||
return this.post<BaseResponse<PollingConfig>>('/api/admin/polling-configs', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新轮询配置
|
||||
* @param id 配置ID
|
||||
* @param data 更新参数
|
||||
* @returns 更新后的配置
|
||||
*/
|
||||
static updatePollingConfig(
|
||||
id: number,
|
||||
data: UpdatePollingConfigRequest
|
||||
): Promise<BaseResponse<PollingConfig>> {
|
||||
return this.put<BaseResponse<PollingConfig>>(`/api/admin/polling-configs/${id}`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除轮询配置
|
||||
* @param id 配置ID
|
||||
*/
|
||||
static deletePollingConfig(id: number): Promise<BaseResponse<void>> {
|
||||
return this.delete<BaseResponse<void>>(`/api/admin/polling-configs/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新轮询配置状态
|
||||
* @param id 配置ID
|
||||
* @param data 状态参数
|
||||
*/
|
||||
static updatePollingConfigStatus(
|
||||
id: number,
|
||||
data: UpdatePollingConfigStatusRequest
|
||||
): Promise<BaseResponse<void>> {
|
||||
return this.put<BaseResponse<void>>(`/api/admin/polling-configs/${id}/status`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有启用的配置
|
||||
* @returns 启用的配置列表
|
||||
*/
|
||||
static getEnabledPollingConfigs(): Promise<BaseResponse<PollingConfig[]>> {
|
||||
return this.get<BaseResponse<PollingConfig[]>>('/api/admin/polling-configs/enabled')
|
||||
}
|
||||
}
|
||||
46
src/api/modules/pollingMonitor.ts
Normal file
46
src/api/modules/pollingMonitor.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 轮询监控相关 API
|
||||
*/
|
||||
|
||||
import { BaseService } from '../BaseService'
|
||||
import type {
|
||||
PollingOverviewStats,
|
||||
PollingInitProgress,
|
||||
PollingQueueStatusResponse,
|
||||
PollingTaskStatsResponse,
|
||||
BaseResponse
|
||||
} from '@/types/api'
|
||||
|
||||
export class PollingMonitorService extends BaseService {
|
||||
/**
|
||||
* 获取轮询总览统计
|
||||
* GET /api/admin/polling-stats
|
||||
*/
|
||||
static getOverviewStats(): Promise<BaseResponse<PollingOverviewStats>> {
|
||||
return this.get<BaseResponse<PollingOverviewStats>>('/api/admin/polling-stats')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取轮询初始化进度
|
||||
* GET /api/admin/polling-stats/init-progress
|
||||
*/
|
||||
static getInitProgress(): Promise<BaseResponse<PollingInitProgress>> {
|
||||
return this.get<BaseResponse<PollingInitProgress>>('/api/admin/polling-stats/init-progress')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取轮询队列状态
|
||||
* GET /api/admin/polling-stats/queues
|
||||
*/
|
||||
static getQueueStatus(): Promise<BaseResponse<PollingQueueStatusResponse>> {
|
||||
return this.get<BaseResponse<PollingQueueStatusResponse>>('/api/admin/polling-stats/queues')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取轮询任务统计
|
||||
* GET /api/admin/polling-stats/tasks
|
||||
*/
|
||||
static getTaskStats(): Promise<BaseResponse<PollingTaskStatsResponse>> {
|
||||
return this.get<BaseResponse<PollingTaskStatsResponse>>('/api/admin/polling-stats/tasks')
|
||||
}
|
||||
}
|
||||
78
src/api/modules/refund.ts
Normal file
78
src/api/modules/refund.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* 退款管理相关 API
|
||||
*/
|
||||
|
||||
import { BaseService } from '../BaseService'
|
||||
import type {
|
||||
Refund,
|
||||
RefundQueryParams,
|
||||
RefundListResponse,
|
||||
CreateRefundRequest,
|
||||
ApproveRefundRequest,
|
||||
RejectRefundRequest,
|
||||
ResubmitRefundRequest,
|
||||
ReturnRefundRequest,
|
||||
BaseResponse
|
||||
} from '@/types/api'
|
||||
|
||||
export class RefundService extends BaseService {
|
||||
/**
|
||||
* 获取退款申请列表
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getRefunds(params?: RefundQueryParams): Promise<BaseResponse<RefundListResponse>> {
|
||||
return this.get<BaseResponse<RefundListResponse>>('/api/admin/refunds', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取退款申请详情
|
||||
* @param id 退款申请ID
|
||||
*/
|
||||
static getRefundById(id: number): Promise<BaseResponse<Refund>> {
|
||||
return this.getOne<Refund>(`/api/admin/refunds/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建退款申请
|
||||
* @param data 创建退款申请请求参数
|
||||
*/
|
||||
static createRefund(data: CreateRefundRequest): Promise<BaseResponse<Refund>> {
|
||||
return this.post<BaseResponse<Refund>>('/api/admin/refunds', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批通过退款申请
|
||||
* @param id 退款申请ID
|
||||
* @param data 审批通过请求参数
|
||||
*/
|
||||
static approveRefund(id: number, data: ApproveRefundRequest): Promise<BaseResponse<void>> {
|
||||
return this.post<BaseResponse<void>>(`/api/admin/refunds/${id}/approve`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批拒绝退款申请
|
||||
* @param id 退款申请ID
|
||||
* @param data 审批拒绝请求参数
|
||||
*/
|
||||
static rejectRefund(id: number, data: RejectRefundRequest): Promise<BaseResponse<void>> {
|
||||
return this.post<BaseResponse<void>>(`/api/admin/refunds/${id}/reject`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新提交退款申请
|
||||
* @param id 退款申请ID
|
||||
* @param data 重新提交请求参数
|
||||
*/
|
||||
static resubmitRefund(id: number, data: ResubmitRefundRequest): Promise<BaseResponse<void>> {
|
||||
return this.post<BaseResponse<void>>(`/api/admin/refunds/${id}/resubmit`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 退回退款申请
|
||||
* @param id 退款申请ID
|
||||
* @param data 退回请求参数
|
||||
*/
|
||||
static returnRefund(id: number, data: ReturnRefundRequest): Promise<BaseResponse<void>> {
|
||||
return this.post<BaseResponse<void>>(`/api/admin/refunds/${id}/return`, data)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user