...
|
...
|
@@ -37,6 +37,9 @@ class CartModel |
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
// 存放分析用的数据
|
|
|
$analysisData = array('ipinyou' => '');
|
|
|
|
|
|
do {
|
|
|
$result['isEmpty'] = false;
|
|
|
|
...
|
...
|
@@ -121,44 +124,36 @@ class CartModel |
|
|
// 普通的
|
|
|
if (!empty($ordinaryCartData['goods_list'])) {
|
|
|
$result['commonSell']['cartProductNum'] = strval($ordinaryCount);
|
|
|
$result['commonSell']['productItem'] = Helpers::formatCartGoods($ordinaryCartData['goods_list'], false, true);
|
|
|
$result['commonSell']['productItem'] = Helpers::formatCartGoods($ordinaryCartData['goods_list'], false, true, false, $analysisData);
|
|
|
}
|
|
|
// 预售的
|
|
|
if (!empty($advanceCartData['goods_list'])) {
|
|
|
$result['preSell']['cartProductNum'] = strval($advanceCount);
|
|
|
$result['preSell']['productItem'] = Helpers::formatCartGoods($advanceCartData['goods_list'], true, true);
|
|
|
$result['preSell']['productItem'] = Helpers::formatCartGoods($advanceCartData['goods_list'], true, true, false, $analysisData);
|
|
|
}
|
|
|
|
|
|
/* 已售磬失效 */
|
|
|
// 普通的
|
|
|
if (!$ordinarySoldOut) {
|
|
|
//$result['commonSell']['cartProductNum'] += count($ordinaryCartData['sold_out_goods_list']);
|
|
|
$result['commonSell']['productItem'] = isset($result['commonSell']['productItem'])
|
|
|
? self::appendProductItem($result['commonSell']['productItem'], Helpers::formatCartGoods($ordinaryCartData['sold_out_goods_list'], false, true), count($result['commonSell']['productItem']))
|
|
|
: Helpers::formatCartGoods($ordinaryCartData['sold_out_goods_list'], false, true);
|
|
|
$result['commonSell']['productItem'] = isset($result['commonSell']['productItem']) ? self::appendProductItem($result['commonSell']['productItem'], Helpers::formatCartGoods($ordinaryCartData['sold_out_goods_list'], false, true), count($result['commonSell']['productItem'])) : Helpers::formatCartGoods($ordinaryCartData['sold_out_goods_list'], false, true, false, $analysisData);
|
|
|
}
|
|
|
// 预售的
|
|
|
if (!$advanceSoldOut) {
|
|
|
//$result['preSell']['cartProductNum'] += count($advanceCartData['sold_out_goods_list']);
|
|
|
$result['preSell']['productItem'] = isset($result['preSell']['productItem'])
|
|
|
? self::appendProductItem($result['preSell']['productItem'], Helpers::formatCartGoods($advanceCartData['sold_out_goods_list'], true, true), count($result['preSell']['productItem']))
|
|
|
: Helpers::formatCartGoods($advanceCartData['sold_out_goods_list'], true, true);
|
|
|
$result['preSell']['productItem'] = isset($result['preSell']['productItem']) ? self::appendProductItem($result['preSell']['productItem'], Helpers::formatCartGoods($advanceCartData['sold_out_goods_list'], true, true), count($result['preSell']['productItem'])) : Helpers::formatCartGoods($advanceCartData['sold_out_goods_list'], true, true, false, $analysisData);
|
|
|
}
|
|
|
|
|
|
/* 已失效的 */
|
|
|
// 普通的
|
|
|
if (!$ordinaryOffShelves) {
|
|
|
//$result['commonSell']['cartProductNum'] += count($ordinaryCartData['off_shelves_goods_list']);
|
|
|
$result['commonSell']['productItem'] = isset($result['commonSell']['productItem'])
|
|
|
? self::appendProductItem($result['commonSell']['productItem'], Helpers::formatCartGoods($ordinaryCartData['off_shelves_goods_list'], false, true, true), count($result['commonSell']['productItem']))
|
|
|
: Helpers::formatCartGoods($ordinaryCartData['off_shelves_goods_list'], false, true, true);
|
|
|
$result['commonSell']['productItem'] = isset($result['commonSell']['productItem']) ? self::appendProductItem($result['commonSell']['productItem'], Helpers::formatCartGoods($ordinaryCartData['off_shelves_goods_list'], false, true, true), count($result['commonSell']['productItem'])) : Helpers::formatCartGoods($ordinaryCartData['off_shelves_goods_list'], false, true, true, $analysisData);
|
|
|
}
|
|
|
// 预售的
|
|
|
if (!$advanceOffShelves) {
|
|
|
//$result['preSell']['cartProductNum'] += count($advanceCartData['off_shelves_goods_list']);
|
|
|
$result['preSell']['productItem'] = isset($result['preSell']['productItem'])
|
|
|
? self::appendProductItem($result['preSell']['productItem'], Helpers::formatCartGoods($advanceCartData['off_shelves_goods_list'], true, true, true), count($result['preSell']['productItem']))
|
|
|
: Helpers::formatCartGoods($advanceCartData['off_shelves_goods_list'], true, true, true);
|
|
|
$result['preSell']['productItem'] = isset($result['preSell']['productItem']) ? self::appendProductItem($result['preSell']['productItem'], Helpers::formatCartGoods($advanceCartData['off_shelves_goods_list'], true, true, true), count($result['preSell']['productItem'])) : Helpers::formatCartGoods($advanceCartData['off_shelves_goods_list'], true, true, true, $analysisData);
|
|
|
}
|
|
|
|
|
|
/* 赠品 */
|
...
|
...
|
@@ -168,22 +163,17 @@ class CartModel |
|
|
}
|
|
|
// 普通的
|
|
|
if (!empty($ordinaryCartData['gift_list'])) {
|
|
|
$result['subjoinItem'] = isset($result['subjoinItem']) ? self::appendProductItem($result['subjoinItem'], Helpers::formatGiftPriceGoods($ordinaryCartData['gift_list'], true), count($result['subjoinItem']))
|
|
|
: Helpers::formatGiftPriceGoods($ordinaryCartData['gift_list'], true);
|
|
|
$result['subjoinItem'] = isset($result['subjoinItem']) ? self::appendProductItem($result['subjoinItem'], Helpers::formatGiftPriceGoods($ordinaryCartData['gift_list'], true), count($result['subjoinItem'])) : Helpers::formatGiftPriceGoods($ordinaryCartData['gift_list'], true);
|
|
|
}
|
|
|
|
|
|
/* 加价购 */
|
|
|
// 预售的
|
|
|
if (!empty($advanceCartData['price_gift'])) {
|
|
|
$result['subjoinItem'] = isset($result['subjoinItem'])
|
|
|
? self::appendProductItem($result['subjoinItem'], Helpers::formatGiftPriceGoods($advanceCartData['price_gift'], false), count($result['subjoinItem']))
|
|
|
: Helpers::formatGiftPriceGoods($advanceCartData['price_gift'], false);
|
|
|
$result['subjoinItem'] = isset($result['subjoinItem']) ? self::appendProductItem($result['subjoinItem'], Helpers::formatGiftPriceGoods($advanceCartData['price_gift'], false), count($result['subjoinItem'])) : Helpers::formatGiftPriceGoods($advanceCartData['price_gift'], false);
|
|
|
}
|
|
|
// 普通的
|
|
|
if (!empty($ordinaryCartData['price_gift'])) {
|
|
|
$result['subjoinItem'] = isset($result['subjoinItem'])
|
|
|
? self::appendProductItem($result['subjoinItem'], Helpers::formatGiftPriceGoods($ordinaryCartData['price_gift'], false), count($result['subjoinItem']))
|
|
|
: Helpers::formatGiftPriceGoods($ordinaryCartData['price_gift'], false);
|
|
|
$result['subjoinItem'] = isset($result['subjoinItem']) ? self::appendProductItem($result['subjoinItem'], Helpers::formatGiftPriceGoods($ordinaryCartData['price_gift'], false), count($result['subjoinItem'])) : Helpers::formatGiftPriceGoods($ordinaryCartData['price_gift'], false);
|
|
|
}
|
|
|
|
|
|
/* 促销短语 */
|
...
|
...
|
@@ -205,6 +195,12 @@ class CartModel |
|
|
|
|
|
} while (false);
|
|
|
|
|
|
// 增加第三方分析用的数据
|
|
|
$result['ids'] = empty($analysisData['ids']) ? '' : implode(',', $analysisData['ids']);
|
|
|
$result['ipinyou'] = empty($analysisData['ipinyou']) ? '' : $analysisData['ipinyou'];
|
|
|
$result['ipinyouAmount'] = isset($result['productAllA']) ? $result['productAllA'] : '0.00';
|
|
|
$result['criteo'] = empty($analysisData['criteo']) ? '' : json_encode($analysisData['criteo']);
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -482,7 +478,7 @@ class CartModel |
|
|
foreach ($sknList as $value) {
|
|
|
$value = explode('-', $value);
|
|
|
if (isset($value[1])) {
|
|
|
$sknArr[ $value[0] ] = $value[1];
|
|
|
$sknArr[$value[0]] = $value[1];
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -746,7 +742,6 @@ class CartModel |
|
|
$isNewUser = false;
|
|
|
}
|
|
|
$result['isNewUser'] = $isNewUser ? true : false;
|
|
|
|
|
|
} while (false);
|
|
|
|
|
|
return $result;
|
...
|
...
|
@@ -1007,7 +1002,7 @@ class CartModel |
|
|
} else if (!empty($phoneNum) && !is_numeric($phoneNum)) {
|
|
|
$result['code'] = 406;
|
|
|
$result['message'] = '输入的固定电话格式不正确';
|
|
|
} else if ((!empty($phoneNum) && empty($phoneCode)) || (!empty($phoneCode) && empty($phoneNum)) ) {
|
|
|
} else if ((!empty($phoneNum) && empty($phoneCode)) || (!empty($phoneCode) && empty($phoneNum))) {
|
|
|
$result['code'] = 407;
|
|
|
$result['message'] = '输入的固定电话格式不正确';
|
|
|
} else {
|
...
|
...
|
@@ -1105,7 +1100,6 @@ class CartModel |
|
|
$result[] = $build;
|
|
|
}
|
|
|
$couponList = array();
|
|
|
|
|
|
} while (false);
|
|
|
|
|
|
return $result;
|
...
|
...
|
@@ -1165,7 +1159,7 @@ class CartModel |
|
|
{
|
|
|
foreach ($data as $value) {
|
|
|
$source[$index] = $value;
|
|
|
++ $index;
|
|
|
++$index;
|
|
|
}
|
|
|
|
|
|
return $source;
|
...
|
...
|
|