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
97b3667b
authored
May 19, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
支持重新提交crm审核
parent
8408576a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
app/Http/Controllers/Sync/SupplierSyncController.php
app/Http/Services/LogService.php
app/Http/Controllers/Sync/SupplierSyncController.php
View file @
97b3667b
...
@@ -183,7 +183,32 @@ class SupplierSyncController extends BaseSyncController
...
@@ -183,7 +183,32 @@ class SupplierSyncController extends BaseSyncController
// 幂等处理:供应商名称已存在
// 幂等处理:供应商名称已存在
$existingSupplier
=
SupplierChannelModel
::
where
(
'supplier_name'
,
$customerName
)
->
first
();
$existingSupplier
=
SupplierChannelModel
::
where
(
'supplier_name'
,
$customerName
)
->
first
();
if
(
$existingSupplier
)
{
if
(
$existingSupplier
)
{
// CRM再次提交:仅当来源为CRM且状态为待确认(采购驳回后恢复待确认)时,更新数据
// 如果状态为待确认或CRM转移供应商不通过,说明CRM重新同步了,改回待确认状态并更新信息
if
(
!
in_array
(
$existingSupplier
[
'status'
],
[
SupplierChannelModel
::
STATUS_CONFIRM
,
SupplierChannelModel
::
STATUS_CRM_REJECTED
]))
{
Log
::
info
(
'[CRM同步]供应商已存在且为正式供应商,跳过: '
.
$customerName
);
$this
->
syncResponse
(
-
1
,
'供应商已存在,跳过'
);
}
// 如果状态为CRM转移供应商不通过,说明CRM重新同步了,改回待确认状态并更新信息
if
(
$existingSupplier
[
'supplier_source'
]
==
SupplierChannelModel
::
SUPPLIER_SOURCE_CRM
&&
$existingSupplier
[
'status'
]
==
SupplierChannelModel
::
STATUS_CRM_REJECTED
)
{
try
{
// 先更新状态为待确认
SupplierChannelModel
::
where
(
'supplier_id'
,
$existingSupplier
[
'supplier_id'
])
->
update
([
'status'
=>
SupplierChannelModel
::
STATUS_CONFIRM
,
'update_time'
=>
time
(),
]);
// 然后更新供应商信息
$this
->
updateCrmSupplier
(
$existingSupplier
,
$data
);
$this
->
syncResponse
(
0
,
'CRM重新同步,状态已恢复为待确认并更新信息'
,
[
'supplier_id'
=>
$existingSupplier
[
'supplier_id'
]]);
}
catch
(
\Exception
$e
)
{
Log
::
error
(
'[CRM同步]恢复待确认状态并更新失败: '
.
$e
->
getMessage
(),
[
'data'
=>
$data
]);
$this
->
syncResponse
(
-
1
,
'恢复状态并更新失败: '
.
$e
->
getMessage
());
}
}
// CRM再次提交:当来源为CRM且状态为待确认时,更新数据
if
(
if
(
$existingSupplier
[
'supplier_source'
]
==
SupplierChannelModel
::
SUPPLIER_SOURCE_CRM
$existingSupplier
[
'supplier_source'
]
==
SupplierChannelModel
::
SUPPLIER_SOURCE_CRM
&&
$existingSupplier
[
'status'
]
==
SupplierChannelModel
::
STATUS_CONFIRM
&&
$existingSupplier
[
'status'
]
==
SupplierChannelModel
::
STATUS_CONFIRM
...
@@ -193,9 +218,10 @@ class SupplierSyncController extends BaseSyncController
...
@@ -193,9 +218,10 @@ class SupplierSyncController extends BaseSyncController
$this
->
syncResponse
(
0
,
'CRM再次提交更新成功'
,
[
'supplier_id'
=>
$existingSupplier
[
'supplier_id'
]]);
$this
->
syncResponse
(
0
,
'CRM再次提交更新成功'
,
[
'supplier_id'
=>
$existingSupplier
[
'supplier_id'
]]);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
Log
::
error
(
'[CRM同步]再次提交更新失败: '
.
$e
->
getMessage
(),
[
'data'
=>
$data
]);
Log
::
error
(
'[CRM同步]再次提交更新失败: '
.
$e
->
getMessage
(),
[
'data'
=>
$data
]);
$this
->
syncResponse
(
-
1
,
'更新失败: '
.
$e
->
get
Message
());
$this
->
syncResponse
(
-
1
,
'更新失败: '
.
$e
->
get
TraceAsString
());
}
}
}
}
Log
::
info
(
'[CRM同步]供应商已存在且不满足再次提交条件,跳过: '
.
$customerName
);
Log
::
info
(
'[CRM同步]供应商已存在且不满足再次提交条件,跳过: '
.
$customerName
);
$this
->
syncResponse
(
-
1
,
'供应商已存在,跳过'
);
$this
->
syncResponse
(
-
1
,
'供应商已存在,跳过'
);
}
}
...
...
app/Http/Services/LogService.php
View file @
97b3667b
...
@@ -13,8 +13,8 @@ class LogService
...
@@ -13,8 +13,8 @@ class LogService
//添加日志
//添加日志
public
function
AddLog
(
$supplierId
,
$type
,
$action
,
$content
,
$remark
=
''
)
public
function
AddLog
(
$supplierId
,
$type
,
$action
,
$content
,
$remark
=
''
)
{
{
$adminId
=
request
()
->
user
->
userId
;
$adminId
=
isset
(
request
()
->
user
->
userId
)
?
request
()
->
user
->
userId
:
0
;
$adminName
=
request
()
->
user
->
name
;
$adminName
=
isset
(
request
()
->
user
->
name
)
?
request
()
->
user
->
name
:
''
;
$data
=
[
$data
=
[
'supplier_id'
=>
$supplierId
,
'supplier_id'
=>
$supplierId
,
'type'
=>
$type
,
'type'
=>
$type
,
...
...
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