fix: 修复数据格式错误

This commit is contained in:
imeepos 2025-09-04 21:12:28 +08:00
parent fd7d619a51
commit 4311527356
1 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@ export class AppController {
constructor( constructor(
@InjectRepository(TemplateExecutionEntity) @InjectRepository(TemplateExecutionEntity)
private readonly executionRepository: Repository<TemplateExecutionEntity>, private readonly executionRepository: Repository<TemplateExecutionEntity>,
) {} ) { }
@Post('callback') @Post('callback')
async callback(@Body() body: any): Promise<ApiResponse<string | null>> { async callback(@Body() body: any): Promise<ApiResponse<string | null>> {
console.log(`🚀 [回调] 开始执行回调`); console.log(`🚀 [回调] 开始执行回调`);
@ -19,8 +19,8 @@ export class AppController {
const res = body.data; const res = body.data;
// {status: true, data: string[], task_id: string} // {status: true, data: string[], task_id: string}
let resultUrl = `` let resultUrl = ``
if (res.status) { if (body.status) {
const data = res.data; const data = body.data;
if (!data) throw new Error(`结果有误`); if (!data) throw new Error(`结果有误`);
if (Array.isArray(data) && data.length > 0) { if (Array.isArray(data) && data.length > 0) {
resultUrl = data[0]; resultUrl = data[0];