update order parse

This commit is contained in:
2026-02-05 10:50:58 +08:00
parent 861766946d
commit 1a580cb474
3 changed files with 39 additions and 8 deletions
@@ -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,
@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace App\Platform\Shopee\Producer;
use Hyperf\Amqp\Annotation\Producer;
use App\Platform\OrderProducer;
#[Producer('shopee.exchange', 'order.shopee')]
class ShopeeOrderProducer extends OrderProducer
{
# @attention 注解的配置不会在直接 new 实例化时自动应用到对象属性上
protected string $exchange = 'shopee.exchange';
protected string|array $routingKey = 'order.shopee';
/**
* 构建消息格式
*
* @param array $data 原始订单数据
* @return array
*/
protected function buildMessage(array $data): array
{
// 根据 RabbitMQ.md 中定义的消息格式规范
$parent_meta = parent::buildMessage($data);
$parent_meta['platform'] = 'shopee';
$parent_meta['meta']['source_system'] = 'shopee_api';
return $parent_meta;
}
};