Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_web
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
a63f1e23
authored
Nov 22, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新增地址返回地址id
parent
e1bd8e6e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
app/Http/Controllers/Api/UserAddressApiController.php
app/Http/Services/UserAddressService.php
app/Http/Controllers/Api/UserAddressApiController.php
View file @
a63f1e23
...
...
@@ -17,7 +17,7 @@ class UserAddressApiController extends Controller
{
$userId
=
$request
->
user
->
id
;
$data
=
UserAddressService
::
getUserAddressList
(
$userId
);
return
$this
->
setSuccessData
(
$data
,
count
(
$data
));
return
$this
->
setSuccessData
(
$data
,
count
(
$data
));
}
public
function
detail
(
Request
$request
)
...
...
@@ -44,12 +44,12 @@ class UserAddressApiController extends Controller
'is_default'
]);
$user
=
$request
->
user
;
$
result
=
UserAddressService
::
addUserAddress
(
$address
,
$user
);
if
(
!
$
result
)
{
$
addressId
=
UserAddressService
::
addUserAddress
(
$address
,
$user
);
if
(
!
$
addressId
)
{
return
$this
->
setError
(
'Add user address failed'
);
}
return
$this
->
setSuccess
(
'Add user address success'
);
return
$this
->
setSuccess
Data
(
$addressId
,
0
,
0
,
'Add user address success'
);
}
public
function
update
(
UserAddressSave
$request
)
...
...
@@ -81,7 +81,7 @@ class UserAddressApiController extends Controller
public
function
delete
(
Request
$request
)
{
$addressId
=
$request
->
input
(
'address_id'
);
$result
=
UserAddressModel
::
where
(
'address_id'
,
$addressId
)
->
delete
();
$result
=
UserAddressModel
::
where
(
'address_id'
,
$addressId
)
->
delete
();
if
(
!
$result
)
{
return
$this
->
setError
(
'Delete user address failed'
);
}
...
...
app/Http/Services/UserAddressService.php
View file @
a63f1e23
...
...
@@ -23,7 +23,7 @@ class UserAddressService
if
(
!
$hasDefaultAddress
)
{
$address
[
'is_default'
]
=
1
;
}
return
UserAddressModel
::
insert
(
$address
);
return
UserAddressModel
::
insert
GetId
(
$address
);
});
}
...
...
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