From 1a580cb474ec759681c8b01c10feabb19547b204 Mon Sep 17 00:00:00 2001 From: Nick Zeng Date: Thu, 5 Feb 2026 10:50:58 +0800 Subject: [PATCH] update order parse --- .../app/Platform/Shopee/EntityParse/Order.php | 6 ++-- .../Shopee/Producer/ShopeeOrderProducer.php | 32 +++++++++++++++++++ .../app/Platform/Tmall/EntityParse/Order.php | 9 +++--- 3 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 backend/app/Platform/Shopee/Producer/ShopeeOrderProducer.php diff --git a/backend/app/Platform/Shopee/EntityParse/Order.php b/backend/app/Platform/Shopee/EntityParse/Order.php index 285094a..479ca47 100644 --- a/backend/app/Platform/Shopee/EntityParse/Order.php +++ b/backend/app/Platform/Shopee/EntityParse/Order.php @@ -383,7 +383,7 @@ class Order extends AbstractOrderParse } } - // 批量查询产品 + // 批量查询产品 并使用匹配到的产品 覆写 $items product_id 字段的值 if (!empty($product_keys)) { $products_id_map = $this->batchQueryProducts($product_keys); @@ -493,8 +493,8 @@ class Order extends AbstractOrderParse 'platform_order_id' => $platform_order_id, 'sub_order_id' => $item['order_item_id'], // @attention sku 的处理需要仅以规范和约束,确保 sku 准确 - 'sub_order_type_id' => '', - 'product_id' => 0, + 'sub_order_type_id' => null, + 'product_id' => 0, // 值为 0 表示未找到产品 id, 之后会被批量查询覆盖 'platform_product_id' =>$item['item_id'], // @attention @TODO 需要对 运营侧的产品维护做进一步规范 'product_sku' => $item['model_sku'] ?? $item['item_sku'] ?? null, diff --git a/backend/app/Platform/Shopee/Producer/ShopeeOrderProducer.php b/backend/app/Platform/Shopee/Producer/ShopeeOrderProducer.php new file mode 100644 index 0000000..fdd5275 --- /dev/null +++ b/backend/app/Platform/Shopee/Producer/ShopeeOrderProducer.php @@ -0,0 +1,32 @@ +batchQueryProducts($product_keys); foreach ($product_keys as $index => $key) { @@ -384,7 +384,7 @@ class Order extends EntityParse * Tmall 订单子项映射转换 * @return void */ - private function tmallOrderItemMap(array $item, string $platform_order_id, int $parent_order_id, Carbon $parent_order_created_date, int $local_product_id = 0): array + private function tmallOrderItemMap(array $item, string $platform_order_id, int $parent_order_id, Carbon $parent_order_created_date): array { // $item = [ @@ -431,7 +431,6 @@ class Order extends EntityParse // ] - //@TODO order item 的业务映射需进一步补全 return [ 'company_id' => $this->getCompany()->id, 'platform_id' => $this->getPlatform()->id, @@ -441,8 +440,8 @@ class Order extends EntityParse 'sub_order_id' => $item['oid'], // @attention sku 的处理需要仅以规范和约束,确保 sku 准确 'sub_order_type_id' => null, - // @attention 表示未找到产品 id - 'product_id' => $local_product_id, + // @attention 值为 0 表示未找到产品 id + 'product_id' => 0, // 值为 0 表示未找到产品 id, 之后会被批量查询覆盖 'platform_product_id' =>$item['num_iid'], // @attention @TODO 需要对 运营侧的产品维护做进一步规范 'product_sku' => $item['outer_sku_id'] ?? null,