Commit 444173c4 by 杨树贤

fix

parent dcbbb4b5
Showing with 3 additions and 18 deletions
...@@ -14,7 +14,7 @@ class SyncSupplierToErp extends Command ...@@ -14,7 +14,7 @@ class SyncSupplierToErp extends Command
* *
* @var string * @var string
*/ */
protected $signature = 'sync:supplier_to_erp {--num=0 : 处理数量限制(0=不限制)}'; protected $signature = 'sync:supplier_to_erp';
/** /**
* The console command description. * The console command description.
...@@ -30,29 +30,21 @@ class SyncSupplierToErp extends Command ...@@ -30,29 +30,21 @@ class SyncSupplierToErp extends Command
*/ */
public function handle() public function handle()
{ {
$num = (int)$this->option('num');
ini_set('memory_limit', -1); ini_set('memory_limit', -1);
set_time_limit(0); set_time_limit(0);
ignore_user_abort(true);
ob_implicit_flush(true);
$this->info('========================================'); $this->info('========================================');
$this->info('开始同步供应商到ERP'); $this->info('开始同步供应商到ERP');
$this->info('处理数量: ' . ($num > 0 ? $num : '不限制'));
$this->info('========================================'); $this->info('========================================');
// 构建查询:yunxin_channel_uid不为空且不为0 $suppliers = SupplierChannelModel::where('is_type', 0)
$query = SupplierChannelModel::where('is_type', 0) ->where('yunxin_channel_uid', '!=', '')->get();
->where('yunxin_channel_uid', '!=', '');
$suppliers = $query->get();
$total = count($suppliers); $total = count($suppliers);
$this->info("共找到 {$total} 个供应商需要同步"); $this->info("共找到 {$total} 个供应商需要同步");
$syncService = new SyncSupplierService(); $syncService = new SyncSupplierService();
$success = 0; $success = 0;
$failed = 0;
$count = 0; $count = 0;
foreach ($suppliers as $supplier) { foreach ($suppliers as $supplier) {
...@@ -65,13 +57,6 @@ class SyncSupplierToErp extends Command ...@@ -65,13 +57,6 @@ class SyncSupplierToErp extends Command
echo "成功\n"; echo "成功\n";
} }
$this->info('========================================');
$this->info('处理完成');
$this->info('总计: ' . $total);
$this->info('成功: ' . $success);
$this->info('失败: ' . $failed);
$this->info('========================================');
return 0; 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