refactor(services): 重构服务文件结构,将服务按功能分类到不同目录

- 将服务文件按功能分类到core、ai、analytics、security等目录
- 修复logger导入路径问题,统一使用相对路径
- 更新相关文件的导入路径引用
- 添加新的批量操作组件导出文件
- 修复dashboard页面中的类型错误
- 添加dotenv依赖到package.json
This commit is contained in:
2026-03-25 13:46:26 +08:00
parent e59d7c6620
commit 2748456d8a
598 changed files with 74404 additions and 9576 deletions

View File

@@ -1,3 +1,4 @@
import { http } from './http';
/**
* [MOCK-TASK] TaskCenter模块DataSource
*/
@@ -63,26 +64,26 @@ class ApiTaskCenterDataSource implements ITaskCenterDataSource {
async fetchTasks(params?: { status?: string; type?: string }): Promise<Task[]> {
const query = new URLSearchParams(params as any).toString();
const res = await fetch(`${this.baseUrl}?${query}`);
return res.json();
const res = await http.get(`${this.baseUrl}?${query}`);
return res.data;
}
async createTask(data: Partial<Task>): Promise<Task> {
const res = await fetch(this.baseUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) });
return res.json();
const res = await http.post(this.baseUrl, data);
return res.data;
}
async cancelTask(id: string): Promise<void> {
await fetch(`${this.baseUrl}/${id}/cancel`, { method: 'POST' });
await http.post(`${this.baseUrl}/${id}/cancel`);
}
async retryTask(id: string): Promise<Task> {
const res = await fetch(`${this.baseUrl}/${id}/retry`, { method: 'POST' });
return res.json();
const res = await http.post(`${this.baseUrl}/${id}/retry`);
return res.data;
}
async deleteTask(id: string): Promise<void> {
await fetch(`${this.baseUrl}/${id}`, { method: 'DELETE' });
await http.delete(`${this.baseUrl}/${id}`);
}
}