This commit is contained in:
2026-02-28 10:38:33 +08:00
parent fa37deb209
commit a5ba7e045f
13 changed files with 133 additions and 112 deletions
@@ -36,6 +36,12 @@ class AppMessageQueuePushShopee extends HyperfCommand
InputOption::VALUE_REQUIRED,
'Queue type: product, order, refund, inventory'
);
$this->addOption(
'ids',
null,
InputOption::VALUE_REQUIRED,
'Comma-separated primary key IDs to fetch specific records'
);
}
/**
@@ -48,21 +54,25 @@ class AppMessageQueuePushShopee extends HyperfCommand
'table' => 'wpic_shopee_order',
'column' => 'raw',
'producer' => ShopeeOrderProducer::class,
'primary' => 'order_sn',
],
'product' => [
'table' => 'wpic_shopee_item',
'column' => 'raw',
'producer' => ShopeeProductProducer::class,
'primary' => 'item_id',
],
'refund' => [
'table' => 'wpic_shopee_return',
'column' => 'raw',
'producer' => ShopeeRefundProducer::class,
'primary' => 'return_sn',
],
'inventory' => [
'table' => 'wpic_shopee_inventory',
'column' => 'raw',
'producer' => ShopeeInventoryProducer::class,
'primary' => 'item_id',
],
];
@@ -86,7 +96,7 @@ class AppMessageQueuePushShopee extends HyperfCommand
// 尝试更新 store 信息
$store = Store::where('platform_id', '=', 25)
->where('platform_store_id', '=', 1669343109 )
->where('platform_store_id', '=', 1402800321 )
->first();
if(!$store){
@@ -98,7 +108,7 @@ class AppMessageQueuePushShopee extends HyperfCommand
'partner_id' => 2006675,
'app_id' => '',
'merchant_id' => 3726273,
'name' => 'owala.sg',
'name' => 'nanit.sg',
'zone' => 'SG',
];
@@ -107,11 +117,21 @@ class AppMessageQueuePushShopee extends HyperfCommand
$store->save();
// 从 raw 数据库连接获取数据
$records = Db::connection('raw')
$query = Db::connection('raw')
->table($config['table'])
->where('store_id', '=', 1669343109)
->orderBy('id', 'desc')
->limit(4)->get($config['column'])->lazy();
->where('store_id', '=', 1402800321);
$idsOption = $this->input->getOption('ids');
if (!empty($idsOption)) {
$ids = array_map('trim', explode(',', $idsOption));
$ids = array_unique(array_filter($ids, fn($id) => $id !== ''));
$query->whereIn($config['primary'], $ids);
$this->info(sprintf('Fetching records by IDs: %s', implode(', ', $ids)));
} else {
$query->orderBy('id', 'desc')->limit(4);
}
$records = $query->get([$config['column']])->lazy();
if ($records->isEmpty()) {
$this->warn(sprintf('No records found in %s table', $config['table']));
@@ -136,10 +156,10 @@ class AppMessageQueuePushShopee extends HyperfCommand
//@ATTENTION 生产环境需要注意, 暂时使用 Shopee Loop SG 进行测试
$messageData = [
'company_id' => 171,
'company_id' => 198,
'platform_id' => 25,
'store_id' => 255,
'platform_store_id' => 1669343109,
'store_id' => 340,
'platform_store_id' => 1402800321,
'unique_id' => time() . '_' . uniqid(),
'raw_data' => $raw_data, // 包含 2 条原始记录
];
@@ -167,3 +187,4 @@ class AppMessageQueuePushShopee extends HyperfCommand
}
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ class IndexController extends AbstractController
return [
'method' => $method,
'message' => "Dataflow App",
'message' => "Datahub App",
];
}
+1 -1
View File
@@ -26,7 +26,7 @@ class ErrorProducer extends ProducerMessage
/**
* VHost
*/
protected string $vhost = 'dataflow';
protected string $vhost = 'datahub';
/**
* 消息持久化
+1 -1
View File
@@ -20,7 +20,7 @@ class OrderProducer extends ProducerMessage
/**
* VHost
*/
protected string $vhost = 'dataflow';
protected string $vhost = 'datahub';
/**
* 消息持久化
+1 -1
View File
@@ -167,7 +167,7 @@ return [
* 可选配置
* 缓存前缀
*/
'prefix' => env('SIMPLE_JWT_PREFIX', 'dataflow'),
'prefix' => env('SIMPLE_JWT_PREFIX', 'datahub'),
],
'session' => [
'driver' => Qbhy\HyperfAuth\Guard\SessionGuard::class,
+13 -13
View File
@@ -15,10 +15,10 @@ return [
'default' => [
'driver' => env('DB_DRIVER', 'pgsql'),
'host' => env('DB_HOST', '127.0.0.1'),
'database' => env('DB_DATABASE', 'dataflow'),
'database' => env('DB_DATABASE', 'datahub'),
'port' => env('DB_PORT', 5416),
'username' => env('DB_USERNAME', 'dataflow'),
'password' => env('DB_PASSWORD', 'dataflow'),
'username' => env('DB_USERNAME', 'datahub'),
'password' => env('DB_PASSWORD', 'datahub'),
'charset' => env('DB_CHARSET', 'utf8'),
'collation' => env('DB_COLLATION', 'utf8_unicode_ci'),
'prefix' => env('DB_PREFIX', ''),
@@ -43,16 +43,16 @@ return [
],
'raw' => [
'driver' => 'mysql',
// 'host' => '127.0.0.1',
// 'port' => 3380,
// 'database' => 'wpic_task',
// 'username' => 'tools',
// 'password' => 'root',
'host' => '120.27.136.208',
'port' => 3306,
'database' => 'wpic',
'username' => 'wpic',
'password' => 'wpic#jsKk223',
'host' => '127.0.0.1',
'port' => 3380,
'database' => 'wpic_task',
'username' => 'tools',
'password' => 'root',
// 'host' => '120.27.136.208',
// 'port' => 3306,
// 'database' => 'wpic',
// 'username' => 'wpic',
// 'password' => 'wpic#jsKk223',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',