Commit 6c7cebeb by 杨树贤

fix

parent 80ef0c3f
......@@ -1449,13 +1449,13 @@ class DataService
foreach ($contacts as $contact) {
//判断创建时间是不是2025年1月3日的时间戳之前创建的
//如果是的话,那么就改成普通采购员
if ($contact->add_time < strtotime('2025-01-02') && $contact->channel_user_type == 4 ) {
if ($contact->add_time < strtotime('2025-01-02') && $contact->channel_user_type == 4) {
\dump('修改 : ' . $contact->contact_id . '编码 : ' . $contact->can_check_uids);
if ($isUpdate) {
$contact->channel_user_type = 1;
$contact->save();
}
} elseif($contact->channel_user_type == 4) {
} elseif ($contact->channel_user_type == 4) {
\dump('删除 : ' . $contact->contact_id . '编码 : ' . $contact->can_check_uids);
if ($isUpdate) {
// 如果是之后创建的,就删除
......@@ -1549,8 +1549,15 @@ class DataService
foreach ($historicalSuppliers as $key => $item) {
$followerCodeId = $adminUserService->getCodeIdByUserName($item['data_follower']);
$supplierId = SupplierChannelModel::where('supplier_code', $item['supplier_code'])->value('supplier_id');
//判断是否有欧阳海梅的跟单员
if (SupplierContactModel::where('supplier_id', $supplierId)->where('can_check_uids', $followerCodeId)->where('channel_user_type', 4)->exists()) {
\dump('欧阳海梅跟单员已经存在,跳过');
continue;
}
$newExist = SupplierContactModel::where('supplier_id', $supplierId)->where('can_check_uids', '10326')->where('add_time', '>', strtotime('2025-01-02'))->first();
$newExist = SupplierContactModel::where('supplier_id', $supplierId)->where('can_check_uids', '10326')->where('channel_user_type',4)
->where('add_time', '>', strtotime('2025-01-02'))->first();
if ($newExist) {
\dump('黄瑜娜已存在,替换成欧阳海梅');
$newExist = $newExist->toArray();
......@@ -1560,12 +1567,12 @@ class DataService
]);
}
} else {
$existingContact = SupplierContactModel::where('can_check_uids', $followerCodeId)->first();
$existingContact = SupplierContactModel::where('supplier_id', $supplierId)->where('can_check_uids', $followerCodeId)->where('channel_user_type',1)
->first();
if ($existingContact) {
// 如果欧阳海梅已存在,修改类型
\dump('欧阳海梅已存在,修改类型');
if ($updateData) {
SupplierContactModel::where('contact_id', $existingContact['contact_id'])->update([
'channel_user_type' => 4,
]);
......
......@@ -97,8 +97,8 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route::match(['get', 'post'], '/test', function () {
// DataService::replaceInventoryUser();
DataService::fixSupplierContacts(false,10);
DataService::replaceInventoryUser(false,10);
// DataService::fixSupplierContacts(false,10);
// DataService::initInventoryNotInXsl(true);
if (request()->get('delete')) {
}
......
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