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
32910072
authored
Jun 24, 2024
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改接收地址
parent
3294f141
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
app/Http/Services/SupplierAddressService.php
app/Http/Services/SupplierAddressService.php
View file @
32910072
...
...
@@ -83,34 +83,45 @@ class SupplierAddressService
])
->
first
()
->
toArray
();
$oldSupplierAddress
=
$supplier
[
'supplier_address'
];
//收发货地址
$addressData
=
SupplierAddressModel
::
where
(
'supplier_id'
,
$supplierId
)
->
pluck
(
'address'
,
'address_type'
)
->
toArray
();
//发货地址
$oldShippingAddress
=
array_get
(
$addressData
,
1
);
//退货地址
$oldReturnAddress
=
array_get
(
$addressData
,
2
);
$addressData
=
SupplierAddressModel
::
where
(
'supplier_id'
,
$supplierId
)
->
select
([
'info_id'
,
'address'
,
'address_type'
,
'supplier_id'
])
->
get
()
->
toArray
();
$oldShippingAddress
=
$oldReturnAddress
=
''
;
$oldReturnAddressSourceId
=
$oldShippingAddressSourceId
=
''
;
foreach
(
$addressData
as
$item
)
{
if
(
$item
[
'address_type'
]
==
1
)
{
//发货地址
$oldShippingAddress
=
$item
[
'address'
];
$oldShippingAddressSourceId
=
$supplierId
.
'_'
.
$item
[
'info_id'
];
}
else
{
//退货地址
$oldReturnAddress
=
$item
[
'address'
];
$oldReturnAddressSourceId
=
$supplierId
.
'_'
.
$item
[
'info_id'
];
}
}
//比较,如果有变化,则请求一体化接口
$changedAddress
=
[];
if
(
$oldSupplierAddress
!=
$supplierAddress
)
{
$changedAddress
[]
=
[
'source_id'
=>
$supplierId
,
'source_code'
=>
$supplier
[
'supplier_code'
],
'address_type'
=>
'
供应商
地址'
,
'address_type'
=>
'
注册
地址'
,
'address'
=>
$supplierAddress
,
];
}
if
(
$oldShippingAddress
!=
$shippingAddress
)
{
$changedAddress
[]
=
[
'source_id'
=>
$
supplier
Id
,
'source_id'
=>
$
oldShippingAddressSource
Id
,
'source_code'
=>
$supplier
[
'supplier_code'
],
'address_type'
=>
'
供应商
收货地址'
,
'address_type'
=>
'收货地址'
,
'address'
=>
$shippingAddress
,
];
}
if
(
$oldReturnAddress
!=
$returnAddress
)
{
$changedAddress
[]
=
[
'source_id'
=>
$
supplier
Id
,
'source_id'
=>
$
oldReturnAddressSource
Id
,
'source_code'
=>
$supplier
[
'supplier_code'
],
'address_type'
=>
'
供应商
退货地址'
,
'address_type'
=>
'退货地址'
,
'address'
=>
$returnAddress
,
];
}
...
...
@@ -126,7 +137,6 @@ class SupplierAddressService
];
$url
=
config
(
'website.UnitedDataDomain'
)
.
'/sync/Address/updateAddress'
;
//dd($params);
$result
=
curl
(
$url
,
$params
);
$result
=
json_decode
(
$result
,
true
);
\Log
::
error
(
$result
);
...
...
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