微信小程序页面迁移校验之前 P5任务处理之前

This commit is contained in:
Neo
2026-03-09 01:19:21 +08:00
parent 263bf96035
commit 6e20987d2f
1112 changed files with 153824 additions and 219694 deletions

View File

@@ -0,0 +1,17 @@
/**
* 营业日配置 API。
*
* 从后端 /api/config/business-day 获取营业日分割点小时值。
*/
import { apiClient } from "./client";
export interface BusinessDayConfig {
business_day_start_hour: number;
}
/** 获取营业日分割点配置 */
export async function fetchBusinessDayConfig(): Promise<BusinessDayConfig> {
const { data } = await apiClient.get<BusinessDayConfig>("/config/business-day");
return data;
}

View File

@@ -3,7 +3,7 @@
*/
import { apiClient } from './client';
import type { ScheduledTask, ScheduleConfig, TaskConfig } from '../types';
import type { ScheduledTask, ScheduleConfig, TaskConfig, ExecutionLog } from '../types';
/** 获取调度任务列表 */
export async function fetchSchedules(): Promise<ScheduledTask[]> {
@@ -17,6 +17,7 @@ export async function createSchedule(payload: {
task_codes: string[];
task_config: TaskConfig;
schedule_config: ScheduleConfig;
run_immediately?: boolean;
}): Promise<ScheduledTask> {
const { data } = await apiClient.post<ScheduledTask>('/schedules', payload);
return data;
@@ -46,3 +47,21 @@ export async function toggleSchedule(id: string): Promise<ScheduledTask> {
const { data } = await apiClient.patch<ScheduledTask>(`/schedules/${id}/toggle`);
return data;
}
/** 手动执行调度任务一次(不更新调度间隔) */
export async function runScheduleNow(id: string): Promise<{ message: string; task_id: string }> {
const { data } = await apiClient.post<{ message: string; task_id: string }>(`/schedules/${id}/run`);
return data;
}
/** 获取调度任务的执行历史 */
export async function fetchScheduleHistory(
id: string,
page = 1,
pageSize = 50,
): Promise<ExecutionLog[]> {
const { data } = await apiClient.get<ExecutionLog[]>(`/schedules/${id}/history`, {
params: { page, page_size: pageSize },
});
return data;
}