Authored by Rock Zhang

在限购商品详情页添加限购商品码字段

Code Review By Rock Zhang
... ... @@ -159,6 +159,9 @@
<a href="javascript:;" class="sold-out">立即购买</a>
{{/if}}
<input type="hidden" name="limitCodeUrl" value="{{limitCodeUrl}}">
{{#limitProductCode}}
<input type="hidden" name="limitProductCode" value="{{.}}">
{{/limitProductCode}}
<a href="javascript:;" id="likeBtn" class="favorite iconfont {{#isCollect}}liked{{/isCollect}}">&#xe605;</a>
</div>
... ...
... ... @@ -314,13 +314,13 @@ class CartModel
* @param int $uid 用户ID
* @param string $cartType 购物车类型,ordinary表示普通购物车
* @param array $orderInfo cookie中记录的一些订单有关数据
* @param string $limitCode 限购商品的限购码,用户限购商品购买
* @param string $limitProductCode 限购商品码,用户限购商品购买
* @param string $sku 商品sku,用于限购商品购买
* @param stirng $skn 商品skn,用于限购商品购买
* @param int $buyNumber 购买商品数目,用户限购商品支付
* @return array 接口返回的数据
*/
public static function cartPay($uid, $cartType, $orderInfo, $limitCode, $sku, $skn, $buyNumber)
public static function cartPay($uid, $cartType, $orderInfo, $limitProductCode, $sku, $skn, $buyNumber)
{
$result = array();
... ... @@ -329,7 +329,7 @@ class CartModel
$skuList = json_encode(array(
array(
'type' => 'limitcode',
'limitproductcode' => $limitCode,
'limitproductcode' => $limitProductCode,
'skn' => $skn,
'sku' => $sku,
'buy_number' => $buyNumber
... ...
... ... @@ -330,6 +330,7 @@ class DetailModel
// 处理限购商品有关的按钮状态
self::procShowStatus($result, $showStatus, $isBeginSale);
$result['cartInfo']['limitProductCode'] = $baseInfo['limitProductCode'];
$result['cartInfo']['limitCodeUrl'] = 'yohobuy://' . Helpers::url('/product', array('skn' => $baseInfo['erpProductId']));
}
... ...
... ... @@ -295,14 +295,14 @@ class IndexController extends AbstractAction
}
// 如果传递了code, sku,skn,buy_number就代表是限购商品
$limitCode = $this->get('code', '');
$limitProductCode = $this->get('code', '');
$sku = $this->get('sku', '');
$skn = $this->get('skn', '');
$buyNumber = $this->get('buy_number', '');
// 购物车商品为空跳转到购物车页面
$uid = $this->getUid(true);
$order = CartModel::cartPay($uid, $cartType, $orderInfo, $limitCode, $sku, $skn, $buyNumber);
$order = CartModel::cartPay($uid, $cartType, $orderInfo, $limitProductCode, $sku, $skn, $buyNumber);
if (isset($order['cartUrl'])) {
$this->go($order['cartUrl']);
}
... ...