fix: 修复任务运行响应处理,更新任务编辑页面以正确显示记录ID

This commit is contained in:
xudan 2025-07-23 16:35:13 +08:00
parent 1a480fdd6d
commit 1fb9245883
3 changed files with 13 additions and 9 deletions

View File

@ -109,7 +109,7 @@ export default function TaskEditScreen() {
const result = await runTaskService(request);
setRunResponse(result);
Alert.alert('成功', `任务已启动, 记录ID: ${result.data.taskRecordId}`);
Alert.alert('成功', `任务已启动, 记录ID: ${result.taskRecordId}`);
} catch (error: any) {
Alert.alert('运行失败', error.message || '发生未知错误');
} finally {

View File

@ -44,6 +44,14 @@ api.interceptors.request.use(
// 响应拦截器
api.interceptors.response.use(
response => {
// 打印响应数据用于调试
console.log(
`[Response] ${response.config.method?.toUpperCase()} ${
response.config.url
}`,
response.data,
);
// 统一处理API响应
if (response.data && response.data.code && response.data.code !== 200) {
throw new Error(`API 错误: ${response.data.message}`);

View File

@ -81,15 +81,11 @@ export interface RunTaskRequest {
}
// 运行任务响应数据
export interface RunTaskResponseData {
export interface RunTaskApiResponse {
success: boolean;
message: string;
taskRecordId: string;
status: number;
createTime: string;
}
// 运行任务API响应
export interface RunTaskApiResponse {
code: number;
message: string;
data: RunTaskResponseData;
isPeriodic: boolean;
}