Commit c9fc98bb by 杨树贤

批量修改内部编码

parent c9e2e736
...@@ -395,12 +395,47 @@ class DataService ...@@ -395,12 +395,47 @@ class DataService
$createTimestamp = $lastTimestamp + rand(60, 3600); $createTimestamp = $lastTimestamp + rand(60, 3600);
} }
$lastTimestamp = $createTimestamp; $lastTimestamp = $createTimestamp;
dump(date('Y-m-d H:i:s',$createTimestamp)); dump(date('Y-m-d H:i:s', $createTimestamp));
SupplierAccountModel::where('id', $account['id'])->update([ SupplierAccountModel::where('id', $account['id'])->update([
'create_time' => $createTimestamp 'create_time' => $createTimestamp
]); ]);
} }
} }
//修复采购员有问题的数据
public function fixHasProblemChannelUid($isUpdate = false)
{
//1743
//1753
//1527
$channelUidsMap = [
1743 => 10201,
1753 => 10207,
1527 => 10177,
];
$supplierModel = \DB::connection('web');
foreach ($channelUidsMap as $channelUid => $codeId) {
$suppliers = $supplierModel->table('supplier_channel')
->where('channel_uid', 'like', "$channelUid%")
->where('is_type', 0)->get();
foreach ($suppliers as $supplier) {
$channelUidNew = str_replace($channelUid, $codeId, $supplier['channel_uid']);
dump("旧的采购员是 : " . $supplier['channel_uid']);
dump("新的采购员是 : " . $channelUidNew);
if ($isUpdate) {
$supplierModel->table('supplier_channel')
->where('supplier_id', $supplier['supplier_id'])
->update([
'channel_uid' => $channelUidNew,
]);
SupplierContactModel::where('supplier_id', $supplier['supplier_id'])
->where('can_check_uids', $channelUid)->update([
'can_check_uids' => $codeId
]);
}
}
}
}
} }
...@@ -53,5 +53,5 @@ Route::group(['middleware' => ['external'],'namespace' => 'Api'], function () { ...@@ -53,5 +53,5 @@ Route::group(['middleware' => ['external'],'namespace' => 'Api'], function () {
}); });
Route::match(['get', 'post'], '/test', function () { Route::match(['get', 'post'], '/test', function () {
// (new \App\Http\Services\DataService())->importSupplierGroup(); (new \App\Http\Services\DataService())->fixHasProblemChannelUid(false);
}); });
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