Authored by 毕凯

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

... ... @@ -31,9 +31,10 @@ class AbstractAction extends Controller_Abstract
/**
* 用户相关信息
*/
protected $_vip;
protected $_uid = 0;
protected $_uname = '';
protected $_vip;
protected $_usession = '';
protected $_useSession = true;
/**
... ... @@ -317,6 +318,7 @@ class AbstractAction extends Controller_Abstract
$this->_uid = $cookieList[1];
}
$this->_uname = $cookieList[0];
$this->_usession = $cookieList[3];
$this->_vip = $cookieList[2];
}
}
... ...
... ... @@ -91,7 +91,7 @@ class Yohobuy
{
$clientType = self::clientType();
$param = array(
'app_version' => '3.6',
'app_version' => '3.8.2',
'client_type' => $clientType,
'os_version' => 'yohobuy:h5',
'private_key' => self::$privateKeyList[$clientType],
... ...
... ... @@ -19,6 +19,7 @@ class ActivityData
const URI_GET_ACTIVITY_INFO = 'event/api/v1/activity/get';
const URI_GET_NAMED_COUPON = 'event/api/v1/activity/getCoupon';
const URI_GET_ALL_COUPON = 'event/api/v1/activity/getCoupon';
const URI_SEND_MESSAGE = 'inbox/service/v1/inbox';
/**
* 用户获取某个活动指定的单个优惠券
... ...
... ... @@ -6,19 +6,15 @@ use Api\Yohobuy;
use Api\Sign;
/**
* Description of OrderData
* 订单相关的数据模型
*
* @author Administrator
*/
class OrderData
{
/*
* 获取订单数据
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
public static function getOrderData($type, $page, $limit, $gender, $yh_channel, $uid)
public static function getOrderData($type, $page, $limit, $gender, $channel, $uid)
{
//构建必传参数
$param = Yohobuy::param();
... ... @@ -28,7 +24,7 @@ class OrderData
$param['page'] = $page;
$param['type'] = $type;
$param['uid'] = $uid;
$param['yh_channel'] = $yh_channel;
$param['yh_channel'] = $channel;
$param['client_secret'] = Sign::getSign($param);
//调用接口获得数据
return Yohobuy::get(Yohobuy::API_URL, $param);
... ... @@ -36,18 +32,15 @@ class OrderData
/*
* 取消订单
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
public static function cancelOrderData($order_code, $uid, $gender, $yh_channel)
public static function cancelOrderData($orderCode, $uid, $gender, $channel)
{
//构建必传参数
$param = Yohobuy::param();
$param['order_code'] = $order_code;
$param['order_code'] = $orderCode;
$param['uid'] = $uid;
$param['gender'] = $gender;
$param['yh_channel'] = $yh_channel;
$param['yh_channel'] = $channel;
$param['method'] = 'app.SpaceOrders.close';
$param['client_secret'] = Sign::getSign($param);
//调用接口获得数据
... ... @@ -56,23 +49,41 @@ class OrderData
/*
* 删除订单
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
public static function deleteOrderData($order_code, $uid, $gender, $yh_channel)
public static function deleteOrderData($orderCode, $uid, $gender, $channel)
{
//构建必传参数
$param = Yohobuy::param();
$param['order_code'] = $order_code;
$param['order_code'] = $orderCode;
$param['uid'] = $uid;
$param['gender'] = $gender;
$param['yh_channel'] = $yh_channel;
$param['yh_channel'] = $channel;
$param['method'] = 'app.SpaceOrders.delOrderByCode';
$param['client_secret'] = Sign::getSign($param);
//调用接口删除订单
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 查看订单详情
*
* @param string $orderCode 订单号
* @param int $uid 用户ID
* @param string $sessionKey 用户会话
* @return array
*/
public static function viewOrderData($orderCode, $uid, $sessionKey)
{
$param = Yohobuy::param();
$param['method'] = 'app.SpaceOrders.info';
$param['order_code'] = $orderCode;
$param['uid'] = $uid;
$param['session_key'] = $sessionKey;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/*
* 我的订单-查看物流
*
... ...
... ... @@ -215,9 +215,9 @@ class Helpers
$result['salePrice'] && $result['salePrice'] .= '.00';
}
$result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y');
$result['url'] = SITE_MAIN . '/product/pro_' . $productData['product_id'] . '_'
$result['url'] = self::url('/product/pro_' . $productData['product_id'] . '_'
. $productData['goods_list'][0]['goods_id']
. '/' . $productData['cn_alphabet'] . '.html';
. '/' . $productData['cn_alphabet'] . '.html');
// APP访问需要加附加的参数
// 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护
if ($isApp) {
... ... @@ -498,10 +498,15 @@ class Helpers
/**
* 格式化订单商品
*
* @param array $orderGoods 订单
* @param int $count 计订单件数
* @param bool $haveLink 控制是否需要商品链接
*/
public static function formatOrderGoods($orderGoods, &$count = 0)
public static function formatOrderGoods($orderGoods, &$count = 0, $haveLink = false)
{
$arr = array();
foreach ($orderGoods as $key => $vo) {
$arr[$key]['thumb'] = Helpers::getImageUrl($vo['goods_image'], 90, 120);
$arr[$key]['name'] = $vo['product_name'];
... ... @@ -519,9 +524,14 @@ class Helpers
if (!empty($vo['expect_arrival_time'])) {
$arr[$key]['appearDate'] = $vo['expect_arrival_time'];
}
// 商品链接
if ($haveLink && isset($vo['product_id'])) {
$arr[$key]['link'] = self::url('/product/pro_' . $vo['product_id'] . '_' . $vo['goods_id'] . '/' . $vo['cn_alphabet'] . '.html');
}
// 累计购买数
$count += intval($vo['buy_number']);
}
return $arr;
}
... ...
... ... @@ -25,6 +25,7 @@
</p>
</div>
{{#if unreceived}}
{{#if logisticsUrl}}
<a class="logistics sub" href="{{logisticsUrl}}">
<span class="iconfont">&#xe630;</span>
<p class="beside-icon sub-content">
... ... @@ -35,6 +36,7 @@
<span class="iconfont icon-right">&#xe614;</span>
</a>
{{/if}}
{{/if}}
</section>
<section class="goods block">
... ... @@ -46,23 +48,27 @@
<ul class="cost block">
<li>
商品总金额
<span>¥{{sumPrice}}</span>
<span>{{sumPrice}}</span>
</li>
<li>
活动金额
<span>{{salePrice}}</span>
<span>{{salePrice}}</span>
</li>
<li>
运费
<span>+¥{{freight}}</span>
<span>{{freight}}</span>
</li>
<li>
优惠券
<span>{{coupon}}</span>
</li>
<li>
YOHO币
<span>{{yohoCoin}}</span>
<span>{{yohoCoin}}</span>
</li>
<li>
实付金额
<span>¥{{price}}</span>
<span>{{price}}</span>
</li>
</ul>
... ... @@ -75,10 +81,12 @@
{{#if unpaid}}
<span class="btn btn-cancel">取消订单</span>
{{#if payUrl}}
<a href="{{payUrl}}">
<span class="btn btn-pay">立即付款</span>
</a>
{{/if}}
{{/if}}
{{#if unreceived}}
<a href="{{logisticsUrl}}">
... ...
<div class="order-good" data-id="{{id}}">
<div class="thumb-wrap">
{{#if link}}
<a href="{{link}}"><img class="thumb lazy" data-original="{{thumb}}"></a>
{{else}}
<img class="thumb lazy" data-original="{{thumb}}">
{{/if}}
<p class="tag{{#if gift}} gift-tag{{/if}}{{#if advanceBuy}} advance-buy-tag{{/if}}"></p>
</div>
<div class="deps">
... ...
... ... @@ -36,9 +36,7 @@ class ChristmasController extends HuodongAction
switch (intval($result['code'])) {
case 200: // 领取成功, 发送站内信消息
$showPopupFlag = '0';
$title = '【优惠券】您有6张潮集圣诞优惠券';
$content = '尊敬的客户:恭喜您成功获得6张潮集圣诞优惠券 !您可以在个人中心的交易管理中查看‘我的优惠券’。';
ActivityData::message($uid, $title, $content);
$this->sendMessage($uid);
break;
case 201: // 已领取过, 提示重复领券
$showPopupFlag = '1';
... ... @@ -53,10 +51,10 @@ class ChristmasController extends HuodongAction
'staticTitle' => '潮集圣诞',
'weixinShare' => $this->_isApp ? false : true, // 是否需要微信分享
'shareLink' => 'http://feature.yoho.cn/1211APPTEST3/index.html',
'shareTitle' => 'YOHO!BUY有货【潮集圣诞】第一弹疯狂来袭!500元优惠券引爆圣诞!',
'shareDesc' => '800+潮牌限时4折起,折上满减,最高直减¥100!',
'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/05/02a7ec01785c8579ed10bdb65a16d60a44.png',
'shareLink' => 'http://feature.yohobuy.com/0/0/675/index.html',
'shareTitle' => 'YOHO!BUY有货【潮集圣诞】第一弹来袭!500元优惠券引爆圣诞!',
'shareDesc' => '万件潮品限时58折封顶,再享折上满减,还有惊喜圣诞礼物等你来挑哦!',
'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/09/029fd41969b67002126ff7a71fe5396b6e.png',
'showPopupFlag' => $showPopupFlag,
'myCouponUrl' => $myCouponUrl,
... ... @@ -70,10 +68,10 @@ class ChristmasController extends HuodongAction
*
* @return int
*/
public function getLoggedUid()
private function getLoggedUid()
{
// 判断是否是应用访问, 拼接APP需要的URL参数
$this->_isApp = null !== $this->get('app_version');
$this->_isApp = (null !== $this->get('app_version') || null !== $this->get('uid'));
$uid = false;
if ($this->_isApp) {
$uid = $this->get('uid');
... ... @@ -85,6 +83,21 @@ class ChristmasController extends HuodongAction
}
/**
* 发送站内信
*
* @param int $uid 用户ID
*/
private function sendMessage($uid)
{
try {
ActivityData::message($uid, '【优惠券】您有6张潮集圣诞优惠券', '尊敬的客户:恭喜您成功获得6张潮集圣诞优惠券 !您可以在个人中心的交易管理中查看‘我的优惠券’。');
}
catch (Exception $e) {
// do nothing
}
}
/**
* 根据环境来获取活动ID
*
* @return int
... ...
... ... @@ -48,7 +48,7 @@ class HomeController extends AbstractAction
'showDownloadApp' => true,
'pageFooter' => true,
'cartUrl' => Helpers::url('/cart/index/index', null),
'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home')) ),
'signinUrl' => Helpers::url('/signin.html', array('refer' => Helpers::url('/home'))),
);
$uid = $this->getUid(false);
if ($uid) {
... ... @@ -781,14 +781,14 @@ class HomeController extends AbstractAction
// 审判跳转登录页
$this->auditJumpLogin();
$this->setTitle('支付中心');
$this->setNavHeader('支付中心');
$orderCode = $this->get('order_code');
if (empty($orderCode)) {
$this->error();
}
$this->setTitle('支付中心');
$this->setNavHeader('支付中心');
$this->_view->display('pay', array(
'payCenterPage' => true,
'payAppInfo' => array(
... ... @@ -814,61 +814,26 @@ class HomeController extends AbstractAction
));
}
// /*
// * 我的订单-确认收货
// */
// private function confirmAction(){
// //
// $gender = Helpers::getGenderByCookie();
// $order_code = $this->get('id');
// $order_code = '';
// $yh_channel = $this->get('yh_channel', 1);
// $data = OrderData::confirmData($gender,$order_code,$yh_channel,$this->_uid);
// $this->echoJson($data);
// }
/**
* 订单详情页
*/
public function orderDetailAction()
{
$data = array(
'name' => '毛毛莉Lydia',
'phoneNum' => '18600001133',
'address' => '南京市建邺区嘉陵江东街18号国家广告产业园5栋17楼',
'orderStatus' => '订单取消',
'orderNum' => '418358063',
'orderTime' => '2014-03-10 17:25:10',
'orderCancel' => true,
'goods' => array(
array(
'id' => 1,
'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'Adidas Originals ZX FLUXM22508',
'color' => '黄',
'size' => '43',
'price' => '699.00',
'count' => '2'
),
array(
'id' => 1,
'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/11/04/05/0188f1aca49ac478a565ec029b5d2d4a6c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'B.Duck浴室玩伴mini浮水鸭',
'gift' => true,
'color' => '黄',
'size' => '43',
'price' => '0.00',
'count' => '1'
)
),
'sumPrice' => 799,
'salePrice' => 80,
'freight' => 5,
'coupon' => 0,
'yohoCoin' => 5,
'price' => 719
);
$this->_view->display('order-detail', array('orderDetail' => $data, 'orderDetailPage' => true));
// 审判跳转登录页
$this->auditJumpLogin();
$orderCode = $this->get('order_code', 1507880870);
if (empty($orderCode)) {
$this->error();
}
$this->setTitle('订单详情');
$this->setNavHeader('订单详情');
$this->_view->display('order-detail', array(
'orderDetailPage' => true,
'orderDetail' => OrderModel::orderDetail($orderCode, 967016/*$this->_uid*/, 'a3aadd4cce408f8ee062a9add02e8faa'/*$this->_session*/),
));
}
// /**
... ...
... ... @@ -10,20 +10,21 @@ use Plugin\Helpers;
*/
class ShoppingCartController extends AbstractAction
{
protected $_uid;
/**
* 初始化
* 通过当前用户审判是否跳到登录
*
* @param int $useSession (true:从服务端session中检查, false:从客户端cookie中检查)
* @return void
*/
public function init()
protected function auditJumpLogin($useSession = true)
{
// 检查用户是否登录, 未登录则跳转到登录页
$this->_uid = $this->getUid();
if (!$this->_uid) {
$this->go(Helpers::url('/signin.html'));
$uid = $this->getUid($useSession);
if (!$uid) {
$this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', SITE_MAIN))));
}
parent::init();
}
/*
... ... @@ -91,10 +92,10 @@ class ShoppingCartController extends AbstractAction
if ($this->isAjax()) {
$params = array();
$params['old_product_sku']= $this->post('old_product_sku', 0);
$params['new_product_sku']= $this->post('new_product_sku', 0);
$params['buy_number']= $this->post('buy_number', 0);
$params['selected']= $this->post('selected', null);
$params['old_product_sku'] = $this->post('old_product_sku', 0);
$params['new_product_sku'] = $this->post('new_product_sku', 0);
$params['buy_number'] = $this->post('buy_number', 0);
$params['selected'] = $this->post('selected', null);
$result = CartModel::modifyCartProduct($this->_uid, $params);
}
... ... @@ -150,7 +151,8 @@ class ShoppingCartController extends AbstractAction
'navBack' => true, 'navTitle' => '加价购'), 'shoppingCart' => $data));
}
public function orderEnsureAction() {
public function orderEnsureAction()
{
$data = array(
'orderEnsurePage' => true,
'orderEnsure' => array(
... ... @@ -258,18 +260,6 @@ class ShoppingCartController extends AbstractAction
}
/**
* 读取chose-panel内容
*/
public function tplAction()
{
if($this->isAjax()) {
$data = file_get_contents('../../../template/m.yohobuy.com/partials/shopping-cart/chose-panel.phtml');
echo($data);
}
}
public function goodinfoAction()
{
$result = array();
... ... @@ -287,4 +277,5 @@ class ShoppingCartController extends AbstractAction
$this->echoJson($result);
}
}
}
... ...
... ... @@ -68,86 +68,20 @@ class OrderModel
}
//检查数据返回是否正常,正常则处理数据
if (!empty($data['data']['order_list'])) {
// 订单的状态列表
//$orderStatus = Helpers::getOrderStatus();
$count = 0;
foreach ($data['data']['order_list'] as $key => $vo) {
// if ($vo['payment_status'] == 'Y' && $vo['status'] == 0) {
// $vo['status'] = 1;
// }
// 订单件数清零
$count = 0;
//根据订单status判断订单处于什么状态。
$result[$key] = self::getOrderStatus($vo);
//订单号,支付状态,订单商品数量,订单总价格
$result[$key]['orderNum'] = $vo['order_code'];
//$result[$key]['orderStatus'] = ($vo['is_cancel'] === 'Y') ? '已取消' : $orderStatus[ $vo['payment_type'] ][ $vo['status'] ];
$result[$key]['orderStatus'] = $vo['status_str'];
$result[$key]['sumCost'] = $vo['amount'];
//类内调用格式化订单商品数据方法
$result[$key]['goods'] = Helpers::formatOrderGoods($vo['order_goods'], $count);
$result[$key]['detailUrl'] = Helpers::url('/home/orders/detail', array('order_code' => $vo['order_code'], 't' => time()));
$result[$key]['count'] = $count;
//根据订单status判断订单处于什么状态。
do {
//订单取消状态 = Y 时,跳出判断订单状态循环,并设置订单状态为已取消。
if ($vo['is_cancel'] === 'Y') {
$result[$key]['canceled'] = true;
break;
}
/* 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态)
* 付款方式:1 => 在线支付,2 => 货到付款,3 => 现金支付,4 => 抵消支付;
*/
//支付方式为非货到付款时,计算订单状态。
if ($vo['payment_type'] != 2) {
switch ($vo['status']) {
case 0: // 待付款
$result[$key]['unpaid'] = true;
$result[$key]['payUrl'] = Helpers::url('/home/pay', array('order_code' => $vo['order_code']));
break;
//未发货&未收货 状态,统一合并到待收货状态。
case 1:
case 2:
case 3:
//已付款状态不给查看物流URL
$result[$key]['unreceived'] = true;
break;
case 4:
case 5:
//已发货状态,给查看物流URL
$result[$key]['unreceived'] = true;
$result[$key]['logisticsUrl'] = Helpers::url('/home/logistic', array('order_code' => $vo['order_code']));
break;
case 6:
$result[$key]['completed'] = true;
break;
default:
break;
}
break;
}
//订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态)
switch ($vo['status']) {
case 0: // 备货中
$result[$key]['unpaid'] = true;
break;
case 1:
case 2:
case 3:
//备货中、已付款状态不给查看物流链接
$result[$key]['unreceived'] = true;
break;
case 4:
case 5:
//待收货状态,给查看物流url
$result[$key]['unreceived'] = true;
$result[$key]['logisticsUrl'] = Helpers::url('/home/logistic', array('order_code' => $vo['order_code']));
break;
case 6:
$result[$key]['completed'] = true;
break;
default:
break;
}
} while (false);
}
}
... ... @@ -155,16 +89,6 @@ class OrderModel
}
/**
* 获得支付链接
*/
public static function payment($gender, $yh_channel)
{
$code = self::CODE_PAYMENT;
$data = OrderData::paymentData($gender, $yh_channel, $code);
return $data;
}
/**
* 查看物流
*
* @param int $orderCode 订单编号
... ... @@ -196,6 +120,43 @@ class OrderModel
}
/**
* 获取订单详情信息
*
* @param string $orderCode 订单号
* @param int $uid 用户ID
* @param string $sessionKey 用户的会话
* @return array
*/
public static function orderDetail($orderCode, $uid, $sessionKey)
{
$result = array();
if (is_numeric($orderCode) && is_numeric($uid) && is_string($sessionKey)) {
$orderDetail = OrderData::viewOrderData($orderCode, $uid, $sessionKey);
if (isset($orderDetail['data']['order_code'])) {
$count = 0;
$result = self::getOrderStatus($orderDetail['data'], true); // 订单状态
$result['name'] = $orderDetail['data']['user_name'];
$result['phoneNum'] = $orderDetail['data']['mobile'];
$result['address'] = $orderDetail['data']['area'] . $orderDetail['data']['address'];
$result['orderStatus'] = $orderDetail['data']['status_str'];
$result['orderNum'] = $orderDetail['data']['order_code'];
$result['orderTime'] = date('Y-m-d H:i:s', $orderDetail['data']['create_time']);
$result['goods'] = Helpers::formatOrderGoods($orderDetail['data']['order_goods'], $count, true);
$result['sumPrice'] = $orderDetail['data']['goods_total_amount']; // 商品总金额
$result['salePrice'] = $orderDetail['data']['promotion_amount']; // 活动金额
$result['freight'] = $orderDetail['data']['shipping_cost']; // 运费
$result['coupon'] = $orderDetail['data']['coupons_amount']; // 优惠券
$result['yohoCoin'] = $orderDetail['data']['yoho_coin_num']; // YOHO币
$result['price'] = $orderDetail['data']['amount']; // 实付金额
}
}
return $result;
}
/**
* 根据type值设置nav属性
*/
public static function getNavs($type)
... ... @@ -218,4 +179,89 @@ class OrderModel
return $nav;
}
/**
* 获取订单状态
*
* @param array $order 订单
* @param bool $showLogistics 控制是否显示物流信息
* @return array
*/
private static function getOrderStatus($order, $showLogistics = false)
{
$result = array();
//根据订单status判断订单处于什么状态。
do {
//订单取消状态 = Y 时,跳出判断订单状态循环,并设置订单状态为已取消。
if ($order['is_cancel'] === 'Y') {
$result['canceled'] = true;
break;
}
// 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态)
// 支付方式为非货到付款时,计算订单状态。
if ($order['payment_type'] != 2) {
switch ($order['status']) {
case 0: // 待付款
$result['unpaid'] = true;
$result['payUrl'] = Helpers::url('/home/pay', array('order_code' => $order['order_code']));
break;
//未发货&未收货 状态,统一合并到待收货状态。
case 1:
case 2:
case 3:
//已付款状态不给查看物流URL
$result['unreceived'] = true;
break;
case 4:
case 5:
//已发货状态,给查看物流URL
$result['unreceived'] = true;
$result['logisticsUrl'] = Helpers::url('/home/logistic', array('order_code' => $order['order_code']));
if ($showLogistics) {
$result['logisticsCompany'] = $order['caption'];
$result['logisticsNum'] = $order['express_number'];
}
break;
case 6:
$result['completed'] = true;
break;
default:
break;
}
break;
}
// 订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态)
switch ($order['status']) {
case 0: // 备货中
$result['unpaid'] = true;
break;
case 1:
case 2:
case 3:
//备货中、已付款状态不给查看物流链接
$result['unreceived'] = true;
break;
case 4:
case 5:
//待收货状态,给查看物流url
$result['unreceived'] = true;
$result['logisticsUrl'] = Helpers::url('/home/logistic', array('order_code' => $order['order_code']));
if ($showLogistics) {
$result['logisticsCompany'] = isset($order['caption']) ? $order['caption'] : '';
$result['logisticsNum'] = isset($order['express_number']) ? $order['express_number'] : '';
}
break;
case 6:
$result['completed'] = true;
break;
default:
break;
}
} while (false);
return $result;
}
}
... ...
... ... @@ -18,35 +18,39 @@ class CartModel
{
/**
* 获取购物车数据
*
* @param integer $uid 用户ID
* @return array|mixed 处理之后的购物车数据
*/
public static function getCartData($uid)
{
$result = array(
'cartNav' => true,
'showLoginInfo' => true
);
$result = array();
// 提示登录
if (!$uid) {
$result['showLoginInfo'] = true;
}
// 普通购物车和预售购物车的数据总数
$result['cartNav']['commonGoodsCount'] = '0';
$result['cartNav']['presellGoodsCount'] = '0';
// 调用接口获取购物车的数据
$cartData = CartData::cartData($uid);
// 处理普通购物车和预售购物车的数据
if (isset($cartData['data']) && !empty($cartData['data'])) {
$cart = $cartData['data'];
/* 普通购物车 */
if(isset($cart['ordinary_cart_data'])) {
$result['commonGoodsCount'] = count($cart['ordinary_cart_data']['goods_list']);
$result['commonCart'] = self::procCartData($cart['ordinary_cart_data']);
if (!empty($cartData['data']['ordinary_cart_data']['goods_list'])) {
$result['cartNav']['commonGoodsCount'] = count($cartData['data']['ordinary_cart_data']['goods_list']);
$result['commonCart'] = self::procCartData($cartData['data']['ordinary_cart_data']);
}
/* 预售购物车 */
if(isset($cart['advance_cart_data'])) {
$result['presellGoodsCount'] = count($cart['advance_cart_data']['goods_list']);
$result['preSellCart'] = self::procCartData($cart['advance_cart_data']);
}
if (!empty($cartData['data']['advance_cart_data']['goods_list'])) {
$result['cartNav']['presellGoodsCount'] = count($cartData['data']['advance_cart_data']['goods_list']);
$result['preSellCart'] = self::procCartData($cartData['data']['advance_cart_data']);
}
return $result;
... ... @@ -185,7 +189,6 @@ class CartModel
return $result;
}
/**
* 处理不同类型的购物车数据
*
... ...
s[common]
[common]
;;默认项目
application.directory = APPLICATION_PATH "/application"
;;website library
... ...