update shopee entity parse

This commit is contained in:
2026-02-05 14:20:52 +08:00
parent 8b29737e5f
commit 0a112c9e2a
3 changed files with 58 additions and 16 deletions
+8 -16
View File
@@ -71,14 +71,6 @@ class OrderConsumer extends ConsumerMessage
sleep($debug_delay); sleep($debug_delay);
} }
// dump('---data');
// dump($data);
// dump('---');
dump('---message');
dump(json_decode($message->getBody(), true)['message_id']);
dump('---');
// 获取重试次数 // 获取重试次数
$retry_count = $this->getRetryCount($message); $retry_count = $this->getRetryCount($message);
$max_retries = (int) env('AMQP_MAX_RETRIES', 3); $max_retries = (int) env('AMQP_MAX_RETRIES', 3);
@@ -187,14 +179,14 @@ class OrderConsumer extends ConsumerMessage
return Result::ACK; return Result::ACK;
} catch (Throwable $error) { } catch (Throwable $error) {
dump("=== Error Caught ==="); // dump("=== Error Caught ===");
dump("Error: " . $error->getMessage()); // dump("Error: " . $error->getMessage());
dump("File: " . $error->getFile() . ":" . $error->getLine()); // dump("File: " . $error->getFile() . ":" . $error->getLine());
dump("Stack trace:"); // dump("Stack trace:");
dump($error->getTraceAsString()); // dump($error->getTraceAsString());
dump("Retry Count: {$retry_count}"); // dump("Retry Count: {$retry_count}");
dump("Max Retries: {$max_retries}"); // dump("Max Retries: {$max_retries}");
dump("Check: {$retry_count} >= {$max_retries} = " . ($retry_count >= $max_retries ? 'TRUE' : 'FALSE')); // dump("Check: {$retry_count} >= {$max_retries} = " . ($retry_count >= $max_retries ? 'TRUE' : 'FALSE'));
Log::get()->error('Consumer processing failed', [ Log::get()->error('Consumer processing failed', [
'error' => $error->getMessage(), 'error' => $error->getMessage(),
@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace App\Platform\Shopee\Producer;
use Hyperf\Amqp\Annotation\Producer;
use App\Platform\OrderProducer;
#[Producer('shopee.exchange', 'inventory.shopee')]
class ShopeeInventoryProducer extends OrderProducer
{
protected string $exchange = 'shopee.exchange';
protected string|array $routingKey = 'inventory.shopee';
protected function buildMessage(array $data): array
{
$parent_meta = parent::buildMessage($data);
$parent_meta['platform'] = 'shopee';
$parent_meta['data_type'] = 'inventory';
$parent_meta['meta']['source_system'] = 'shopee_api';
return $parent_meta;
}
}
@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace App\Platform\Shopee\Producer;
use Hyperf\Amqp\Annotation\Producer;
use App\Platform\OrderProducer;
#[Producer('shopee.exchange', 'product.shopee')]
class ShopeeProductProducer extends OrderProducer
{
protected string $exchange = 'shopee.exchange';
protected string|array $routingKey = 'product.shopee';
protected function buildMessage(array $data): array
{
$parent_meta = parent::buildMessage($data);
$parent_meta['platform'] = 'shopee';
$parent_meta['data_type'] = 'product';
$parent_meta['meta']['source_system'] = 'shopee_api';
return $parent_meta;
}
}