Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
acdf681a
authored
Jan 04, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复
parent
0597d925
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
3 deletions
app/Http/Services/DataService.php
app/Http/Services/DataService.php
View file @
acdf681a
...
@@ -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文件未找到'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment