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
dc5a89a8
authored
Nov 22, 2022
by
SUDPTDUBLXEROFX\Administrator
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
深茂
parent
26f30dfa
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
app/Http/Controllers/Api/CartApiController.php
app/Http/Services/CartService.php
app/Http/Services/OrderService.php
app/Http/Controllers/Api/CartApiController.php
View file @
dc5a89a8
...
@@ -60,7 +60,7 @@ class CartApiController extends Controller
...
@@ -60,7 +60,7 @@ class CartApiController extends Controller
//购物车列表
//购物车列表
public
function
cartLists
(
Request
$request
){
public
function
cartLists
(
Request
$request
){
$result
=
CartService
::
cartLists
(
$request
->
user
->
id
,
$request
->
user
->
gid
);
$result
=
CartService
::
cartLists
(
$request
->
user
->
id
,
$request
->
user
->
gid
,
$request
->
input
(
"cart_ids"
,
0
)
);
return
$this
->
setSuccessData
(
$result
);
return
$this
->
setSuccessData
(
$result
);
}
}
...
...
app/Http/Services/CartService.php
View file @
dc5a89a8
...
@@ -187,8 +187,7 @@ class CartService
...
@@ -187,8 +187,7 @@ class CartService
/*
/*
* 刷新购物车并且返回列表
* 刷新购物车并且返回列表
*/
*/
public
static
function
cartLists
(
$user_id
,
$gid
=
""
,
$page_size
=
400
,
$page
=
1
){
public
static
function
cartLists
(
$user_id
,
$gid
=
""
,
$cart_ids
=
0
,
$page_size
=
400
,
$page
=
1
){
//当前用户所有可用的购物车数据
//当前用户所有可用的购物车数据
if
(
!
$user_id
&&
!
$gid
){
if
(
!
$user_id
&&
!
$gid
){
return
[];
return
[];
...
@@ -201,6 +200,9 @@ class CartService
...
@@ -201,6 +200,9 @@ class CartService
}
}
$query
=
CartModel
::
where
(
$where
)
->
wherein
(
"status"
,[
CartModel
::
status_no
,
CartModel
::
status_yes
])
->
orderBy
(
'status'
,
'desc'
);
$query
=
CartModel
::
where
(
$where
)
->
wherein
(
"status"
,[
CartModel
::
status_no
,
CartModel
::
status_yes
])
->
orderBy
(
'status'
,
'desc'
);
if
(
$cart_ids
){
$query
=
$query
->
wherein
(
"cart_id"
,
explode
(
","
,
$cart_ids
));
}
$res
=
$query
->
paginate
(
$page_size
,
[
'*'
],
'page'
,
$page
)
->
toArray
();
$res
=
$query
->
paginate
(
$page_size
,
[
'*'
],
'page'
,
$page
)
->
toArray
();
$result
=
$res
[
"data"
];
$result
=
$res
[
"data"
];
...
...
app/Http/Services/OrderService.php
View file @
dc5a89a8
...
@@ -44,6 +44,7 @@ class OrderService
...
@@ -44,6 +44,7 @@ class OrderService
$billing_address_id
=
$data
[
"billing_address_id"
];
//账单地址
$billing_address_id
=
$data
[
"billing_address_id"
];
//账单地址
$items
=
json_decode
(
\Arr
::
get
(
$data
,
'items'
,
[]),
true
);
$items
=
json_decode
(
\Arr
::
get
(
$data
,
'items'
,
[]),
true
);
//查询用户详情
//查询用户详情
$userInfo
=
UserModel
::
getUserInfo
(
$user_id
);
$userInfo
=
UserModel
::
getUserInfo
(
$user_id
);
$order_sn
=
self
::
createOrderSn
();
$order_sn
=
self
::
createOrderSn
();
...
...
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