Commit 628ae389 by 杨树贤

fix

parent 02ecc79b
Showing with 21 additions and 7 deletions
......@@ -37,21 +37,35 @@ class SyncAllSupplierToErp extends Command
public function handle()
{
ini_set('memory_limit', -1);
$supplierIds = SupplierChannelModel::where('is_type', 0)->where('group_code','!=','')
$supplierIds = SupplierChannelModel::where('is_type', 0)->where('group_code', '!=', '')
->pluck('supplier_id')->toArray();
$conn = new AMQPStreamConnection(config('database.connections.rabbitmq.host'),
$conn = new AMQPStreamConnection(
config('database.connections.rabbitmq.host'),
config('database.connections.rabbitmq.port'),
config('database.connections.rabbitmq.login'),
config('database.connections.rabbitmq.password'));
config('database.connections.rabbitmq.password')
);
foreach ($supplierIds as $supplierId) {
$hasDataFollower = SupplierContactModel::where('supplier_id',$supplierId)
->where('channel_user_type',SupplierContactModel::CHANNEL_USER_TYPE_INVENTORY)->exists();
$hasDataFollower = SupplierContactModel::where('supplier_id', $supplierId)
->where('channel_user_type', SupplierContactModel::CHANNEL_USER_TYPE_INVENTORY)->exists();
if (!$hasDataFollower) {
continue;
}
usleep(100000);
// usleep(100000);
dump($supplierId);
(new SyncSupplierService())->syncSupplierToErp($supplierId, $conn);
//找出所有的联系人对应的采购id,更新主表
$canCheckUids = SupplierContactModel::where('supplier_id', $supplierId)->pluck('can_check_uids');
if (!empty($canCheckUids)) {
$canCheckUids = array_unique($canCheckUids->toArray());
$canCheckUids = implode(',', $canCheckUids);
} else {
$canCheckUids = '';
}
SupplierChannelModel::where('supplier_id', $supplierId)->update([
'channel_uid' => $canCheckUids,
]);
// (new SyncSupplierService())->syncSupplierToErp($supplierId, $conn);
}
}
}
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