improment(order): 移除不必要的状态回滚逻辑

This commit is contained in:
tikkhun 2025-10-14 14:02:38 +08:00 committed by longbot
parent c9342396df
commit e3b102259c
1 changed files with 3 additions and 7 deletions

View File

@ -122,11 +122,9 @@ export class OrderService {
// 其他状态保持不变 // 其他状态保持不变
const originStatus = order.status; const originStatus = order.status;
// 如果有值就赋值 // 如果有值就赋值
if (this.orderAutoNextStatusMap[originStatus]) { if (!this.orderAutoNextStatusMap[originStatus]) {
order.status = this.orderAutoNextStatusMap[originStatus]; return
} }
const shouldSync = originStatus !== order.status;
if (!shouldSync) return;
try { try {
const site = this.sites.find(v => v.id === siteId); const site = this.sites.find(v => v.id === siteId);
if (!site) { if (!site) {
@ -134,11 +132,9 @@ export class OrderService {
} }
// 同步更新回 wordpress 的 order 状态 // 同步更新回 wordpress 的 order 状态
await this.wPService.updateOrder(site, order.id, { status: order.status }); await this.wPService.updateOrder(site, order.id, { status: order.status });
order.status = this.orderAutoNextStatusMap[originStatus];
} catch (error) { } catch (error) {
console.error('更新订单状态失败,原因为:', error) console.error('更新订单状态失败,原因为:', error)
// 回滚到原始状态
order.status = originStatus;
} }
} }
// wordpress 发来, // wordpress 发来,