Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
郭成尧
8 years ago
Commit
d74b8297b43f45d5ad537cfc4798fac0a7ccac48
1 parent
ade2d58f
cart-chose-pannel-discount-buy
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
14 deletions
library/LibModels/Wap/Home/CartData.php
template/m.yohobuy.com/partials/cart/chose-panel.phtml
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 @
d74b829
...
...
@@ -166,6 +166,21 @@ class CartData
}
/**
* 获取商品的套餐量贩信息
* @param $productSkn
* @return mixed
*/
public
static
function
getBundleBySkn
(
$productSkn
)
{
$param
=
Yohobuy
::
param
();
$param
[
'method'
]
=
'app.query.bundleSkn'
;
$param
[
'product_skn'
]
=
$productSkn
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
API_URL
,
$param
);
}
/**
* 获取加价购商品数据
*
* @param int $skn 商品skn
...
...
template/m.yohobuy.com/partials/cart/chose-panel.phtml
View file @
d74b829
...
...
@@ -48,8 +48,8 @@
<a
class=
"btn btn-minus {{#if mnum}}discount-gray{{/if}}"
href=
"javascript:void(0);"
>
<span
class=
"iconfont {{#if promotionId}}disabled{{/if}}"
>
625
;</span>
</a>
{
{#if
mnum
}
}
<input
id=
"good-num"
class=
"good-num disabled"
type=
"text"
value=
"{{mnum}}"
disabled=
"true"
>
{
{#if
discountBuy
}
}
<input
id=
"good-num"
class=
"good-num disabled"
type=
"text"
value=
"{{discountBuy.mnum}}"
disabled=
"true"
>
{
{^
}
}
<input
id=
"good-num"
class=
"good-num disabled"
type=
"text"
value=
"1"
disabled=
"true"
>
{
{/if
}
}
...
...
@@ -60,10 +60,10 @@
<span
class=
"left-num"
></span>
<input
id=
"left-num"
type=
"hidden"
value=
"0"
>
<input
id=
"limitNum"
type=
"hidden"
value=
"{{limit}}"
>
{
{#if
mnum
}
}
<span
class=
"left-num-discount"
style=
"color: #e10;position: absolute;top: 0.5rem;left: 9.5rem;overflow: hidden;white-space: nowrap;width: 5.2rem;-o-text-overflow: ellipsis;text-overflow: ellipsis;"
>
{
{mnum
}
}件起购享折扣</span>
{
{#
discountBuy
}
}
<span
class=
"left-num-discount"
style=
"color: #e10;position: absolute;top: 0.5rem;left: 9.5rem;overflow: hidden;white-space: nowrap;width: 5.2rem;-o-text-overflow: ellipsis;text-overflow: ellipsis;"
>
{
{mnum
}
}件起购享
{
{discount
}
}折</span>
<input
id=
"mnum"
type=
"hidden"
value=
"{{mnum}}"
>
{
{/
if
}
}
{
{/
discountBuy
}
}
</div>
</div>
</div>
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
d74b829
...
...
@@ -240,13 +240,13 @@ class CartModel
* @param int $mnum 量贩最小购买数量
* @return array 接口返回的数据
*/
public
static
function
cartProductData
(
$uid
,
$skn
,
$num
,
$mnum
)
public
static
function
cartProductData
(
$uid
,
$skn
,
$num
)
{
$result
=
array
(
'code'
=>
400
,
'message'
=>
'出错啦~'
);
$product
=
CartData
::
cartProductData
(
$uid
,
$skn
);
if
(
isset
(
$product
[
'code'
])
&&
$product
[
'code'
]
===
200
)
{
$result
=
self
::
procGoodsDetail
(
$product
[
'data'
],
$num
,
$mnum
);
$result
=
self
::
procGoodsDetail
(
$product
[
'data'
],
$num
);
}
else
{
UdpLog
::
info
(
'【购物车】校验参数传递auth'
,
'uid:'
.
$uid
.
'skn:'
.
$skn
);
}
...
...
@@ -255,6 +255,30 @@ class CartModel
}
/**
* 获取处理量贩数据
* @param $productSkn
* @return array
*/
public
static
function
handleBundleInfo
(
$productSkn
)
{
$result
=
array
();
$apiResult
=
CartData
::
getBundleBySkn
(
$productSkn
);
if
(
$apiResult
&&
$apiResult
[
'code'
]
===
200
&&
isset
(
$apiResult
[
'data'
]))
{
if
(
isset
(
$apiResult
[
'data'
][
'bundleInfo'
]))
{
$result
[
'mnum'
]
=
$apiResult
[
'data'
][
'bundleInfo'
][
'bundleCount'
];
$result
[
'discount'
]
=
$apiResult
[
'data'
][
'bundleInfo'
][
'discount'
];
$result
[
'promotionPhrase'
]
=
$apiResult
[
'data'
][
'bundleInfo'
][
'promotionPhrase'
];
}
}
else
{
UdpLog
::
info
(
'get-product-bundle-data-error'
,
'skn:'
.
$productSkn
);
}
return
$result
;
}
/**
* 处理加价购商品数据
*
* @param int $skn 商品skn
...
...
@@ -873,10 +897,10 @@ class CartModel
*
* @param array
$productData
要处理的商品数据
* @param int
$num
购买数目
* @param null
$mnum
量贩最小购买数量
* @return array
$data
处理之后的数据
* @internal param null
$mnum
量贩最小购买数量
*/
private static function procGoodsDetail(
$productData
,
$num
= null
,
$mnum
= null
)
private static function procGoodsDetail(
$productData
,
$num
= null)
{
$data
= array();
...
...
@@ -899,10 +923,6 @@ class CartModel
$data['num']
=
$num
;
}
if (!empty(
$mnum
)) {
$data['mnum']
=
$mnum
;
}
// 商品选择
if (isset(
$productData['goods_list']
)) {
$goodsList
=
$productData['goods_list']
;
...
...
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
View file @
d74b829
...
...
@@ -226,8 +226,14 @@ class IndexController extends AbstractAction
$mnum
=
$this
->
get
(
'mnum'
,
null
);
$skn
=
$this
->
get
(
'skn'
,
1
);
$uid
=
$this
->
getUid
(
true
);
$result
=
CartModel
::
cartProductData
(
$uid
,
$skn
,
$num
,
$mnum
);
// 测试skn的ID为51172055
$result
=
CartModel
::
cartProductData
(
$uid
,
$skn
,
$num
);
// 测试skn的ID为51172055
$result
[
'num'
]
=
$num
;
/* 量贩数据处理 */
if
(
!
empty
(
$mnum
))
{
$bundleInfo
=
CartModel
::
handleBundleInfo
(
$skn
);
$result
[
'discountBuy'
]
=
$bundleInfo
;
}
}
if
(
!
isset
(
$result
[
'code'
]))
{
...
...
Please
register
or
login
to post a comment