Commit acdf681a by 杨树贤

修复

parent 0597d925
Showing with 37 additions and 3 deletions
...@@ -1427,15 +1427,15 @@ class DataService ...@@ -1427,15 +1427,15 @@ class DataService
public static function fixSupplierContacts($isUpdate = false, $num = 10) public static function fixSupplierContacts($isUpdate = false, $num = 10)
{ {
// 查询没有yunxin_channel_uid但有采购跟单员的供应商 // 查询没有yunxin_channel_uid但有采购跟单员的供应商
$suppliers = SupplierChannelModel::where('yunxin_channel_uid','=','') $suppliers = SupplierChannelModel::where('yunxin_channel_uid', '=', '')
->where('channel_uid','!=','') ->where('channel_uid', '!=', '')
->limit($num) ->limit($num)
->get(); ->get();
foreach ($suppliers as $supplier) { foreach ($suppliers as $supplier) {
// 获取该供应商的所有采购跟单员 // 获取该供应商的所有采购跟单员
$contacts = SupplierContactModel::where('supplier_id', $supplier->supplier_id) $contacts = SupplierContactModel::where('supplier_id', $supplier->supplier_id)
->where('channel_user_type', 4) ->where('channel_user_type', 4)
->whereIn('can_check_uids',[ ->whereIn('can_check_uids', [
"10009", "10009",
"10546" "10546"
]) ])
...@@ -1459,6 +1459,24 @@ class DataService ...@@ -1459,6 +1459,24 @@ class DataService
} }
} }
} }
$supplierId = $supplier['supplier_id'];
$allChannelUids = SupplierContactModel::where('supplier_id', $supplierId)
->pluck('can_check_uids')->toArray();
$allChannelUids = array_unique($allChannelUids);
$allChannelUids = array_filter($allChannelUids, function ($value) {
return !empty($value);
});
\dump('供应商 :' . $supplier['supplier_code'] . ' 最后更新的供应商采购员列表为 : ' . \implode(',', $allChannelUids));
if ($isUpdate) {
if ($allChannelUids) {
SupplierChannelModel::where('supplier_id', $supplierId)->update([
'channel_uid' => \implode(',', $allChannelUids),
]);
}
}
} }
} }
...@@ -1554,6 +1572,22 @@ class DataService ...@@ -1554,6 +1572,22 @@ class DataService
\dump('欧阳海梅不存在,需要添加'); \dump('欧阳海梅不存在,需要添加');
} }
} }
$allChannelUids = SupplierContactModel::where('supplier_id', $supplierId)
->pluck('can_check_uids')->toArray();
$allChannelUids = array_unique($allChannelUids);
$allChannelUids = array_filter($allChannelUids, function ($value) {
return !empty($value);
});
\dump('供应商 :' . $item['supplier_code'] . ' 最后更新的供应商采购员列表为 : ' . \implode(',', $allChannelUids));
if ($updateData) {
if ($allChannelUids) {
SupplierChannelModel::where('supplier_id', $supplierId)->update([
'channel_uid' => \implode(',', $allChannelUids),
]);
}
}
} }
} else { } else {
Log::error('线上供应商数据ALL.csv文件未找到'); Log::error('线上供应商数据ALL.csv文件未找到');
......
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