From f281ceb5ef23428c38a8910843c04f4cf2072d15 Mon Sep 17 00:00:00 2001 From: AoXuan Date: Sun, 31 Aug 2025 21:59:56 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E6=8E=A5=E5=8F=A3api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/index.ts | 6 + frontend/src/api/models/DispatchIn.ts | 2 +- frontend/src/api/models/HistoryIndexItem.ts | 4 +- frontend/src/api/models/HistorySearchIn.ts | 2 +- frontend/src/api/models/NoticeOut.ts | 27 +++ frontend/src/api/models/PlanReorderIn.ts | 2 +- frontend/src/api/models/PowerIn.ts | 24 +++ frontend/src/api/models/QueueItemReorderIn.ts | 2 +- frontend/src/api/models/ScriptFileIn.ts | 15 ++ frontend/src/api/models/ScriptReorderIn.ts | 2 +- frontend/src/api/models/ScriptUploadIn.ts | 23 +++ frontend/src/api/models/ScriptUrlIn.ts | 15 ++ frontend/src/api/models/TaskCreateIn.ts | 37 ++-- frontend/src/api/models/TimeSetReorderIn.ts | 2 +- frontend/src/api/models/UserReorderIn.ts | 2 +- frontend/src/api/models/UserSetIn.ts | 19 ++ frontend/src/api/services/Service.ts | 169 +++++++++++++++++- 17 files changed, 317 insertions(+), 36 deletions(-) create mode 100644 frontend/src/api/models/NoticeOut.ts create mode 100644 frontend/src/api/models/PowerIn.ts create mode 100644 frontend/src/api/models/ScriptFileIn.ts create mode 100644 frontend/src/api/models/ScriptUploadIn.ts create mode 100644 frontend/src/api/models/ScriptUrlIn.ts create mode 100644 frontend/src/api/models/UserSetIn.ts diff --git a/frontend/src/api/index.ts b/frontend/src/api/index.ts index fb768f1..8ec29e6 100644 --- a/frontend/src/api/index.ts +++ b/frontend/src/api/index.ts @@ -44,6 +44,7 @@ export type { MaaUserConfig } from './models/MaaUserConfig'; export type { MaaUserConfig_Data } from './models/MaaUserConfig_Data'; export type { MaaUserConfig_Info } from './models/MaaUserConfig_Info'; export type { MaaUserConfig_Task } from './models/MaaUserConfig_Task'; +export type { NoticeOut } from './models/NoticeOut'; export type { OutBase } from './models/OutBase'; export type { PlanCreateIn } from './models/PlanCreateIn'; export type { PlanCreateOut } from './models/PlanCreateOut'; @@ -53,6 +54,7 @@ export type { PlanGetOut } from './models/PlanGetOut'; export type { PlanIndexItem } from './models/PlanIndexItem'; export type { PlanReorderIn } from './models/PlanReorderIn'; export type { PlanUpdateIn } from './models/PlanUpdateIn'; +export { PowerIn } from './models/PowerIn'; export type { QueueConfig } from './models/QueueConfig'; export type { QueueConfig_Info } from './models/QueueConfig_Info'; export type { QueueCreateOut } from './models/QueueCreateOut'; @@ -75,11 +77,14 @@ export type { QueueUpdateIn } from './models/QueueUpdateIn'; export { ScriptCreateIn } from './models/ScriptCreateIn'; export type { ScriptCreateOut } from './models/ScriptCreateOut'; export type { ScriptDeleteIn } from './models/ScriptDeleteIn'; +export type { ScriptFileIn } from './models/ScriptFileIn'; export type { ScriptGetIn } from './models/ScriptGetIn'; export type { ScriptGetOut } from './models/ScriptGetOut'; export { ScriptIndexItem } from './models/ScriptIndexItem'; export type { ScriptReorderIn } from './models/ScriptReorderIn'; export type { ScriptUpdateIn } from './models/ScriptUpdateIn'; +export type { ScriptUploadIn } from './models/ScriptUploadIn'; +export type { ScriptUrlIn } from './models/ScriptUrlIn'; export type { SettingGetOut } from './models/SettingGetOut'; export type { SettingUpdateIn } from './models/SettingUpdateIn'; export { TaskCreateIn } from './models/TaskCreateIn'; @@ -101,6 +106,7 @@ export type { UserGetOut } from './models/UserGetOut'; export type { UserInBase } from './models/UserInBase'; export { UserIndexItem } from './models/UserIndexItem'; export type { UserReorderIn } from './models/UserReorderIn'; +export type { UserSetIn } from './models/UserSetIn'; export type { UserUpdateIn } from './models/UserUpdateIn'; export type { ValidationError } from './models/ValidationError'; diff --git a/frontend/src/api/models/DispatchIn.ts b/frontend/src/api/models/DispatchIn.ts index 69e9b8d..e8332cf 100644 --- a/frontend/src/api/models/DispatchIn.ts +++ b/frontend/src/api/models/DispatchIn.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export type DispatchIn = { /** - * 目标任务ID,设置类任务可选对应脚本ID或用户ID,代理类任务可选对应队列ID或脚本ID + * 目标任务ID, 设置类任务可选对应脚本ID或用户ID, 代理类任务可选对应队列ID或脚本ID */ taskId: string; }; diff --git a/frontend/src/api/models/HistoryIndexItem.ts b/frontend/src/api/models/HistoryIndexItem.ts index 1b09968..5181e54 100644 --- a/frontend/src/api/models/HistoryIndexItem.ts +++ b/frontend/src/api/models/HistoryIndexItem.ts @@ -21,8 +21,8 @@ export namespace HistoryIndexItem { * 状态 */ export enum status { - DONE = '完成', - ERROR = '异常', + DONE = '完成', + ERROR = '异常', } } diff --git a/frontend/src/api/models/HistorySearchIn.ts b/frontend/src/api/models/HistorySearchIn.ts index adbd4e8..3485070 100644 --- a/frontend/src/api/models/HistorySearchIn.ts +++ b/frontend/src/api/models/HistorySearchIn.ts @@ -23,6 +23,6 @@ export namespace HistorySearchIn { export enum mode { DAILY = '按日合并', WEEKLY = '按周合并', - MONTHLY = '按年月并', + MONTHLY = '按月合并', } } diff --git a/frontend/src/api/models/NoticeOut.ts b/frontend/src/api/models/NoticeOut.ts new file mode 100644 index 0000000..5dd6e8f --- /dev/null +++ b/frontend/src/api/models/NoticeOut.ts @@ -0,0 +1,27 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type NoticeOut = { + /** + * 状态码 + */ + code?: number; + /** + * 操作状态 + */ + status?: string; + /** + * 操作消息 + */ + message?: string; + /** + * 是否需要显示公告 + */ + if_need_show: boolean; + /** + * 公告信息, key为公告标题, value为公告内容 + */ + data: Record; +}; + diff --git a/frontend/src/api/models/PlanReorderIn.ts b/frontend/src/api/models/PlanReorderIn.ts index 0abbff5..ea5ec84 100644 --- a/frontend/src/api/models/PlanReorderIn.ts +++ b/frontend/src/api/models/PlanReorderIn.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export type PlanReorderIn = { /** - * 计划ID列表,按新顺序排列 + * 计划ID列表, 按新顺序排列 */ indexList: Array; }; diff --git a/frontend/src/api/models/PowerIn.ts b/frontend/src/api/models/PowerIn.ts new file mode 100644 index 0000000..2756b58 --- /dev/null +++ b/frontend/src/api/models/PowerIn.ts @@ -0,0 +1,24 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type PowerIn = { + /** + * 电源操作信号 + */ + signal: PowerIn.signal; +}; +export namespace PowerIn { + /** + * 电源操作信号 + */ + export enum signal { + NO_ACTION = 'NoAction', + SHUTDOWN = 'Shutdown', + SHUTDOWN_FORCE = 'ShutdownForce', + HIBERNATE = 'Hibernate', + SLEEP = 'Sleep', + KILL_SELF = 'KillSelf', + } +} + diff --git a/frontend/src/api/models/QueueItemReorderIn.ts b/frontend/src/api/models/QueueItemReorderIn.ts index 0a81e1c..b4f79b8 100644 --- a/frontend/src/api/models/QueueItemReorderIn.ts +++ b/frontend/src/api/models/QueueItemReorderIn.ts @@ -8,7 +8,7 @@ export type QueueItemReorderIn = { */ queueId: string; /** - * 队列项ID列表,按新顺序排列 + * 队列项ID列表, 按新顺序排列 */ indexList: Array; }; diff --git a/frontend/src/api/models/ScriptFileIn.ts b/frontend/src/api/models/ScriptFileIn.ts new file mode 100644 index 0000000..296ad4c --- /dev/null +++ b/frontend/src/api/models/ScriptFileIn.ts @@ -0,0 +1,15 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ScriptFileIn = { + /** + * 脚本ID + */ + scriptId: string; + /** + * 配置文件路径 + */ + jsonFile: string; +}; + diff --git a/frontend/src/api/models/ScriptReorderIn.ts b/frontend/src/api/models/ScriptReorderIn.ts index d24268b..92769b8 100644 --- a/frontend/src/api/models/ScriptReorderIn.ts +++ b/frontend/src/api/models/ScriptReorderIn.ts @@ -4,7 +4,7 @@ /* eslint-disable */ export type ScriptReorderIn = { /** - * 脚本ID列表,按新顺序排列 + * 脚本ID列表, 按新顺序排列 */ indexList: Array; }; diff --git a/frontend/src/api/models/ScriptUploadIn.ts b/frontend/src/api/models/ScriptUploadIn.ts new file mode 100644 index 0000000..eb28bdb --- /dev/null +++ b/frontend/src/api/models/ScriptUploadIn.ts @@ -0,0 +1,23 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ScriptUploadIn = { + /** + * 脚本ID + */ + scriptId: string; + /** + * 配置名称 + */ + config_name: string; + /** + * 作者 + */ + author: string; + /** + * 描述 + */ + description: string; +}; + diff --git a/frontend/src/api/models/ScriptUrlIn.ts b/frontend/src/api/models/ScriptUrlIn.ts new file mode 100644 index 0000000..2d98450 --- /dev/null +++ b/frontend/src/api/models/ScriptUrlIn.ts @@ -0,0 +1,15 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ScriptUrlIn = { + /** + * 脚本ID + */ + scriptId: string; + /** + * 配置文件URL + */ + url: string; +}; + diff --git a/frontend/src/api/models/TaskCreateIn.ts b/frontend/src/api/models/TaskCreateIn.ts index d3cb3eb..8a5754e 100644 --- a/frontend/src/api/models/TaskCreateIn.ts +++ b/frontend/src/api/models/TaskCreateIn.ts @@ -3,23 +3,22 @@ /* tslint:disable */ /* eslint-disable */ export type TaskCreateIn = { - /** - * 目标任务ID,设置类任务可选对应脚本ID或用户ID,代理类任务可选对应队列ID或脚本ID - */ - taskId: string; - /** - * 任务模式 - */ - mode: TaskCreateIn.mode; -}; -export namespace TaskCreateIn { - /** - * 任务模式 - */ - export enum mode { - AutoMode = '自动代理', - ManualMode = '人工排查', - SettingScriptMode = '设置脚本', - } + /** + * 目标任务ID, 设置类任务可选对应脚本ID或用户ID, 代理类任务可选对应队列ID或脚本ID + */ + taskId: string + /** + * 任务模式 + */ + mode: TaskCreateIn.mode +} +export namespace TaskCreateIn { + /** + * 任务模式 + */ + export enum mode { + AutoMode = '自动代理', + ManualMode = '人工排查', + SettingScriptMode = '设置脚本', + } } - diff --git a/frontend/src/api/models/TimeSetReorderIn.ts b/frontend/src/api/models/TimeSetReorderIn.ts index e8e3078..3164dc8 100644 --- a/frontend/src/api/models/TimeSetReorderIn.ts +++ b/frontend/src/api/models/TimeSetReorderIn.ts @@ -8,7 +8,7 @@ export type TimeSetReorderIn = { */ queueId: string; /** - * 时间设置ID列表,按新顺序排列 + * 时间设置ID列表, 按新顺序排列 */ indexList: Array; }; diff --git a/frontend/src/api/models/UserReorderIn.ts b/frontend/src/api/models/UserReorderIn.ts index 359c818..a573388 100644 --- a/frontend/src/api/models/UserReorderIn.ts +++ b/frontend/src/api/models/UserReorderIn.ts @@ -8,7 +8,7 @@ export type UserReorderIn = { */ scriptId: string; /** - * 用户ID列表,按新顺序排列 + * 用户ID列表, 按新顺序排列 */ indexList: Array; }; diff --git a/frontend/src/api/models/UserSetIn.ts b/frontend/src/api/models/UserSetIn.ts new file mode 100644 index 0000000..81f1f99 --- /dev/null +++ b/frontend/src/api/models/UserSetIn.ts @@ -0,0 +1,19 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type UserSetIn = { + /** + * 所属脚本ID + */ + scriptId: string; + /** + * 用户ID + */ + userId: string; + /** + * JSON文件路径, 用于导入自定义基建文件 + */ + jsonFile: string; +}; + diff --git a/frontend/src/api/services/Service.ts b/frontend/src/api/services/Service.ts index 45d5abe..5cd28bf 100644 --- a/frontend/src/api/services/Service.ts +++ b/frontend/src/api/services/Service.ts @@ -10,6 +10,7 @@ import type { HistoryDataGetOut } from '../models/HistoryDataGetOut'; import type { HistorySearchIn } from '../models/HistorySearchIn'; import type { HistorySearchOut } from '../models/HistorySearchOut'; import type { InfoOut } from '../models/InfoOut'; +import type { NoticeOut } from '../models/NoticeOut'; import type { OutBase } from '../models/OutBase'; import type { PlanCreateIn } from '../models/PlanCreateIn'; import type { PlanCreateOut } from '../models/PlanCreateOut'; @@ -18,6 +19,7 @@ import type { PlanGetIn } from '../models/PlanGetIn'; import type { PlanGetOut } from '../models/PlanGetOut'; import type { PlanReorderIn } from '../models/PlanReorderIn'; import type { PlanUpdateIn } from '../models/PlanUpdateIn'; +import type { PowerIn } from '../models/PowerIn'; import type { QueueCreateOut } from '../models/QueueCreateOut'; import type { QueueDeleteIn } from '../models/QueueDeleteIn'; import type { QueueGetIn } from '../models/QueueGetIn'; @@ -34,10 +36,13 @@ import type { QueueUpdateIn } from '../models/QueueUpdateIn'; import type { ScriptCreateIn } from '../models/ScriptCreateIn'; import type { ScriptCreateOut } from '../models/ScriptCreateOut'; import type { ScriptDeleteIn } from '../models/ScriptDeleteIn'; +import type { ScriptFileIn } from '../models/ScriptFileIn'; import type { ScriptGetIn } from '../models/ScriptGetIn'; import type { ScriptGetOut } from '../models/ScriptGetOut'; import type { ScriptReorderIn } from '../models/ScriptReorderIn'; import type { ScriptUpdateIn } from '../models/ScriptUpdateIn'; +import type { ScriptUploadIn } from '../models/ScriptUploadIn'; +import type { ScriptUrlIn } from '../models/ScriptUrlIn'; import type { SettingGetOut } from '../models/SettingGetOut'; import type { SettingUpdateIn } from '../models/SettingUpdateIn'; import type { TaskCreateIn } from '../models/TaskCreateIn'; @@ -54,6 +59,7 @@ import type { UserGetIn } from '../models/UserGetIn'; import type { UserGetOut } from '../models/UserGetOut'; import type { UserInBase } from '../models/UserInBase'; import type { UserReorderIn } from '../models/UserReorderIn'; +import type { UserSetIn } from '../models/UserSetIn'; import type { UserUpdateIn } from '../models/UserUpdateIn'; import type { CancelablePromise } from '../core/CancelablePromise'; import { OpenAPI } from '../core/OpenAPI'; @@ -101,25 +107,58 @@ export class Service { }); } /** - * 获取通知信息 - * @returns InfoOut Successful Response + * 获取可选计划下拉框信息 + * @returns ComboBoxOut Successful Response * @throws ApiError */ - public static getNoticeInfoApiInfoNoticePost(): CancelablePromise { + public static getPlanComboxApiInfoComboxPlanPost(): CancelablePromise { return __request(OpenAPI, { method: 'POST', - url: '/api/info/notice', + url: '/api/info/combox/plan', }); } /** - * 获取可下载应用信息 + * 获取通知信息 + * @returns NoticeOut Successful Response + * @throws ApiError + */ + public static getNoticeInfoApiInfoNoticeGetPost(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/info/notice/get', + }); + } + /** + * 确认通知 + * @returns OutBase Successful Response + * @throws ApiError + */ + public static confirmNoticeApiInfoNoticeConfirmPost(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/info/notice/confirm', + }); + } + /** + * 获取启动时运行的队列ID * @returns InfoOut Successful Response * @throws ApiError */ - public static getAppsInfoApiInfoAppsInfoPost(): CancelablePromise { + public static getStartupTaskApiInfoStartuptaskPost(): CancelablePromise { return __request(OpenAPI, { method: 'POST', - url: '/api/info/apps_info', + url: '/api/info/startuptask', + }); + } + /** + * 获取配置分享中心的配置信息 + * @returns InfoOut Successful Response + * @throws ApiError + */ + public static getWebConfigApiInfoWebconfigPost(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/info/webconfig', }); } /** @@ -127,7 +166,7 @@ export class Service { * @returns InfoOut Successful Response * @throws ApiError */ - public static addOverviewApiInfoGetOverviewPost(): CancelablePromise { + public static getOverviewApiInfoGetOverviewPost(): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/api/info/get/overview', @@ -228,6 +267,82 @@ export class Service { }, }); } + /** + * 从文件加载脚本 + * @param requestBody + * @returns OutBase Successful Response + * @throws ApiError + */ + public static importScriptFromFileApiScriptsImportFilePost( + requestBody: ScriptFileIn, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/scripts/import/file', + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * 导出脚本到文件 + * @param requestBody + * @returns OutBase Successful Response + * @throws ApiError + */ + public static exportScriptToFileApiScriptsExportFilePost( + requestBody: ScriptFileIn, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/scripts/export/file', + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * 从网络加载脚本 + * @param requestBody + * @returns OutBase Successful Response + * @throws ApiError + */ + public static importScriptFromWebApiScriptsImportWebPost( + requestBody: ScriptUrlIn, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/scripts/import/web', + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * 上传脚本配置到网络 + * @param requestBody + * @returns OutBase Successful Response + * @throws ApiError + */ + public static uploadScriptToWebApiScriptsUploadWebPost( + requestBody: ScriptUploadIn, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/scripts/Upload/web', + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } /** * 查询用户 * @param requestBody @@ -323,6 +438,25 @@ export class Service { }, }); } + /** + * 导入基建配置文件 + * @param requestBody + * @returns OutBase Successful Response + * @throws ApiError + */ + public static importInfrastructureApiScriptsUserInfrastructurePost( + requestBody: UserSetIn, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/scripts/user/infrastructure', + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } /** * 添加计划表 * @param requestBody @@ -733,6 +867,25 @@ export class Service { }, }); } + /** + * 电源操作 + * @param requestBody + * @returns OutBase Successful Response + * @throws ApiError + */ + public static powerTaskApiDispatchPowerPost( + requestBody: PowerIn, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/api/dispatch/power', + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } /** * 搜索历史记录总览信息 * @param requestBody