Commit 2ef15e40 by 杨树贤

fix

parent 8b22f616
Showing with 16 additions and 1 deletions
......@@ -1320,7 +1320,7 @@ class SupplierService
$suppliers = $query->get();
\dump("一共处理供应商 : " . count($suppliers->toArray()));
// 记录总数但不使用dump避免输出问题
$result = [
'mode' => $isProdMode ? 'production' : 'debug',
......@@ -1333,6 +1333,12 @@ class SupplierService
];
foreach ($suppliers as $supplier) {
try {
// 数据库重连,防止长时间运行断开
if ($result['total'] > 0 && $result['total'] % 100 == 0) {
\DB::reconnect('web');
}
$result['total']++;
$supplierId = $supplier->supplier_id;
$yunxinChannelUid = $supplier->yunxin_channel_uid;
......@@ -1418,6 +1424,15 @@ class SupplierService
]);
}
}
} catch (\Exception $e) {
$result['failed']++;
$result['debug_info'][] = [
'supplier_id' => isset($supplierId) ? $supplierId : 0,
'supplier_code' => isset($supplier->supplier_code) ? $supplier->supplier_code : '',
'supplier_name' => isset($supplier->supplier_name) ? $supplier->supplier_name : '',
'fail_reason' => '异常: ' . $e->getMessage(),
];
}
}
return $result;
......
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