Commit e4c9fdf8 by 杨树贤

优化脚本

parent c25041ab
...@@ -1885,7 +1885,8 @@ class DataService ...@@ -1885,7 +1885,8 @@ class DataService
]; ];
} }
public static function handleMixTypeSupplier() { public static function handleMixTypeSupplier()
{
$supplierList = SupplierChannelModel::where('supplier_group', SupplierChannelModel::SUPPLIER_GROUP_MIX)->limit(2)->get()->toArray(); $supplierList = SupplierChannelModel::where('supplier_group', SupplierChannelModel::SUPPLIER_GROUP_MIX)->limit(2)->get()->toArray();
foreach ($supplierList as $supplier) { foreach ($supplierList as $supplier) {
$supplierId = $supplier['supplier_id']; $supplierId = $supplier['supplier_id'];
...@@ -2001,11 +2002,6 @@ class DataService ...@@ -2001,11 +2002,6 @@ class DataService
$oldChannelUid = $supplier['channel_uid']; $oldChannelUid = $supplier['channel_uid'];
$channelUidArray = explode(',', trim($oldChannelUid, ',')); $channelUidArray = explode(',', trim($oldChannelUid, ','));
// 移除京东采购员ID
$newChannelUidArray = array_diff($channelUidArray, $channelUids);
$newChannelUid = implode(',', $newChannelUidArray);
$newChannelUid = trim($newChannelUid, ',');
if ($updateData) { if ($updateData) {
// 删除联系人 // 删除联系人
SupplierContactModel::where('supplier_id', $supplierId) SupplierContactModel::where('supplier_id', $supplierId)
...@@ -2013,6 +2009,11 @@ class DataService ...@@ -2013,6 +2009,11 @@ class DataService
->whereIn('can_check_uids', $channelUids) ->whereIn('can_check_uids', $channelUids)
->delete(); ->delete();
$newChannelUid = SupplierChannelModel::where('supplier_id', $supplier['supplier_id'])->pluck('can_check_uids')->toArray();
if (empty($newChannelUid)) {
continue;
}
$newChannelUid = \implode(',', $newChannelUid);
// 更新channel_uid // 更新channel_uid
SupplierChannelModel::where('supplier_id', $supplierId)->update([ SupplierChannelModel::where('supplier_id', $supplierId)->update([
'channel_uid' => $newChannelUid, 'channel_uid' => $newChannelUid,
...@@ -2039,6 +2040,4 @@ class DataService ...@@ -2039,6 +2040,4 @@ class DataService
dump("已删除 {$count} 个京东采购员类型的联系人"); dump("已删除 {$count} 个京东采购员类型的联系人");
} }
} }
} }
...@@ -97,5 +97,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function () ...@@ -97,5 +97,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
}); });
Route::match(['get', 'post'], '/test', function () { Route::match(['get', 'post'], '/test', function () {
SupplierChannelModel::where('supplier_code','L0011042')->update(['status' => 2]); DataService::deleteAllJdChannelUser(false);
}); });
...@@ -270,19 +270,6 @@ ...@@ -270,19 +270,6 @@
{field: 'purchase_username', title: '数据维护员', align: 'center', width: 110}, {field: 'purchase_username', title: '数据维护员', align: 'center', width: 110},
{field: 'yunxin_channel_username', title: '线上采购员', align: 'center', width: 110}, {field: 'yunxin_channel_username', title: '线上采购员', align: 'center', width: 110},
{ {
field: 'jd_channel_username', title: '京东采购员', align: 'center', width: 130, templet: function (data) {
if (data.jd_resign_channel_username) {
if (data.jd_on_job_channel_username) {
return `<span>${data.jd_on_job_channel_username}</span>` + `,<span style="color: #D7D7D7">${data.jd_resign_channel_username}</span>`;
} else {
return `<span style="color: #D7D7D7">${data.jd_resign_channel_username}</span>`
}
} else {
return `<span>${data.jd_on_job_channel_username}</span>`;
}
}
},
{
field: 'inventory_channel_username', title: '数据跟单员', align: 'center', width: 130, templet: function (data) { field: 'inventory_channel_username', title: '数据跟单员', align: 'center', width: 130, templet: function (data) {
if (data.inventory_resign_channel_username) { if (data.inventory_resign_channel_username) {
if (data.inventory_on_job_channel_username) { if (data.inventory_on_job_channel_username) {
......
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