This commit is contained in:
2026-03-11 16:31:49 +08:00
parent 09281b1c16
commit ef5d329e61
+7 -17
View File
@@ -74,22 +74,12 @@ class WordPressPush implements Consumer
$wpService = new WordpressSiteService();
$result = $wpService->createProductForNewSite($site, $carId);
// 记录推送结果
if ($result['success']) {
// 推送成功,更新车辆状态为4
$car->update(['status' => 4]);
Log::info('WordPress推送成功,车辆状态已更新为推送成功', [
'car_id' => $carId,
'wp_product_id' => $result['product_id'] ?? null,
]);
} else {
// 推送失败,更新车辆状态为5
$car->update(['status' => 5]);
Log::error('WordPress推送失败,车辆状态已更新为推送失败', [
'car_id' => $carId,
'error' => $result['message'] ?? '未知错误',
]);
}
// 推送成功(没有抛出异常),更新车辆状态为4
$car->update(['status' => 4]);
Log::info('WordPress推送成功,车辆状态已更新为推送成功', [
'car_id' => $carId,
'wp_post_id' => $result['result']['id'] ?? null,
]);
} catch (\Throwable $e) {
Log::error('WordPress推送异常', [
@@ -108,7 +98,7 @@ class WordPressPush implements Consumer
'error' => $updateError->getMessage(),
]);
}
throw $e;
// 不再重新抛出异常,让队列正常处理下一条
}
}