update order parse
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user