Authored by Lynnic

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop

... ... @@ -51,17 +51,17 @@ class CartData
}
/**
* 修改购物车商品数据
* 移入收藏夹
*
* @param int $uid 用户ID
* @param string $swapData 商品数据
* @param string $sku 商品sku列表
* @return array 接口返回的数据
*/
public static function modifyCartProduct($uid, $swapData)
public static function addToFav($uid, $sku)
{
$param = Yohobuy::param();
$param['method'] = 'app.Shopping.swap';
$param['swap_data'] = $swapData;
$param['method'] = 'app.Shopping.addfavorite';
$param['product_sku_list'] = $sku;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
... ... @@ -69,17 +69,35 @@ class CartData
}
/**
* 移入收藏夹
* 获取购物车商品数据
*
* @param int $uid 用户ID
* @param string $sku 商品sku列表
* @param int $skn 商品skn
* @return array 接口返回的数据
*/
public static function addToFav($uid, $sku)
public static function cartProductData($uid, $skn)
{
$param = Yohobuy::param();
$param['method'] = 'app.Shopping.addfavorite';
$param['product_sku_list'] = $sku;
$param['method'] = 'app.product.data';
$param['product_skn'] = $skn;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 修改购物车商品数据
*
* @param int $uid 用户ID
* @param string $swapData 商品数据
* @return array 接口返回的数据
*/
public static function modifyCartProduct($uid, $swapData)
{
$param = Yohobuy::param();
$param['method'] = 'app.Shopping.swap';
$param['swap_data'] = $swapData;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
... ...
... ... @@ -106,3 +106,21 @@
color: #fff;
}
}
.systemMain{
width: 92%;
height: 100%;
overflow: hidden;
background-color:#444;
color: #fff;
padding:0 4%;
position: absolute;
top: 0;
left: 0;
p{
font-size: 52em / $pxConvertRem;
line-height: 60rem / $pxConvertRem;
&:first-of-type{
padding-top: 90rem / $pxConvertRem;
}
}
}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="systemMain">
<P>尊敬的顾客:</P>
<P>您好!</P>
<P>为了向您提供更优质的服务,目前系统正在升级,请您耐心等待。</P>
<P>系统升级期间,部分地区用户体验会有暂 时中断,如遇紧急事宜,欢迎垂询客服热线:400-889-9646 09:00-22:30(周一至周日)。</P>
<P>稍后系统将恢复正常使用,欢迎您继续光顾 YOHO!BUY 有货!</P>
<P>带来不便之处深表 歉意,请您谅解!</P>
<P>特此公告</P>
<P>YOHO!BUY 有货 客户服务中心。</P>
</div>
{{> layout/footer}}
... ...
... ... @@ -45,7 +45,7 @@
<body {{#if isPassportPage}}class=passport-body{{/if}}>
{{#if systemUpdate}}
<div class="systemUpdate">
<a href="systemUpdate" class="systemHeader">YOHO!BUY关于系统升级的公告</a>
<a href="index/systemUpdate" class="systemHeader">YOHO!BUY关于系统升级的公告</a>
<span>X</span>
</div>
{{/if}}
... ...
... ... @@ -38,9 +38,11 @@ class IndexController extends AbstractAction
*
*/
public function systemUpdate()
public function systemUpdateAction()
{
$this->_view->display('systemUpdate','');
$this->setTitle('关于系统升级的公告');
$this->_view->display('systemUpdate');
}
}
... ...
... ... @@ -231,54 +231,19 @@ class ShoppingCartController extends AbstractAction
public function goodinfoAction()
{
$result = array();
if ($this->isAjax()) {
$data = array(
'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/09/17/03/014cacfa5c458b9732c68adf1af15d7a45.jpg?imageMogr2/thumbnail/120x120/extent/120x120/background/d2hpdGU=/position/center/quality/90',
'name' => '黄伟文Wyman X y yohood 联名商品YYYOHOOD圆领卫衣',
'price' => 289,
'salePrice' => 241,
'colors' => array(
array(
'id' => 1,
'name' => '黄色'
),
array(
'id' => 2,
'chosed' => true,
'name' => '白色'
)
),
'sizes' => array(
array(
'id' => 1,
'name' => 'XS'
),
array(
'id' => 2,
'name' => 'S'
),
array(
'id' => 3,
'chosed' => true,
'name' => 'M'
),
array(
'id' => 4,
'name' => 'L'
),
array(
'id' => 5,
'name' => 'XL'
),
array(
'id' => 6,
'name' => 'XXL'
)
),
'num' => 1
);
$num = $this->get('buy_num', 1);
$skn = $this->get('id', 1);
$result = CartModel::cartProductData($this->_uid, $skn, $num); // 测试skn的ID为51172055
$result['num'] = $num;
}
$this->echoJson(array('code' => 200, 'data' => $data));
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
}
... ...
... ... @@ -3,6 +3,7 @@
namespace Index;
use LibModels\Wap\Home\CartData;
use Plugin\Helpers;
use Plugin\Images;
/**
... ... @@ -98,6 +99,70 @@ class CartModel
}
/**
* 处理购物车商品数据
*
* @param int $uid 用户ID
* @param int $skn 商品skn
* @param int $num 购买数目
* @return array 接口返回的数据
*/
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['code'] = 200;
$data = array();
$productData = $product['data'];
// 品牌信息
if (isset($productData['brand_info']) && !empty($productData['brand_info'])) {
$data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120);
}
$data['name'] = $productData['product_name'];
$data['price'] = $productData['market_price'];
$data['salePrice'] = $productData['sales_price'];
$data['storage'] = $productData['storage_sum'];
$data['num'] = $num;
// 商品选择
if (isset($productData['goods_list'])) {
$goodsList = $productData['goods_list'];
$colors = array();
$oneColor = array();
$sizes = array();
$oneSize = array();
foreach ($goodsList as $val) {
// 颜色
$oneColor = array();
$oneColor['id'] = $val['color_id'];
$oneColor['name'] = $val['color_name'];
// 尺码
foreach ($val['size_list'] as $one) {
$oneSize = array();
$oneSize['id'] = $one['size_id'];
$oneSize['name'] = $one['size_name'];
}
$sizes[] = $oneSize;
$oneColor['sizes'] = $sizes;
$colors[] = $oneColor;
}
$data['colors'] = $colors;
}
$result['data'] = $data;
}
return $result;
}
/**
* 修改购物车商品数据
*
* @param int $uid 用户ID
... ... @@ -135,6 +200,7 @@ class CartModel
// 购买的商品列表
foreach ($data['goods_list'] as $value) {
$oneGoods['id'] = $value['product_sku'];
$oneGoods['skn'] = $value['product_skn'];
$oneGoods['name'] = $value['product_name'];
$oneGoods['thumb'] = Images::getImageUrl($value['goods_images'], 120, 120);
$oneGoods['color'] = $value['color_name'];
... ...