Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yangyang
9 years ago
Commit
5d03d003d9c1b915a933b7a387b85292b893a9b0
1 parent
4fe0191f
购物车选择bug修改
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
10 deletions
library/LibModels/Wap/Home/CartData.php
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
library/LibModels/Wap/Home/CartData.php
View file @
5d03d00
...
...
@@ -59,7 +59,7 @@ class CartData
* @param string $shoppingKey 未登录用户唯一识别码
* @return array 购物车接口返回的数据
*/
public
static
function
selectGoods
(
$uid
,
$sku
,
$shoppingKey
,
$hasPromotion
=
false
)
public
static
function
selectGoods
(
$uid
,
$sku
,
$shoppingKey
,
$hasPromotion
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
$hasPromotion
?
'app.Shopping.selectedAndCart'
:
'app.Shopping.selected'
;
...
...
@@ -111,7 +111,7 @@ class CartData
public
static
function
removeFromCart
(
$uid
,
$sku
,
$shoppingKey
,
$hasPromotion
=
false
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
$hasPromotion
?
'app.Shopping.removeAndCart'
:
'app.Shopping.remove'
;
;
$param
[
'method'
]
=
$hasPromotion
?
'app.Shopping.removeAndCart'
:
'app.Shopping.remove'
;
$param
[
'product_sku_list'
]
=
$sku
;
if
(
!
empty
(
$uid
))
{
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
5d03d00
...
...
@@ -135,7 +135,7 @@ class CartModel
* @param string $shoppingKey 未登录用户唯一识别码
* @return array 处理之后的数据的数据
*/
public
static
function
selectGoods
(
$uid
,
$skuList
,
$shoppingKey
,
$hasPromotion
=
false
)
public
static
function
selectGoods
(
$uid
,
$skuList
,
$shoppingKey
)
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'出错啦~'
);
...
...
@@ -143,8 +143,11 @@ class CartModel
if
(
empty
(
$skuList
))
{
break
;
}
$select
=
CartData
::
selectGoods
(
$uid
,
$skuList
,
$shoppingKey
,
$hasPromotion
);
$arr
=
json_decode
(
$skuList
,
true
);
$arr
[
0
][
'promotion_id'
]
=
$arr
[
0
][
'hasPromotion'
];
$hasPromotion
=
$arr
[
0
][
'hasPromotion'
];
$skuList
=
json_encode
(
$arr
);
$select
=
CartData
::
selectGoods
(
$uid
,
$skuList
,
$shoppingKey
,
$hasPromotion
);
if
(
$select
&&
isset
(
$select
[
'code'
]))
{
$result
[
'code'
]
=
$select
[
'code'
];
$result
[
'message'
]
=
$select
[
'message'
];
...
...
@@ -168,8 +171,7 @@ class CartModel
$result
=
array
(
'code'
=>
400
,
'message'
=>
'出错啦~'
);
// 处理sku
$sku_list
=
json_encode
(
array
(
$sku
=>
intval
(
$count
)
));
$sku_list
=
json_encode
(
array
(
array
(
'product_sku'
=>
$sku
,
'buy_number'
=>
intval
(
$count
),
'promotion_id'
=>
$hasPromotion
)));
$remove
=
CartData
::
removeFromCart
(
$uid
,
$sku_list
,
$shoppingKey
,
$hasPromotion
);
if
(
$remove
&&
isset
(
$remove
[
'code'
]))
{
$result
[
'code'
]
=
$remove
[
'code'
];
...
...
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
View file @
5d03d00
...
...
@@ -103,8 +103,8 @@ class IndexController extends AbstractAction
$productId
=
$this
->
post
(
'skuList'
,
0
);
$uid
=
$this
->
getUid
(
true
);
$shoppingKey
=
Helpers
::
getShoppingKeyByCookie
();
$hasPromotion
=
$this
->
post
(
'hasPromotion'
,
false
);
$result
=
CartModel
::
selectGoods
(
$uid
,
$productId
,
$shoppingKey
,
$hasPromotion
);
$result
=
CartModel
::
selectGoods
(
$uid
,
$productId
,
$shoppingKey
);
}
$this
->
echoJson
(
$result
);
...
...
@@ -123,7 +123,8 @@ class IndexController extends AbstractAction
$uid
=
$this
->
getUid
(
true
);
$shoppingKey
=
Helpers
::
getShoppingKeyByCookie
();
$hasPromotion
=
$this
->
post
(
'hasPromotion'
,
false
);
$result
=
CartModel
::
removeFromCart
(
$uid
,
$sku
,
$count
,
$shoppingKey
);
$result
=
CartModel
::
removeFromCart
(
$uid
,
$sku
,
$count
,
$shoppingKey
,
$hasPromotion
);
}
$this
->
echoJson
(
$result
);
...
...
Please
register
or
login
to post a comment