|
@@ -37,6 +37,9 @@ class CartModel |
|
@@ -37,6 +37,9 @@ class CartModel |
37
|
{
|
37
|
{
|
38
|
$result = array();
|
38
|
$result = array();
|
39
|
|
39
|
|
|
|
40
|
+ // 存放分析用的数据
|
|
|
41
|
+ $analysisData = array('ipinyou' => '');
|
|
|
42
|
+
|
40
|
do {
|
43
|
do {
|
41
|
$result['isEmpty'] = false;
|
44
|
$result['isEmpty'] = false;
|
42
|
|
45
|
|
|
@@ -121,44 +124,36 @@ class CartModel |
|
@@ -121,44 +124,36 @@ class CartModel |
121
|
// 普通的
|
124
|
// 普通的
|
122
|
if (!empty($ordinaryCartData['goods_list'])) {
|
125
|
if (!empty($ordinaryCartData['goods_list'])) {
|
123
|
$result['commonSell']['cartProductNum'] = strval($ordinaryCount);
|
126
|
$result['commonSell']['cartProductNum'] = strval($ordinaryCount);
|
124
|
- $result['commonSell']['productItem'] = Helpers::formatCartGoods($ordinaryCartData['goods_list'], false, true);
|
127
|
+ $result['commonSell']['productItem'] = Helpers::formatCartGoods($ordinaryCartData['goods_list'], false, true, false, $analysisData);
|
125
|
}
|
128
|
}
|
126
|
// 预售的
|
129
|
// 预售的
|
127
|
if (!empty($advanceCartData['goods_list'])) {
|
130
|
if (!empty($advanceCartData['goods_list'])) {
|
128
|
$result['preSell']['cartProductNum'] = strval($advanceCount);
|
131
|
$result['preSell']['cartProductNum'] = strval($advanceCount);
|
129
|
- $result['preSell']['productItem'] = Helpers::formatCartGoods($advanceCartData['goods_list'], true, true);
|
132
|
+ $result['preSell']['productItem'] = Helpers::formatCartGoods($advanceCartData['goods_list'], true, true, false, $analysisData);
|
130
|
}
|
133
|
}
|
131
|
|
134
|
|
132
|
/* 已售磬失效 */
|
135
|
/* 已售磬失效 */
|
133
|
// 普通的
|
136
|
// 普通的
|
134
|
if (!$ordinarySoldOut) {
|
137
|
if (!$ordinarySoldOut) {
|
135
|
//$result['commonSell']['cartProductNum'] += count($ordinaryCartData['sold_out_goods_list']);
|
138
|
//$result['commonSell']['cartProductNum'] += count($ordinaryCartData['sold_out_goods_list']);
|
136
|
- $result['commonSell']['productItem'] = isset($result['commonSell']['productItem'])
|
|
|
137
|
- ? self::appendProductItem($result['commonSell']['productItem'], Helpers::formatCartGoods($ordinaryCartData['sold_out_goods_list'], false, true), count($result['commonSell']['productItem']))
|
|
|
138
|
- : Helpers::formatCartGoods($ordinaryCartData['sold_out_goods_list'], false, true);
|
139
|
+ $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);
|
139
|
}
|
140
|
}
|
140
|
// 预售的
|
141
|
// 预售的
|
141
|
if (!$advanceSoldOut) {
|
142
|
if (!$advanceSoldOut) {
|
142
|
//$result['preSell']['cartProductNum'] += count($advanceCartData['sold_out_goods_list']);
|
143
|
//$result['preSell']['cartProductNum'] += count($advanceCartData['sold_out_goods_list']);
|
143
|
- $result['preSell']['productItem'] = isset($result['preSell']['productItem'])
|
|
|
144
|
- ? self::appendProductItem($result['preSell']['productItem'], Helpers::formatCartGoods($advanceCartData['sold_out_goods_list'], true, true), count($result['preSell']['productItem']))
|
|
|
145
|
- : Helpers::formatCartGoods($advanceCartData['sold_out_goods_list'], true, true);
|
144
|
+ $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);
|
146
|
}
|
145
|
}
|
147
|
|
146
|
|
148
|
/* 已失效的 */
|
147
|
/* 已失效的 */
|
149
|
// 普通的
|
148
|
// 普通的
|
150
|
if (!$ordinaryOffShelves) {
|
149
|
if (!$ordinaryOffShelves) {
|
151
|
//$result['commonSell']['cartProductNum'] += count($ordinaryCartData['off_shelves_goods_list']);
|
150
|
//$result['commonSell']['cartProductNum'] += count($ordinaryCartData['off_shelves_goods_list']);
|
152
|
- $result['commonSell']['productItem'] = isset($result['commonSell']['productItem'])
|
|
|
153
|
- ? self::appendProductItem($result['commonSell']['productItem'], Helpers::formatCartGoods($ordinaryCartData['off_shelves_goods_list'], false, true, true), count($result['commonSell']['productItem']))
|
|
|
154
|
- : Helpers::formatCartGoods($ordinaryCartData['off_shelves_goods_list'], false, true, true);
|
151
|
+ $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);
|
155
|
}
|
152
|
}
|
156
|
// 预售的
|
153
|
// 预售的
|
157
|
if (!$advanceOffShelves) {
|
154
|
if (!$advanceOffShelves) {
|
158
|
//$result['preSell']['cartProductNum'] += count($advanceCartData['off_shelves_goods_list']);
|
155
|
//$result['preSell']['cartProductNum'] += count($advanceCartData['off_shelves_goods_list']);
|
159
|
- $result['preSell']['productItem'] = isset($result['preSell']['productItem'])
|
|
|
160
|
- ? self::appendProductItem($result['preSell']['productItem'], Helpers::formatCartGoods($advanceCartData['off_shelves_goods_list'], true, true, true), count($result['preSell']['productItem']))
|
|
|
161
|
- : Helpers::formatCartGoods($advanceCartData['off_shelves_goods_list'], true, true, true);
|
156
|
+ $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);
|
162
|
}
|
157
|
}
|
163
|
|
158
|
|
164
|
/* 赠品 */
|
159
|
/* 赠品 */
|
|
@@ -168,22 +163,17 @@ class CartModel |
|
@@ -168,22 +163,17 @@ class CartModel |
168
|
}
|
163
|
}
|
169
|
// 普通的
|
164
|
// 普通的
|
170
|
if (!empty($ordinaryCartData['gift_list'])) {
|
165
|
if (!empty($ordinaryCartData['gift_list'])) {
|
171
|
- $result['subjoinItem'] = isset($result['subjoinItem']) ? self::appendProductItem($result['subjoinItem'], Helpers::formatGiftPriceGoods($ordinaryCartData['gift_list'], true), count($result['subjoinItem']))
|
|
|
172
|
- : Helpers::formatGiftPriceGoods($ordinaryCartData['gift_list'], true);
|
166
|
+ $result['subjoinItem'] = isset($result['subjoinItem']) ? self::appendProductItem($result['subjoinItem'], Helpers::formatGiftPriceGoods($ordinaryCartData['gift_list'], true), count($result['subjoinItem'])) : Helpers::formatGiftPriceGoods($ordinaryCartData['gift_list'], true);
|
173
|
}
|
167
|
}
|
174
|
|
168
|
|
175
|
/* 加价购 */
|
169
|
/* 加价购 */
|
176
|
// 预售的
|
170
|
// 预售的
|
177
|
if (!empty($advanceCartData['price_gift'])) {
|
171
|
if (!empty($advanceCartData['price_gift'])) {
|
178
|
- $result['subjoinItem'] = isset($result['subjoinItem'])
|
|
|
179
|
- ? self::appendProductItem($result['subjoinItem'], Helpers::formatGiftPriceGoods($advanceCartData['price_gift'], false), count($result['subjoinItem']))
|
|
|
180
|
- : Helpers::formatGiftPriceGoods($advanceCartData['price_gift'], false);
|
172
|
+ $result['subjoinItem'] = isset($result['subjoinItem']) ? self::appendProductItem($result['subjoinItem'], Helpers::formatGiftPriceGoods($advanceCartData['price_gift'], false), count($result['subjoinItem'])) : Helpers::formatGiftPriceGoods($advanceCartData['price_gift'], false);
|
181
|
}
|
173
|
}
|
182
|
// 普通的
|
174
|
// 普通的
|
183
|
if (!empty($ordinaryCartData['price_gift'])) {
|
175
|
if (!empty($ordinaryCartData['price_gift'])) {
|
184
|
- $result['subjoinItem'] = isset($result['subjoinItem'])
|
|
|
185
|
- ? self::appendProductItem($result['subjoinItem'], Helpers::formatGiftPriceGoods($ordinaryCartData['price_gift'], false), count($result['subjoinItem']))
|
|
|
186
|
- : Helpers::formatGiftPriceGoods($ordinaryCartData['price_gift'], false);
|
176
|
+ $result['subjoinItem'] = isset($result['subjoinItem']) ? self::appendProductItem($result['subjoinItem'], Helpers::formatGiftPriceGoods($ordinaryCartData['price_gift'], false), count($result['subjoinItem'])) : Helpers::formatGiftPriceGoods($ordinaryCartData['price_gift'], false);
|
187
|
}
|
177
|
}
|
188
|
|
178
|
|
189
|
/* 促销短语 */
|
179
|
/* 促销短语 */
|
|
@@ -205,6 +195,12 @@ class CartModel |
|
@@ -205,6 +195,12 @@ class CartModel |
205
|
|
195
|
|
206
|
} while (false);
|
196
|
} while (false);
|
207
|
|
197
|
|
|
|
198
|
+ // 增加第三方分析用的数据
|
|
|
199
|
+ $result['ids'] = empty($analysisData['ids']) ? '' : implode(',', $analysisData['ids']);
|
|
|
200
|
+ $result['ipinyou'] = empty($analysisData['ipinyou']) ? '' : $analysisData['ipinyou'];
|
|
|
201
|
+ $result['ipinyouAmount'] = isset($result['productAllA']) ? $result['productAllA'] : '0.00';
|
|
|
202
|
+ $result['criteo'] = empty($analysisData['criteo']) ? '' : json_encode($analysisData['criteo']);
|
|
|
203
|
+
|
208
|
return $result;
|
204
|
return $result;
|
209
|
}
|
205
|
}
|
210
|
|
206
|
|
|
@@ -482,7 +478,7 @@ class CartModel |
|
@@ -482,7 +478,7 @@ class CartModel |
482
|
foreach ($sknList as $value) {
|
478
|
foreach ($sknList as $value) {
|
483
|
$value = explode('-', $value);
|
479
|
$value = explode('-', $value);
|
484
|
if (isset($value[1])) {
|
480
|
if (isset($value[1])) {
|
485
|
- $sknArr[ $value[0] ] = $value[1];
|
481
|
+ $sknArr[$value[0]] = $value[1];
|
486
|
}
|
482
|
}
|
487
|
}
|
483
|
}
|
488
|
|
484
|
|
|
@@ -746,7 +742,6 @@ class CartModel |
|
@@ -746,7 +742,6 @@ class CartModel |
746
|
$isNewUser = false;
|
742
|
$isNewUser = false;
|
747
|
}
|
743
|
}
|
748
|
$result['isNewUser'] = $isNewUser ? true : false;
|
744
|
$result['isNewUser'] = $isNewUser ? true : false;
|
749
|
-
|
|
|
750
|
} while (false);
|
745
|
} while (false);
|
751
|
|
746
|
|
752
|
return $result;
|
747
|
return $result;
|
|
@@ -1007,7 +1002,7 @@ class CartModel |
|
@@ -1007,7 +1002,7 @@ class CartModel |
1007
|
} else if (!empty($phoneNum) && !is_numeric($phoneNum)) {
|
1002
|
} else if (!empty($phoneNum) && !is_numeric($phoneNum)) {
|
1008
|
$result['code'] = 406;
|
1003
|
$result['code'] = 406;
|
1009
|
$result['message'] = '输入的固定电话格式不正确';
|
1004
|
$result['message'] = '输入的固定电话格式不正确';
|
1010
|
- } else if ((!empty($phoneNum) && empty($phoneCode)) || (!empty($phoneCode) && empty($phoneNum)) ) {
|
1005
|
+ } else if ((!empty($phoneNum) && empty($phoneCode)) || (!empty($phoneCode) && empty($phoneNum))) {
|
1011
|
$result['code'] = 407;
|
1006
|
$result['code'] = 407;
|
1012
|
$result['message'] = '输入的固定电话格式不正确';
|
1007
|
$result['message'] = '输入的固定电话格式不正确';
|
1013
|
} else {
|
1008
|
} else {
|
|
@@ -1105,7 +1100,6 @@ class CartModel |
|
@@ -1105,7 +1100,6 @@ class CartModel |
1105
|
$result[] = $build;
|
1100
|
$result[] = $build;
|
1106
|
}
|
1101
|
}
|
1107
|
$couponList = array();
|
1102
|
$couponList = array();
|
1108
|
-
|
|
|
1109
|
} while (false);
|
1103
|
} while (false);
|
1110
|
|
1104
|
|
1111
|
return $result;
|
1105
|
return $result;
|
|
@@ -1165,7 +1159,7 @@ class CartModel |
|
@@ -1165,7 +1159,7 @@ class CartModel |
1165
|
{
|
1159
|
{
|
1166
|
foreach ($data as $value) {
|
1160
|
foreach ($data as $value) {
|
1167
|
$source[$index] = $value;
|
1161
|
$source[$index] = $value;
|
1168
|
- ++ $index;
|
1162
|
+ ++$index;
|
1169
|
}
|
1163
|
}
|
1170
|
|
1164
|
|
1171
|
return $source;
|
1165
|
return $source;
|