Commit 863c6f9b by 杨树贤

fix

parent b1453ef9
Showing with 7 additions and 7 deletions
...@@ -33,6 +33,7 @@ class SyncSupplierToErp extends Command ...@@ -33,6 +33,7 @@ class SyncSupplierToErp extends Command
ini_set('memory_limit', -1); ini_set('memory_limit', -1);
set_time_limit(0); set_time_limit(0);
ignore_user_abort(true);
$this->info('========================================'); $this->info('========================================');
$this->info('开始同步供应商到ERP'); $this->info('开始同步供应商到ERP');
...@@ -50,17 +51,16 @@ class SyncSupplierToErp extends Command ...@@ -50,17 +51,16 @@ class SyncSupplierToErp extends Command
$syncService = new SyncSupplierService(); $syncService = new SyncSupplierService();
$success = 0; $success = 0;
$count = 0; $count = 0;
$conn = new AMQPStreamConnection(config('database.connections.rabbitmq.host'),
config('database.connections.rabbitmq.port'),
config('database.connections.rabbitmq.login'),
config('database.connections.rabbitmq.password'));
foreach ($suppliers as $supplier) { foreach ($suppliers as $supplier) {
$count++; $count++;
$supplierId = $supplier->supplier_id; $supplierId = $supplier->supplier_id;
echo "[{$count}/{$total}] ID:{$supplierId} {$supplier->supplier_name} ... "; echo "[{$count}/{$total}] ID:{$supplierId} {$supplier->supplier_name} ... ";
usleep(100000);
$result = $syncService->syncSupplierToErp($supplierId); $result = $syncService->syncSupplierToErp($supplierId,$conn);
$success++; $success++;
echo "成功\n"; echo "成功\n";
} }
return 0;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment