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

This commit is contained in:
tikkhun 2025-10-14 14:02:38 +08:00
parent 88766248c9
commit 566d4bdecc
1 changed files with 3 additions and 7 deletions

View File

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