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
745bb649
authored
Jun 01, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
e3788801
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
24 deletions
app/Http/Controllers/Sync/BaseSyncController.php
app/Http/Controllers/Sync/SupplierSyncController.php
app/Http/Controllers/Sync/BaseSyncController.php
View file @
745bb649
...
...
@@ -14,12 +14,10 @@ class BaseSyncController extends Controller
{
public
function
syncResponse
(
$code
=
0
,
$msg
=
'成功'
,
$data
=
''
,
$count
=
0
)
{
header
(
'Content-Type: application/json'
);
echo
json_encode
([
return
response
()
->
json
([
'code'
=>
$code
,
'msg'
=>
$msg
,
'msg'
=>
$msg
,
'data'
=>
$data
,
]);
exit
();
}
}
app/Http/Controllers/Sync/SupplierSyncController.php
View file @
745bb649
...
...
@@ -52,11 +52,11 @@ class SupplierSyncController extends BaseSyncController
if
(
$validator
->
fails
())
{
$error
=
$validator
->
errors
()
->
first
();
Log
::
warning
(
$error
);
$this
->
syncResponse
(
-
1
,
$error
);
return
$this
->
syncResponse
(
-
1
,
$error
);
}
$result
=
(
new
SyncSupplierService
())
->
syncSupplierToUnitedResult
(
$resultData
);
$this
->
syncResponse
(
0
,
'同步一体化信息成功'
);
return
$this
->
syncResponse
(
0
,
'同步一体化信息成功'
);
}
public
function
receiveEntityResult
(
Request
$request
)
...
...
@@ -69,11 +69,11 @@ class SupplierSyncController extends BaseSyncController
$resultData
[
'result'
]
=
(
int
)
$resultData
[
'result_map'
][
"1"
];
}
if
(
$resultData
[
'result'
]
!==
0
&&
empty
(
$resultData
))
{
$this
->
syncResponse
(
-
1
,
'没有获取到正确的类型'
);
return
$this
->
syncResponse
(
-
1
,
'没有获取到正确的类型'
);
}
if
(
!
in_array
(
$resultData
[
'result'
],
[
0
,
1
,
-
1
,
-
2
,
-
3
]))
{
$this
->
syncResponse
(
-
1
,
'非法公司分类'
);
return
$this
->
syncResponse
(
-
1
,
'非法公司分类'
);
}
...
...
@@ -86,7 +86,7 @@ class SupplierSyncController extends BaseSyncController
//判断联系方式的表单验证
if
(
$validator
->
fails
())
{
$error
=
$validator
->
errors
()
->
first
();
$this
->
syncResponse
(
-
1
,
$error
);
return
$this
->
syncResponse
(
-
1
,
$error
);
}
//这里还要去判断是是拉黑
...
...
@@ -97,10 +97,10 @@ class SupplierSyncController extends BaseSyncController
$data
[
'update_time'
]
=
time
();
SupplierChannelModel
::
where
(
'supplier_name'
,
$resultData
[
'company_name'
])
->
update
(
$data
);
$this
->
syncResponse
(
0
,
'获取审核结果广播成功'
);
return
$this
->
syncResponse
(
0
,
'获取审核结果广播成功'
);
}
(
new
SyncSupplierService
())
->
receiveEntityResult
(
$resultData
);
$this
->
syncResponse
(
0
,
'获取审核结果广播成功'
);
return
$this
->
syncResponse
(
0
,
'获取审核结果广播成功'
);
}
//获取供应商需要审核的数量
...
...
@@ -176,7 +176,7 @@ class SupplierSyncController extends BaseSyncController
if
(
$validator
->
fails
())
{
$error
=
$validator
->
errors
()
->
first
();
Log
::
warning
(
'[CRM同步]参数校验失败: '
.
$error
,
$data
);
$this
->
syncResponse
(
-
1
,
$error
);
return
$this
->
syncResponse
(
-
1
,
$error
);
}
$customerName
=
trim
(
$data
[
'customer_name'
]);
...
...
@@ -186,7 +186,7 @@ class SupplierSyncController extends BaseSyncController
// 如果状态为待确认或CRM转移供应商不通过,说明CRM重新同步了,改回待确认状态并更新信息
if
(
!
in_array
(
$existingSupplier
[
'status'
],
[
SupplierChannelModel
::
STATUS_CONFIRM
,
SupplierChannelModel
::
STATUS_CRM_REJECTED
]))
{
Log
::
info
(
'[CRM同步]供应商已存在且为正式供应商,跳过: '
.
$customerName
);
$this
->
syncResponse
(
-
1
,
'供应商已存在,跳过'
);
return
$this
->
syncResponse
(
-
1
,
'供应商已存在,跳过'
);
}
// 如果状态为CRM转移供应商不通过,说明CRM重新同步了,改回待确认状态并更新信息
if
(
...
...
@@ -206,11 +206,11 @@ class SupplierSyncController extends BaseSyncController
$auditService
=
new
SupplierAuditService
();
$auditService
->
addApproveForCustomerConvert
(
$existingSupplier
[
'supplier_id'
],
$data
[
'apply_uid'
],
'客户转化供应商审核'
);
});
$this
->
syncResponse
(
0
,
'CRM重新同步,状态已恢复为待确认并更新信息,已重新发起审核'
,
[
'supplier_id'
=>
$existingSupplier
[
'supplier_id'
]]);
return
$this
->
syncResponse
(
0
,
'CRM重新同步,状态已恢复为待确认并更新信息,已重新发起审核'
,
[
'supplier_id'
=>
$existingSupplier
[
'supplier_id'
]]);
LogService
::
AddLog
(
$existingSupplier
[
'supplier_id'
],
LogModel
::
UPDATE_OPERATE
,
'CRM重新同步'
,
'CRM重新同步,状态已恢复为待确认并更新信息,已重新发起审核'
);
}
catch
(
\Exception
$e
)
{
Log
::
error
(
'[CRM同步]恢复待确认状态并更新失败: '
.
$e
->
getMessage
(),
[
'data'
=>
$data
]);
$this
->
syncResponse
(
-
1
,
'恢复状态并更新失败: '
.
$e
->
getMessage
());
return
$this
->
syncResponse
(
-
1
,
'恢复状态并更新失败: '
.
$e
->
getMessage
());
}
}
...
...
@@ -221,16 +221,16 @@ class SupplierSyncController extends BaseSyncController
)
{
try
{
$this
->
updateCrmSupplier
(
$existingSupplier
,
$data
);
$this
->
syncResponse
(
0
,
'CRM再次提交更新成功'
,
[
'supplier_id'
=>
$existingSupplier
[
'supplier_id'
]]);
return
$this
->
syncResponse
(
0
,
'CRM再次提交更新成功'
,
[
'supplier_id'
=>
$existingSupplier
[
'supplier_id'
]]);
LogService
::
AddLog
(
$existingSupplier
[
'supplier_id'
],
LogModel
::
UPDATE_OPERATE
,
'CRM再次提交'
,
'CRM再次提交更新成功'
);
}
catch
(
\Exception
$e
)
{
Log
::
error
(
'[CRM同步]再次提交更新失败: '
.
$e
->
getMessage
(),
[
'data'
=>
$data
]);
$this
->
syncResponse
(
-
1
,
'更新失败: '
.
$e
->
getTraceAsString
());
return
$this
->
syncResponse
(
-
1
,
'更新失败: '
.
$e
->
getTraceAsString
());
}
}
Log
::
info
(
'[CRM同步]供应商已存在且不满足再次提交条件,跳过: '
.
$customerName
);
$this
->
syncResponse
(
0
,
'供应商已存在,跳过'
);
return
$this
->
syncResponse
(
0
,
'供应商已存在,跳过'
);
}
try
{
...
...
@@ -381,10 +381,10 @@ class SupplierSyncController extends BaseSyncController
Log
::
info
(
'[CRM同步]供应商创建成功'
,
[
'supplier_id'
=>
$supplierId
,
'supplier_name'
=>
$customerName
]);
$this
->
syncResponse
(
0
,
'同步成功'
,
[
'supplier_id'
=>
$supplierId
]);
return
$this
->
syncResponse
(
0
,
'同步成功'
,
[
'supplier_id'
=>
$supplierId
]);
}
catch
(
\Exception
$e
)
{
Log
::
error
(
'[CRM同步]创建供应商失败: '
.
$e
->
getMessage
(),
[
'data'
=>
$data
]);
$this
->
syncResponse
(
-
1
,
'创建供应商失败: '
.
$e
->
getMessage
());
return
$this
->
syncResponse
(
-
1
,
'创建供应商失败: '
.
$e
->
getMessage
());
}
}
...
...
@@ -500,7 +500,7 @@ class SupplierSyncController extends BaseSyncController
if
(
$validator
->
fails
())
{
$error
=
$validator
->
errors
()
->
first
();
Log
::
warning
(
'[CRM转让同步]参数校验失败: '
.
$error
,
$data
);
$this
->
syncResponse
(
-
1
,
$error
);
return
$this
->
syncResponse
(
-
1
,
$error
);
}
$customerName
=
trim
(
$data
[
'customer_name'
]);
...
...
@@ -511,7 +511,7 @@ class SupplierSyncController extends BaseSyncController
if
(
empty
(
$supplier
))
{
Log
::
warning
(
'[CRM转让同步]供应商不存在或非CRM来源: '
.
$customerName
);
$this
->
syncResponse
(
-
1
,
'供应商不存在或非CRM来源'
);
return
$this
->
syncResponse
(
-
1
,
'供应商不存在或非CRM来源'
);
}
$supplierId
=
$supplier
[
'supplier_id'
];
...
...
@@ -537,10 +537,10 @@ class SupplierSyncController extends BaseSyncController
'transfer_saler'
=>
$data
[
'transfer_saler'
],
]);
$this
->
syncResponse
(
0
,
'同步成功'
);
return
$this
->
syncResponse
(
0
,
'同步成功'
);
}
catch
(
\Exception
$e
)
{
Log
::
error
(
'[CRM转让同步]更新失败: '
.
$e
->
getMessage
(),
[
'data'
=>
$data
]);
$this
->
syncResponse
(
-
1
,
'更新失败: '
.
$e
->
getMessage
());
return
$this
->
syncResponse
(
-
1
,
'更新失败: '
.
$e
->
getMessage
());
}
}
}
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