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
d98013c6
authored
May 25, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
回传接口crm
parent
5a8ae8cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
36 deletions
app/Http/Services/CrmService.php
app/Http/Services/CrmService.php
View file @
d98013c6
...
@@ -5,7 +5,6 @@ namespace App\Http\Services;
...
@@ -5,7 +5,6 @@ namespace App\Http\Services;
use
GuzzleHttp\Client
;
use
GuzzleHttp\Client
;
use
App\Model\RedisModel
;
use
App\Model\RedisModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierChannelModel
;
use
Illuminate\Support\Facades\DB
;
class
CrmService
class
CrmService
{
{
...
@@ -46,7 +45,7 @@ class CrmService
...
@@ -46,7 +45,7 @@ class CrmService
}
}
/**
/**
* 回传CRM供应商转化确认结果
* 回传CRM供应商转化确认结果
(队列推送)
* @param string $supplierName 供应商名称
* @param string $supplierName 供应商名称
* @param string $approverName 审批人姓名
* @param string $approverName 审批人姓名
* @param string $approveResult 审批结果:completed(通过)/purchase_rejected(采购驳回)
* @param string $approveResult 审批结果:completed(通过)/purchase_rejected(采购驳回)
...
@@ -56,55 +55,52 @@ class CrmService
...
@@ -56,55 +55,52 @@ class CrmService
public
static
function
confirmCrmSupplier
(
$supplierName
,
$approverName
,
$approveResult
,
$remark
=
''
)
public
static
function
confirmCrmSupplier
(
$supplierName
,
$approverName
,
$approveResult
,
$remark
=
''
)
{
{
try
{
try
{
$url
=
env
(
'CRM_URL'
)
.
'/open/customer/confirmSupplierApproval'
;
$data
=
[
$client
=
new
Client
();
'customer_name'
=>
$supplierName
,
$response
=
$client
->
post
(
$url
,
[
'approver'
=>
$approverName
,
'form_params'
=>
[
'approve_result'
=>
$approveResult
,
'customer_name'
=>
$supplierName
,
'remark'
=>
$remark
,
'approver'
=>
$approverName
,
];
'approve_result'
=>
$approveResult
,
(
new
QueueDeliveryService
())
->
setQueueName
(
'lie_queue_crm'
)
->
push
(
'remark'
=>
$remark
,
QueueDeliveryService
::
PUSH_TYPE_QUEUE
,
]
'/sync/synSuppAuditResultToCrm'
,
]);
$data
,
$result
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
(
string
)
$supplierName
if
(
isset
(
$result
[
'code'
])
&&
$result
[
'code'
]
==
0
)
{
);
return
true
;
\Illuminate\Support\Facades\Log
::
info
(
'[CRM回传]回传审批结果已推送到队列'
,
[
'supplier_name'
=>
$supplierName
,
'approve_result'
=>
$approveResult
]);
}
return
true
;
\Illuminate\Support\Facades\Log
::
warning
(
'[CRM回传]回传审批结果失败'
,
[
'response'
=>
$result
,
'supplier_name'
=>
$supplierName
]);
return
false
;
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
\Illuminate\Support\Facades\Log
::
error
(
'[CRM回传]回传审批结果异常: '
.
$e
->
getMessage
(),
[
'supplier_name'
=>
$supplierName
]);
\Illuminate\Support\Facades\Log
::
error
(
'[CRM回传]回传审批结果
推送队列
异常: '
.
$e
->
getMessage
(),
[
'supplier_name'
=>
$supplierName
]);
return
false
;
return
false
;
}
}
}
}
/**
/**
* 同步供应商状态变更到CRM系统
* 同步供应商状态变更到CRM系统
(队列推送)
* @param string $supplierName 供应商名称
* @param string $supplierName 供应商名称
* @param string $supplierStatus CRM供应商状态:rejected/passed/blacklist/disable_trade
* @param string $supplierStatus CRM供应商状态:rejected/passed/blacklist/disable_trade
* @param string $remark 备注
* @param string $remark 备注
* @param string $supplierName 供应商名称(作为searchKey)
* @return bool
* @return bool
*/
*/
public
static
function
syncSupplierStatus
(
$supplierName
,
$supplierStatus
,
$remark
=
''
)
public
static
function
syncSupplierStatus
(
$supplierName
,
$supplierStatus
,
$remark
=
''
)
{
{
try
{
try
{
$url
=
env
(
'CRM_URL'
)
.
'/open/customer/syncSupplierStatus'
;
$data
=
[
$client
=
new
Client
();
'customer_name'
=>
$supplierName
,
$response
=
$client
->
post
(
$url
,
[
'supplier_status'
=>
$supplierStatus
,
'form_params'
=>
[
'remark'
=>
$remark
,
'customer_name'
=>
$supplierName
,
];
'supplier_status'
=>
$supplierStatus
,
(
new
QueueDeliveryService
())
->
setQueueName
(
'lie_queue_crm'
)
->
push
(
'remark'
=>
$remark
,
QueueDeliveryService
::
PUSH_TYPE_QUEUE
,
]
'/sync/synSuppAuditResultToCrm'
,
]);
$data
,
$result
=
json_decode
(
$response
->
getBody
()
->
getContents
(),
true
);
(
string
)
$supplierName
if
(
isset
(
$result
[
'code'
])
&&
$result
[
'code'
]
==
0
)
{
);
return
true
;
\Illuminate\Support\Facades\Log
::
info
(
'[CRM回传]同步供应商状态已推送到队列'
,
[
'supplier_name'
=>
$supplierName
,
'status'
=>
$supplierStatus
]);
}
return
true
;
\Illuminate\Support\Facades\Log
::
warning
(
'[CRM回传]同步供应商状态失败'
,
[
'response'
=>
$result
,
'supplier_name'
=>
$supplierName
]);
return
false
;
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
\Illuminate\Support\Facades\Log
::
error
(
'[CRM回传]同步供应商状态异常: '
.
$e
->
getMessage
(),
[
'supplier_name'
=>
$supplierName
]);
\Illuminate\Support\Facades\Log
::
error
(
'[CRM回传]同步供应商状态
推送队列
异常: '
.
$e
->
getMessage
(),
[
'supplier_name'
=>
$supplierName
]);
return
false
;
return
false
;
}
}
}
}
...
...
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