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
fdf9c617
authored
Oct 21, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
优化流程
parent
b039f905
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
29 deletions
app/Http/Services/SupplierAddressService.php
app/Http/Services/SupplierService.php
app/Http/Services/SyncSupplierService.php
app/Http/Services/SupplierAddressService.php
View file @
fdf9c617
...
@@ -6,9 +6,10 @@ namespace App\Http\Services;
...
@@ -6,9 +6,10 @@ namespace App\Http\Services;
use
App\Model\LogModel
;
use
App\Model\LogModel
;
use
App\Model\SupplierAddressModel
;
use
App\Model\SupplierAddressModel
;
use
App\Model\SupplierAttachmentsModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
use
App\Model\SupplierContactModel
;
use
Illuminate\Support\Facades\Log
;
use
App\Model\SupplierAttachmentsModel
;
use
http\Exception\InvalidArgumentException
;
use
http\Exception\InvalidArgumentException
;
class
SupplierAddressService
class
SupplierAddressService
...
@@ -70,18 +71,11 @@ class SupplierAddressService
...
@@ -70,18 +71,11 @@ class SupplierAddressService
}
}
//更新一体化的地址库
//更新一体化的地址库
public
function
updateUnitedAddress
(
$
supplierId
,
$supplierAddress
,
$shippingAddress
,
$returnAddress
)
public
function
updateUnitedAddress
(
$
oldSupplier
,
$supplierAddress
,
$shippingAddress
,
$returnAddress
)
{
{
//先找出原始地址数据,然后比对
$supplier
=
$oldSupplier
;
$supplier
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
select
([
'supplier_id'
,
'supplier_code'
,
'supplier_name'
,
'supplier_address'
,
'create_name'
,
'create_uid'
,
])
->
first
()
->
toArray
();
$oldSupplierAddress
=
$supplier
[
'supplier_address'
];
$oldSupplierAddress
=
$supplier
[
'supplier_address'
];
$supplierId
=
$supplier
[
'supplier_id'
];
//收发货地址
//收发货地址
$addressData
=
SupplierAddressModel
::
where
(
'supplier_id'
,
$supplierId
)
->
select
([
'info_id'
,
'address'
,
'address_type'
,
'supplier_id'
])
$addressData
=
SupplierAddressModel
::
where
(
'supplier_id'
,
$supplierId
)
->
select
([
'info_id'
,
'address'
,
'address_type'
,
'supplier_id'
])
->
get
()
->
toArray
();
->
get
()
->
toArray
();
...
@@ -135,13 +129,12 @@ class SupplierAddressService
...
@@ -135,13 +129,12 @@ class SupplierAddressService
'create_name'
=>
$supplier
[
'create_name'
],
'create_name'
=>
$supplier
[
'create_name'
],
'address_data'
=>
$changedAddress
,
'address_data'
=>
$changedAddress
,
];
];
$url
=
config
(
'website.UnitedDataDomain'
)
.
'/sync/Address/updateAddress'
;
$url
=
config
(
'website.UnitedDataDomain'
)
.
'/sync/Address/updateAddress'
;
$result
=
curl
(
$url
,
$params
);
$result
=
curl
(
$url
,
$params
);
$result
=
json_decode
(
$result
,
true
);
$result
=
json_decode
(
$result
,
true
);
\
Log
::
error
(
$result
);
Log
::
error
(
$result
);
if
(
array_get
(
$result
,
'code'
)
!=
0
)
{
if
(
array_get
(
$result
,
'code'
)
!=
0
)
{
\
Log
::
error
(
'更新一体化地址库失败 : '
.
json_encode
(
$result
));
Log
::
error
(
'更新一体化地址库失败 : '
.
json_encode
(
$result
));
}
}
}
}
...
...
app/Http/Services/SupplierService.php
View file @
fdf9c617
...
@@ -87,7 +87,7 @@ class SupplierService
...
@@ -87,7 +87,7 @@ class SupplierService
$isDirectApply
=
request
()
->
get
(
'direct_apply'
);
$isDirectApply
=
request
()
->
get
(
'direct_apply'
);
//走事务
//走事务
$supplierId
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$channel
,
$model
,
$oldSupplier
,
&
$needAudit
,
$isDirectApply
)
{
$supplierId
=
DB
::
connection
(
'web'
)
->
transaction
(
function
()
use
(
$channel
,
$model
,
$oldSupplier
,
&
$needAudit
,
$isDirectApply
,
&
$address
)
{
//是否直接申请审核,如果是直接申请审核,那就变成待审核
//是否直接申请审核,如果是直接申请审核,那就变成待审核
// $isDirectApply 已经从外部传入
// $isDirectApply 已经从外部传入
...
@@ -282,11 +282,9 @@ class SupplierService
...
@@ -282,11 +282,9 @@ class SupplierService
$channel
[
'system_tags'
]
=
trim
(
implode
(
','
,
$channel
[
'system_tags'
]),
','
);
$channel
[
'system_tags'
]
=
trim
(
implode
(
','
,
$channel
[
'system_tags'
]),
','
);
$supplierAddressService
=
new
SupplierAddressService
();
//校验是否需要同步修改地址给一体化
$supplierAddressService
->
updateUnitedAddress
(
$supplierId
,
$channel
[
'supplier_address'
],
$address
[
'shipping_address'
],
$address
[
'return_address'
]);
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
(
$channel
);
$model
->
where
(
'supplier_id'
,
$supplierId
)
->
update
(
$channel
);
$supplierAddressService
=
new
SupplierAddressService
();
//保存地址
//保存地址
$supplierAddressService
->
saveAddress
(
$address
);
$supplierAddressService
->
saveAddress
(
$address
);
...
@@ -384,6 +382,10 @@ class SupplierService
...
@@ -384,6 +382,10 @@ class SupplierService
//但是供应商还没有插入db的时候,可能会提前广播到,导致没法操作供应商的状态(因为供应商都还没有生成)
//但是供应商还没有插入db的时候,可能会提前广播到,导致没法操作供应商的状态(因为供应商都还没有生成)
if
(
empty
(
$channel
[
'supplier_id'
]))
{
if
(
empty
(
$channel
[
'supplier_id'
]))
{
(
new
CompanyService
())
->
checkSupplierCompanyAndAddress
(
$supplierId
);
(
new
CompanyService
())
->
checkSupplierCompanyAndAddress
(
$supplierId
);
}
else
{
$supplierAddressService
=
new
SupplierAddressService
();
//校验是否需要同步修改地址给一体化
$supplierAddressService
->
updateUnitedAddress
(
$oldSupplier
,
$channel
[
'supplier_address'
],
$address
[
'shipping_address'
],
$address
[
'return_address'
]);
}
}
$contentChange
=
true
;
$contentChange
=
true
;
...
@@ -432,16 +434,7 @@ class SupplierService
...
@@ -432,16 +434,7 @@ class SupplierService
//注意: 如果是更新供应商并且 $isDirectApply = true, 已经在事务内处理了审核中心调用,这里不需要再处理
//注意: 如果是更新供应商并且 $isDirectApply = true, 已经在事务内处理了审核中心调用,这里不需要再处理
if
(
$isAudit
&&
array_get
(
$oldSupplier
,
'status'
)
==
SupplierChannelModel
::
STATUS_PASSED
&&
!
$needAudit
&&
!
empty
(
$channel
[
'supplier_id'
]))
{
if
(
$isAudit
&&
array_get
(
$oldSupplier
,
'status'
)
==
SupplierChannelModel
::
STATUS_PASSED
&&
!
$needAudit
&&
!
empty
(
$channel
[
'supplier_id'
]))
{
//什么都不需要操作
//什么都不需要操作
}
else
if
(
$isAudit
&&
$newSupplier
[
'is_entity'
]
!=
0
&&
!
(
$isDirectApply
&&
!
empty
(
$channel
[
'supplier_id'
])))
{
// 排除更新供应商并直接申请审核的情况(已在事务内处理)
$auditData
[]
=
[
'supplier_id'
=>
$supplierId
,
//供应商类型为临时供应商,才会去存申请理由
'apply_audit_reason'
=>
$channel
[
'supplier_type'
]
==
2
?
request
()
->
input
(
'apply_audit_reason'
)
:
''
,
];
$this
->
batchApplyInReviewSupplier
(
$auditData
);
}
}
return
$supplierId
;
return
$supplierId
;
}
}
...
...
app/Http/Services/SyncSupplierService.php
View file @
fdf9c617
...
@@ -365,7 +365,6 @@ class SyncSupplierService
...
@@ -365,7 +365,6 @@ class SyncSupplierService
}
}
$status
=
$isEntity
?
SupplierChannelModel
::
STATUS_DISABLE
:
(
$preStatus
==
SupplierChannelModel
::
STATUS_BLOCK
?
SupplierChannelModel
::
STATUS_IN_REVIEW
:
$preStatus
);
$status
=
$isEntity
?
SupplierChannelModel
::
STATUS_DISABLE
:
(
$preStatus
==
SupplierChannelModel
::
STATUS_BLOCK
?
SupplierChannelModel
::
STATUS_IN_REVIEW
:
$preStatus
);
if
(
$isEntityResult
==
SupplierChannelModel
::
IS_ENTITY_NEED_CONFIRM
)
{
if
(
$isEntityResult
==
SupplierChannelModel
::
IS_ENTITY_NEED_CONFIRM
)
{
$status
=
SupplierChannelModel
::
STATUS_DISABLE
;
$status
=
SupplierChannelModel
::
STATUS_DISABLE
;
}
}
...
...
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