main #74

Merged
zksu merged 3 commits from zksu/API:main into main 2026-01-29 09:58:10 +00:00
2 changed files with 2 additions and 4 deletions
Showing only changes of commit d4b267106e - Show all commits

View File

@ -42,8 +42,7 @@ export class OrderController {
const result = await this.orderService.syncOrders(siteId, params); const result = await this.orderService.syncOrders(siteId, params);
return successResponse(result); return successResponse(result);
} catch (error) { } catch (error) {
console.log(error); return errorResponse(`同步失败,${error?.message || '未知错误'}`);
return errorResponse('同步失败');
} }
} }

View File

@ -133,7 +133,7 @@ export class OrderService {
async syncOrders(siteId: number, params: Record<string, any> = {}): Promise<SyncOperationResult> { async syncOrders(siteId: number, params: Record<string, any> = {}): Promise<SyncOperationResult> {
// 调用 WooCommerce API 获取订单 // 调用 WooCommerce API 获取订单
const result = await (await this.siteApiService.getAdapter(siteId)).getAllOrders(params); const result = await (await this.siteApiService.getAdapter(siteId)).getAllOrders(params);
this.logger.info('开始进入循环同步订单', result.length, '个订单')
// 初始化同步结果对象 // 初始化同步结果对象
const syncResult: SyncOperationResult = { const syncResult: SyncOperationResult = {
total: result.length, total: result.length,
@ -143,7 +143,6 @@ export class OrderService {
updated: 0, updated: 0,
errors: [] errors: []
}; };
this.logger.info('开始进入循环同步订单', result.length, '个订单')
// 遍历每个订单进行同步 // 遍历每个订单进行同步
for (const order of result) { for (const order of result) {
try { try {