1
|
<?php
|
1
|
<?php
|
2
|
namespace Product;
|
2
|
namespace Product;
|
3
|
-use LibModels\Web\Product\ItemData;
|
|
|
4
|
-use WebPlugin\Helpers;
|
|
|
5
|
-use WebPlugin\Images;
|
|
|
6
|
-use LibModels\Web\Product\SearchData;
|
|
|
7
|
-use LibModels\Web\Product\FavoriteData;
|
3
|
+
|
8
|
use Api\Yohobuy;
|
4
|
use Api\Yohobuy;
|
9
|
-use WebPlugin\Cache;
|
|
|
10
|
-use Configs\WebCacheConfig;
|
|
|
11
|
use Configs\ChannelConfig;
|
5
|
use Configs\ChannelConfig;
|
|
|
6
|
+use Configs\WebCacheConfig;
|
12
|
use LibModels\Web\Product\BrandData;
|
7
|
use LibModels\Web\Product\BrandData;
|
13
|
-use Product\BrandsModel;
|
8
|
+use LibModels\Web\Product\FavoriteData;
|
|
|
9
|
+use LibModels\Web\Product\ItemData;
|
|
|
10
|
+use LibModels\Web\Product\SearchData;
|
|
|
11
|
+use WebPlugin\Cache;
|
|
|
12
|
+use WebPlugin\Helpers;
|
|
|
13
|
+use WebPlugin\Images;
|
|
|
14
|
+
|
14
|
class ItemModel
|
15
|
class ItemModel
|
15
|
{
|
16
|
{
|
16
|
/**
|
17
|
/**
|
|
@@ -18,10 +19,10 @@ class ItemModel |
|
@@ -18,10 +19,10 @@ class ItemModel |
18
|
* @var array
|
19
|
* @var array
|
19
|
*/
|
20
|
*/
|
20
|
private static $multiResources = array();
|
21
|
private static $multiResources = array();
|
21
|
-
|
22
|
+
|
22
|
/**
|
23
|
/**
|
23
|
* 获取商品信息
|
24
|
* 获取商品信息
|
24
|
- *
|
25
|
+ *
|
25
|
* @param string $productId
|
26
|
* @param string $productId
|
26
|
* @param string $goodsId
|
27
|
* @param string $goodsId
|
27
|
* @param string $uid
|
28
|
* @param string $uid
|
|
@@ -29,13 +30,13 @@ class ItemModel |
|
@@ -29,13 +30,13 @@ class ItemModel |
29
|
* @param string $productSkn
|
30
|
* @param string $productSkn
|
30
|
* @return array
|
31
|
* @return array
|
31
|
*/
|
32
|
*/
|
32
|
- public static function getProductInfo($productId, $goodsId, $uid, $vipLevel = 0, $productSkn = null)
|
33
|
+ public static function getProductInfo($productId, $goodsId, $uid, $vipLevel = 0, $productSkn = null)
|
33
|
{
|
34
|
{
|
34
|
$goodsInfo = array();
|
35
|
$goodsInfo = array();
|
35
|
$statGoodsInfo = array();
|
36
|
$statGoodsInfo = array();
|
36
|
$banner = array();
|
37
|
$banner = array();
|
37
|
$baseInfo = ItemData::baseInfo($productId, $uid, $productSkn);
|
38
|
$baseInfo = ItemData::baseInfo($productId, $uid, $productSkn);
|
38
|
- if(empty($baseInfo['productName']) && empty($baseInfo['erpProductId']) && empty($baseInfo['productPriceBo'])) {
|
39
|
+ if (empty($baseInfo['productName']) && empty($baseInfo['erpProductId']) && empty($baseInfo['productPriceBo'])) {
|
39
|
return array();
|
40
|
return array();
|
40
|
}
|
41
|
}
|
41
|
$baseInfo['uid'] = $uid;
|
42
|
$baseInfo['uid'] = $uid;
|
|
@@ -50,7 +51,7 @@ class ItemModel |
|
@@ -50,7 +51,7 @@ class ItemModel |
50
|
$brandId = 0;
|
51
|
$brandId = 0;
|
51
|
//设置并发请求数据
|
52
|
//设置并发请求数据
|
52
|
self::setMultiResourceByProductBaseInfo($baseInfo);
|
53
|
self::setMultiResourceByProductBaseInfo($baseInfo);
|
53
|
- if(isset($baseInfo['brand']['id'])) {
|
54
|
+ if (isset($baseInfo['brand']['id'])) {
|
54
|
$brandId = $baseInfo['brand']['id'];
|
55
|
$brandId = $baseInfo['brand']['id'];
|
55
|
}
|
56
|
}
|
56
|
//收藏喜欢
|
57
|
//收藏喜欢
|
|
@@ -58,34 +59,51 @@ class ItemModel |
|
@@ -58,34 +59,51 @@ class ItemModel |
58
|
|
59
|
|
59
|
// 商品标签
|
60
|
// 商品标签
|
60
|
$goodsInfo['tags'] = self::getTagsDataByProductInfo($baseInfo);
|
61
|
$goodsInfo['tags'] = self::getTagsDataByProductInfo($baseInfo);
|
61
|
-
|
62
|
+
|
62
|
// 商品促销短语
|
63
|
// 商品促销短语
|
63
|
if (!empty($baseInfo['salesPhrase'])) {
|
64
|
if (!empty($baseInfo['salesPhrase'])) {
|
64
|
$goodsInfo['saleTip'] = $baseInfo['salesPhrase'];
|
65
|
$goodsInfo['saleTip'] = $baseInfo['salesPhrase'];
|
65
|
}
|
66
|
}
|
66
|
-
|
67
|
+
|
67
|
// 商品价格
|
68
|
// 商品价格
|
68
|
if (isset($baseInfo['productPriceBo'])) {
|
69
|
if (isset($baseInfo['productPriceBo'])) {
|
69
|
$goodsInfo['marketPrice'] = $baseInfo['productPriceBo']['formatMarketPrice'];
|
70
|
$goodsInfo['marketPrice'] = $baseInfo['productPriceBo']['formatMarketPrice'];
|
70
|
$goodsInfo['hasOtherPrice'] = true;//非市场价格
|
71
|
$goodsInfo['hasOtherPrice'] = true;//非市场价格
|
71
|
$goodsInfo['salePrice'] = $baseInfo['productPriceBo']['formatSalesPrice'];
|
72
|
$goodsInfo['salePrice'] = $baseInfo['productPriceBo']['formatSalesPrice'];
|
72
|
- if($goodsInfo['marketPrice'] == $goodsInfo['salePrice']) {//价格相同,只显示市场价格
|
73
|
+ if ($goodsInfo['marketPrice'] == $goodsInfo['salePrice']) {//价格相同,只显示市场价格
|
73
|
unset($goodsInfo['salePrice']);
|
74
|
unset($goodsInfo['salePrice']);
|
74
|
$goodsInfo['hasOtherPrice'] = false;
|
75
|
$goodsInfo['hasOtherPrice'] = false;
|
75
|
}
|
76
|
}
|
76
|
}
|
77
|
}
|
77
|
-
|
78
|
+
|
78
|
//VIP数据
|
79
|
//VIP数据
|
79
|
$goodsInfo['vipPrice'] = self::getVipDataByProductBaseInfo($baseInfo, $vipLevel, $uid);
|
80
|
$goodsInfo['vipPrice'] = self::getVipDataByProductBaseInfo($baseInfo, $vipLevel, $uid);
|
80
|
- //促销活动banner
|
|
|
81
|
- $goodsInfo['activity'] = self::getActivityDataByProductBaseInfo($baseInfo);
|
|
|
82
|
-
|
81
|
+
|
|
|
82
|
+ // 促销信息声明
|
|
|
83
|
+ $goodsInfo['activity'] = array();
|
|
|
84
|
+
|
|
|
85
|
+ // 促销 banner
|
|
|
86
|
+ $promotionBanner = self::getProductActivityBanner($baseInfo['id']);
|
|
|
87
|
+ if (!empty($promotionBanner)) {
|
|
|
88
|
+ $goodsInfo['activity'][] = $promotionBanner;
|
|
|
89
|
+ }
|
|
|
90
|
+
|
|
|
91
|
+ // 促销活动,另外调用接口获取
|
|
|
92
|
+ $activityOrigin = ItemData::promotion($baseInfo['productPriceBo']['productSkn']);
|
|
|
93
|
+
|
|
|
94
|
+ if ($activityOrigin['code'] === 200) {
|
|
|
95
|
+ $activityList = self::getActivityDataByProductBaseInfo($activityOrigin['data']);
|
|
|
96
|
+
|
|
|
97
|
+ if (!empty($activityList)) {
|
|
|
98
|
+ $goodsInfo['activity'] = array_merge($goodsInfo['activity'], $activityList);
|
|
|
99
|
+ }
|
|
|
100
|
+ }
|
|
|
101
|
+
|
83
|
if (isset($baseInfo['productPriceBo']['yohoCoinNum']) && $baseInfo['productPriceBo']['yohoCoinNum'] !== 0) {
|
102
|
if (isset($baseInfo['productPriceBo']['yohoCoinNum']) && $baseInfo['productPriceBo']['yohoCoinNum'] !== 0) {
|
84
|
array_push($goodsInfo['activity'],
|
103
|
array_push($goodsInfo['activity'],
|
85
|
array('type' => '返YOHO币', 'des' => '每件返 ' . $baseInfo['productPriceBo']['yohoCoinNum'] . '个 YOHO币')
|
104
|
array('type' => '返YOHO币', 'des' => '每件返 ' . $baseInfo['productPriceBo']['yohoCoinNum'] . '个 YOHO币')
|
86
|
);
|
105
|
);
|
87
|
}
|
106
|
}
|
88
|
-
|
|
|
89
|
// 上市期
|
107
|
// 上市期
|
90
|
if (isset($baseInfo['expectArrivalTime']) && !empty($baseInfo['expectArrivalTime'])) {
|
108
|
if (isset($baseInfo['expectArrivalTime']) && !empty($baseInfo['expectArrivalTime'])) {
|
91
|
$goodsInfo['arrivalDate'] = $baseInfo['expectArrivalTime'] . '月';
|
109
|
$goodsInfo['arrivalDate'] = $baseInfo['expectArrivalTime'] . '月';
|
|
@@ -93,26 +111,26 @@ class ItemModel |
|
@@ -93,26 +111,26 @@ class ItemModel |
93
|
unset($goodsInfo['salePrice']);
|
111
|
unset($goodsInfo['salePrice']);
|
94
|
$goodsInfo['hasOtherPrice'] = false;
|
112
|
$goodsInfo['hasOtherPrice'] = false;
|
95
|
}
|
113
|
}
|
96
|
-
|
114
|
+
|
97
|
//商品咨询和评论数据
|
115
|
//商品咨询和评论数据
|
98
|
$consultComment = self::getConsultCommentDataByProductInfo($baseInfo);
|
116
|
$consultComment = self::getConsultCommentDataByProductInfo($baseInfo);
|
99
|
// 品牌信息
|
117
|
// 品牌信息
|
100
|
if (!empty($baseInfo['brand'])) {
|
118
|
if (!empty($baseInfo['brand'])) {
|
101
|
- $goodsInfo['brandImg'] = Helpers::getImageUrl($baseInfo['brand']['brandIco'], 47, 47);
|
119
|
+ $goodsInfo['brandImg'] = Helpers::getImageUrl($baseInfo['brand']['brandIco'], 47, 47);
|
102
|
$goodsInfo['brandName'] = $baseInfo['brand']['brandName'];
|
120
|
$goodsInfo['brandName'] = $baseInfo['brand']['brandName'];
|
103
|
$goodsInfo['brandUrl'] = Helpers::url('', array(), $baseInfo['brand']['brandDomain']);
|
121
|
$goodsInfo['brandUrl'] = Helpers::url('', array(), $baseInfo['brand']['brandDomain']);
|
104
|
$banner = self::getBrandDataByProductBaseInfo($baseInfo);
|
122
|
$banner = self::getBrandDataByProductBaseInfo($baseInfo);
|
105
|
- if(isset($banner['isCollect']) && isset($favoriteData['brand'])) {
|
123
|
+ if (isset($banner['isCollect']) && isset($favoriteData['brand'])) {
|
106
|
$banner['isCollect'] = $favoriteData['brand'];
|
124
|
$banner['isCollect'] = $favoriteData['brand'];
|
107
|
}
|
125
|
}
|
108
|
}
|
126
|
}
|
109
|
-
|
127
|
+
|
110
|
//sku商品信息
|
128
|
//sku商品信息
|
111
|
$skuData = self::getSkuDataByProductBaseInfo($baseInfo);
|
129
|
$skuData = self::getSkuDataByProductBaseInfo($baseInfo);
|
112
|
$goodsInfo['img'] = $skuData['defaultImage'];
|
130
|
$goodsInfo['img'] = $skuData['defaultImage'];
|
113
|
$goodsInfo['colors'] = $skuData['skuGoods'];
|
131
|
$goodsInfo['colors'] = $skuData['skuGoods'];
|
114
|
$totalStorageNum = $skuData['totalStorageNum'];
|
132
|
$totalStorageNum = $skuData['totalStorageNum'];
|
115
|
-
|
133
|
+
|
116
|
// 是否收藏
|
134
|
// 是否收藏
|
117
|
$goodsInfo['isCollect'] = $favoriteData['product'];
|
135
|
$goodsInfo['isCollect'] = $favoriteData['product'];
|
118
|
// 限购商品
|
136
|
// 限购商品
|
|
@@ -124,16 +142,16 @@ class ItemModel |
|
@@ -124,16 +142,16 @@ class ItemModel |
124
|
if (isset($baseInfo['showStatus'])) {
|
142
|
if (isset($baseInfo['showStatus'])) {
|
125
|
$showStatus = intval($baseInfo['showStatus']);
|
143
|
$showStatus = intval($baseInfo['showStatus']);
|
126
|
}
|
144
|
}
|
127
|
-
|
145
|
+
|
128
|
$fashTopGoods = self::getFashionTopGoodsStatus($uid, $showStatus, $isBeginSale);
|
146
|
$fashTopGoods = self::getFashionTopGoodsStatus($uid, $showStatus, $isBeginSale);
|
129
|
//潮流尖货状态
|
147
|
//潮流尖货状态
|
130
|
$goodsInfo['fashionTopGoods'] = array(
|
148
|
$goodsInfo['fashionTopGoods'] = array(
|
131
|
- 'getLimitedCode' => $fashTopGoods['getLimitedCode'],//限购码状态
|
|
|
132
|
- 'hasLimitedCode' => $fashTopGoods['hasLimitedCode'],//是否已经获取限购码
|
|
|
133
|
- 'limitedCodeSoldOut'=> $fashTopGoods['limitedCodeSoldOut'],//限购码是否已经抢光
|
|
|
134
|
- 'getLimitedCodeDis' => $fashTopGoods['getLimitedCodeDis'],//限购码是否失效
|
|
|
135
|
- );
|
|
|
136
|
- if($fashTopGoods['soldOut']) {
|
149
|
+ 'getLimitedCode' => $fashTopGoods['getLimitedCode'],//限购码状态
|
|
|
150
|
+ 'hasLimitedCode' => $fashTopGoods['hasLimitedCode'],//是否已经获取限购码
|
|
|
151
|
+ 'limitedCodeSoldOut' => $fashTopGoods['limitedCodeSoldOut'],//限购码是否已经抢光
|
|
|
152
|
+ 'getLimitedCodeDis' => $fashTopGoods['getLimitedCodeDis'],//限购码是否失效
|
|
|
153
|
+ );
|
|
|
154
|
+ if ($fashTopGoods['soldOut']) {
|
137
|
$goodsInfo['soldOut'] = $fashTopGoods['soldOut'];
|
155
|
$goodsInfo['soldOut'] = $fashTopGoods['soldOut'];
|
138
|
$totalStorageNum = 0;//改总数为已售磬
|
156
|
$totalStorageNum = 0;//改总数为已售磬
|
139
|
} else {
|
157
|
} else {
|
|
@@ -142,56 +160,55 @@ class ItemModel |
|
@@ -142,56 +160,55 @@ class ItemModel |
142
|
$goodsInfo['buyNow'] = $fashTopGoods['buyNow'];//是否立即购买
|
160
|
$goodsInfo['buyNow'] = $fashTopGoods['buyNow'];//是否立即购买
|
143
|
}
|
161
|
}
|
144
|
}
|
162
|
}
|
145
|
-
|
163
|
+
|
146
|
$soldOut = $baseInfo['status'] == 0 || $totalStorageNum === 0;
|
164
|
$soldOut = $baseInfo['status'] == 0 || $totalStorageNum === 0;
|
147
|
$notForSale = $baseInfo['attribute'] == 2;//非卖品
|
165
|
$notForSale = $baseInfo['attribute'] == 2;//非卖品
|
148
|
$virtualGoods = $baseInfo['attribute'] == 3;//虚拟商品
|
166
|
$virtualGoods = $baseInfo['attribute'] == 3;//虚拟商品
|
149
|
if (!$soldOut && !$notForSale && !$virtualGoods) {
|
167
|
if (!$soldOut && !$notForSale && !$virtualGoods) {
|
150
|
- $goodsInfo['addToCart'] = true;
|
|
|
151
|
- //立即购买或者即将开售存在
|
|
|
152
|
- if((isset($goodsInfo['buyNow']) && $goodsInfo['buyNow']) ||
|
|
|
153
|
- (isset($goodsInfo['openSoon']) && $goodsInfo['openSoon'])) {
|
168
|
+ $goodsInfo['addToCart'] = true;
|
|
|
169
|
+ //立即购买或者即将开售存在
|
|
|
170
|
+ if ((isset($goodsInfo['buyNow']) && $goodsInfo['buyNow']) ||
|
|
|
171
|
+ (isset($goodsInfo['openSoon']) && $goodsInfo['openSoon'])
|
|
|
172
|
+ ) {
|
154
|
unset($goodsInfo['addToCart']);
|
173
|
unset($goodsInfo['addToCart']);
|
155
|
}
|
174
|
}
|
156
|
}// 非卖品
|
175
|
}// 非卖品
|
157
|
elseif ($notForSale) {
|
176
|
elseif ($notForSale) {
|
158
|
$goodsInfo['notForSale'] = true;
|
177
|
$goodsInfo['notForSale'] = true;
|
159
|
- }
|
|
|
160
|
- // 已售磬
|
178
|
+ } // 已售磬
|
161
|
elseif ($soldOut) {
|
179
|
elseif ($soldOut) {
|
162
|
$goodsInfo['soldOut'] = true;
|
180
|
$goodsInfo['soldOut'] = true;
|
163
|
unset($goodsInfo['fashionTopGoods']);
|
181
|
unset($goodsInfo['fashionTopGoods']);
|
164
|
- }
|
|
|
165
|
- //虚拟商品
|
|
|
166
|
- else if($virtualGoods) {
|
182
|
+ } //虚拟商品
|
|
|
183
|
+ else if ($virtualGoods) {
|
167
|
$goodsInfo['buyNow'] = true;//是否立即购买
|
184
|
$goodsInfo['buyNow'] = true;//是否立即购买
|
168
|
$goodsInfo['buyNowBase'] = Helpers::url('/ticket', array(), 'shopping');
|
185
|
$goodsInfo['buyNowBase'] = Helpers::url('/ticket', array(), 'shopping');
|
169
|
$goodsInfo['virtualGoods'] = $virtualGoods;
|
186
|
$goodsInfo['virtualGoods'] = $virtualGoods;
|
170
|
- if(isset($goodsInfo['salePrice'])) {
|
187
|
+ if (isset($goodsInfo['salePrice'])) {
|
171
|
$goodsInfo['advancePrice'] = $goodsInfo['salePrice'];//先行价格
|
188
|
$goodsInfo['advancePrice'] = $goodsInfo['salePrice'];//先行价格
|
172
|
unset($goodsInfo['salePrice']);
|
189
|
unset($goodsInfo['salePrice']);
|
173
|
}
|
190
|
}
|
174
|
}
|
191
|
}
|
175
|
//去掉即将售罄
|
192
|
//去掉即将售罄
|
176
|
- if(empty($totalStorageNum) || $soldOut) {
|
|
|
177
|
- if(isset($goodsInfo['tags']['isFew'])) {
|
193
|
+ if (empty($totalStorageNum) || $soldOut) {
|
|
|
194
|
+ if (isset($goodsInfo['tags']['isFew'])) {
|
178
|
unset($goodsInfo['tags']['isFew']);//去掉即将售罄
|
195
|
unset($goodsInfo['tags']['isFew']);//去掉即将售罄
|
179
|
}
|
196
|
}
|
180
|
- }
|
197
|
+ }
|
181
|
//分享相关
|
198
|
//分享相关
|
182
|
- $goodsInfo['weixinUrl'] = Helpers::url($_SERVER['REQUEST_URI'], array(),'item');
|
199
|
+ $goodsInfo['weixinUrl'] = Helpers::url($_SERVER['REQUEST_URI'], array(), 'item');
|
183
|
$goodsInfo['sharedTitle'] = $goodsInfo['name'];
|
200
|
$goodsInfo['sharedTitle'] = $goodsInfo['name'];
|
184
|
$goodsInfo['shareImg'] = $goodsInfo['img'];
|
201
|
$goodsInfo['shareImg'] = $goodsInfo['img'];
|
185
|
$goodsInfo['shareDesc'] = $baseInfo['phrase'];
|
202
|
$goodsInfo['shareDesc'] = $baseInfo['phrase'];
|
186
|
-
|
203
|
+
|
187
|
//统计需要的商品信息
|
204
|
//统计需要的商品信息
|
188
|
$statGoodsInfo['uid'] = $uid;
|
205
|
$statGoodsInfo['uid'] = $uid;
|
189
|
$statGoodsInfo['skn'] = $baseInfo['erpProductId'];
|
206
|
$statGoodsInfo['skn'] = $baseInfo['erpProductId'];
|
190
|
$statGoodsInfo['productId'] = $productId;
|
207
|
$statGoodsInfo['productId'] = $productId;
|
191
|
- $statGoodsInfo['productName'] = str_replace("'", "’",$goodsInfo['name']);
|
|
|
192
|
- $statGoodsInfo['brandName'] = empty($goodsInfo['brandName'])? '' : str_replace("'", "’", $goodsInfo['brandName']);
|
208
|
+ $statGoodsInfo['productName'] = str_replace("'", "’", $goodsInfo['name']);
|
|
|
209
|
+ $statGoodsInfo['brandName'] = empty($goodsInfo['brandName']) ? '' : str_replace("'", "’", $goodsInfo['brandName']);
|
193
|
$statGoodsInfo['marketPrice'] = str_replace('¥', '', $goodsInfo['marketPrice']);
|
210
|
$statGoodsInfo['marketPrice'] = str_replace('¥', '', $goodsInfo['marketPrice']);
|
194
|
- if(isset($goodsInfo['salePrice'])) {
|
211
|
+ if (isset($goodsInfo['salePrice'])) {
|
195
|
$statGoodsInfo['salePrice'] = str_replace('¥', '', $goodsInfo['salePrice']);
|
212
|
$statGoodsInfo['salePrice'] = str_replace('¥', '', $goodsInfo['salePrice']);
|
196
|
} else {
|
213
|
} else {
|
197
|
$statGoodsInfo['salePrice'] = str_replace('¥', '', $goodsInfo['marketPrice']);
|
214
|
$statGoodsInfo['salePrice'] = str_replace('¥', '', $goodsInfo['marketPrice']);
|
|
@@ -201,11 +218,11 @@ class ItemModel |
|
@@ -201,11 +218,11 @@ class ItemModel |
201
|
$domainBrand = BrandsModel::getBrandByDomain($banner['brandDomain']);
|
218
|
$domainBrand = BrandsModel::getBrandByDomain($banner['brandDomain']);
|
202
|
if (!empty($domainBrand['type'])) {
|
219
|
if (!empty($domainBrand['type'])) {
|
203
|
switch (intval($domainBrand['type'])) {
|
220
|
switch (intval($domainBrand['type'])) {
|
204
|
- case 1:
|
221
|
+ case 1:
|
205
|
//多品店不显示
|
222
|
//多品店不显示
|
206
|
$banner = array();
|
223
|
$banner = array();
|
207
|
break;
|
224
|
break;
|
208
|
- case 2:
|
225
|
+ case 2:
|
209
|
if (empty($domainBrand['shopId'])) {
|
226
|
if (empty($domainBrand['shopId'])) {
|
210
|
break;
|
227
|
break;
|
211
|
}
|
228
|
}
|
|
@@ -222,26 +239,26 @@ class ItemModel |
|
@@ -222,26 +239,26 @@ class ItemModel |
222
|
$statGoodsInfo['productUrl'] = $goodsInfo['weixinUrl'];
|
239
|
$statGoodsInfo['productUrl'] = $goodsInfo['weixinUrl'];
|
223
|
$statGoodsInfo['smallSortId'] = $goodsInfo['smallSortId'];
|
240
|
$statGoodsInfo['smallSortId'] = $goodsInfo['smallSortId'];
|
224
|
$statGoodsInfo['soldOut'] = intval($soldOut);
|
241
|
$statGoodsInfo['soldOut'] = intval($soldOut);
|
225
|
- return array('goodsInfo'=> $goodsInfo,'consultComment' => $consultComment, 'banner'=> $banner,'statGoodsInfo' => $statGoodsInfo);
|
242
|
+ return array('goodsInfo' => $goodsInfo, 'consultComment' => $consultComment, 'banner' => $banner, 'statGoodsInfo' => $statGoodsInfo);
|
226
|
}
|
243
|
}
|
227
|
-
|
244
|
+
|
228
|
/**
|
245
|
/**
|
229
|
* 商品尺码信息
|
246
|
* 商品尺码信息
|
230
|
- *
|
247
|
+ *
|
231
|
* @param string $productSkn
|
248
|
* @param string $productSkn
|
232
|
* @param int $maxSortId
|
249
|
* @param int $maxSortId
|
233
|
* @return array
|
250
|
* @return array
|
234
|
*/
|
251
|
*/
|
235
|
- public static function getSizeInfo($productSkn, $maxSortId)
|
252
|
+ public static function getSizeInfo($productSkn, $maxSortId)
|
236
|
{
|
253
|
{
|
237
|
if (is_numeric($productSkn)) {
|
254
|
if (is_numeric($productSkn)) {
|
238
|
//并发资源中是否存在数据
|
255
|
//并发资源中是否存在数据
|
239
|
$sizeInfo = self::getMultiDataByResourceName('ItemData::sizeInfo');
|
256
|
$sizeInfo = self::getMultiDataByResourceName('ItemData::sizeInfo');
|
240
|
- if(empty($sizeInfo)) {
|
257
|
+ if (empty($sizeInfo)) {
|
241
|
//获取尺码
|
258
|
//获取尺码
|
242
|
- $sizeInfo = ItemData::sizeInfo($productSkn);
|
259
|
+ $sizeInfo = ItemData::sizeInfo($productSkn);
|
243
|
}
|
260
|
}
|
244
|
- if(empty($sizeInfo)) {
|
261
|
+ if (empty($sizeInfo)) {
|
245
|
return array();
|
262
|
return array();
|
246
|
}
|
263
|
}
|
247
|
$productId = $sizeInfo['productBo']['id'];
|
264
|
$productId = $sizeInfo['productBo']['id'];
|
|
@@ -261,35 +278,34 @@ class ItemModel |
|
@@ -261,35 +278,34 @@ class ItemModel |
261
|
$fittingReport = self::getProductModelTry($productSkn);
|
278
|
$fittingReport = self::getProductModelTry($productSkn);
|
262
|
//获取尺寸说明
|
279
|
//获取尺寸说明
|
263
|
$sizeAttr = array();
|
280
|
$sizeAttr = array();
|
264
|
- if(!empty($sizeInfo['sizeInfoBo'])) {
|
281
|
+ if (!empty($sizeInfo['sizeInfoBo'])) {
|
265
|
//根据最大分类ID获取尺寸属性
|
282
|
//根据最大分类ID获取尺寸属性
|
266
|
$sizeAttr = self::getSizeAttrByMaxSortId($maxSortId, $sizeInfo['sizeInfoBo']);
|
283
|
$sizeAttr = self::getSizeAttrByMaxSortId($maxSortId, $sizeInfo['sizeInfoBo']);
|
267
|
}
|
284
|
}
|
268
|
- return array('material'=> $material, 'size'=> $size, 'reference'=> $reference,
|
|
|
269
|
- 'modelCards'=> $modelCards,'details'=> $details,'fittingReport' =>$fittingReport,
|
|
|
270
|
- 'description'=> $description,'sizeTitleJson' => json_encode($sizeAttr));
|
|
|
271
|
- }
|
|
|
272
|
- else {
|
285
|
+ return array('material' => $material, 'size' => $size, 'reference' => $reference,
|
|
|
286
|
+ 'modelCards' => $modelCards, 'details' => $details, 'fittingReport' => $fittingReport,
|
|
|
287
|
+ 'description' => $description, 'sizeTitleJson' => json_encode($sizeAttr));
|
|
|
288
|
+ } else {
|
273
|
return array();
|
289
|
return array();
|
274
|
}
|
290
|
}
|
275
|
-
|
291
|
+
|
276
|
}
|
292
|
}
|
277
|
-
|
293
|
+
|
278
|
/**
|
294
|
/**
|
279
|
* 获取购物车商品信息
|
295
|
* 获取购物车商品信息
|
280
|
- *
|
296
|
+ *
|
281
|
* @param int $productId
|
297
|
* @param int $productId
|
282
|
* @param int $uid
|
298
|
* @param int $uid
|
283
|
* @param int $vipLevel
|
299
|
* @param int $vipLevel
|
284
|
* @return array
|
300
|
* @return array
|
285
|
*/
|
301
|
*/
|
286
|
- public static function getCartProductInfo($productId, $uid, $vipLevel)
|
302
|
+ public static function getCartProductInfo($productId, $uid, $vipLevel)
|
287
|
{
|
303
|
{
|
288
|
$goodsInfo = array();
|
304
|
$goodsInfo = array();
|
289
|
$size = array();
|
305
|
$size = array();
|
290
|
$baseInfo = ItemData::baseInfo($productId, $uid);
|
306
|
$baseInfo = ItemData::baseInfo($productId, $uid);
|
291
|
- if(!empty($baseInfo)) {
|
|
|
292
|
- if(empty($baseInfo['productName']) && empty($baseInfo['erpProductId']) && empty($baseInfo['productPriceBo'])) {
|
307
|
+ if (!empty($baseInfo)) {
|
|
|
308
|
+ if (empty($baseInfo['productName']) && empty($baseInfo['erpProductId']) && empty($baseInfo['productPriceBo'])) {
|
293
|
return array();
|
309
|
return array();
|
294
|
}
|
310
|
}
|
295
|
$goodsInfo['name'] = $baseInfo['productName'];
|
311
|
$goodsInfo['name'] = $baseInfo['productName'];
|
|
@@ -299,18 +315,18 @@ class ItemModel |
|
@@ -299,18 +315,18 @@ class ItemModel |
299
|
if (!empty($baseInfo['salesPhrase'])) {
|
315
|
if (!empty($baseInfo['salesPhrase'])) {
|
300
|
$goodsInfo['saleTip'] = $baseInfo['salesPhrase'];
|
316
|
$goodsInfo['saleTip'] = $baseInfo['salesPhrase'];
|
301
|
}
|
317
|
}
|
302
|
-
|
318
|
+
|
303
|
// 商品价格
|
319
|
// 商品价格
|
304
|
if (isset($baseInfo['productPriceBo'])) {
|
320
|
if (isset($baseInfo['productPriceBo'])) {
|
305
|
$goodsInfo['marketPrice'] = Helpers::transPrice($baseInfo['productPriceBo']['marketPrice']);
|
321
|
$goodsInfo['marketPrice'] = Helpers::transPrice($baseInfo['productPriceBo']['marketPrice']);
|
306
|
$goodsInfo['salePrice'] = Helpers::transPrice($baseInfo['productPriceBo']['salesPrice']);
|
322
|
$goodsInfo['salePrice'] = Helpers::transPrice($baseInfo['productPriceBo']['salesPrice']);
|
307
|
$goodsInfo['hasOtherPrice'] = true;//非市场价格
|
323
|
$goodsInfo['hasOtherPrice'] = true;//非市场价格
|
308
|
- if($goodsInfo['marketPrice'] == $goodsInfo['salePrice']) {//价格相同,只显示市场价格
|
324
|
+ if ($goodsInfo['marketPrice'] == $goodsInfo['salePrice']) {//价格相同,只显示市场价格
|
309
|
unset($goodsInfo['salePrice']);
|
325
|
unset($goodsInfo['salePrice']);
|
310
|
$goodsInfo['hasOtherPrice'] = false;
|
326
|
$goodsInfo['hasOtherPrice'] = false;
|
311
|
}
|
327
|
}
|
312
|
}
|
328
|
}
|
313
|
-
|
329
|
+
|
314
|
// 上市期
|
330
|
// 上市期
|
315
|
if (isset($baseInfo['expectArrivalTime']) && !empty($baseInfo['expectArrivalTime'])) {
|
331
|
if (isset($baseInfo['expectArrivalTime']) && !empty($baseInfo['expectArrivalTime'])) {
|
316
|
$goodsInfo['arrivalDate'] = $baseInfo['expectArrivalTime'] . '月';
|
332
|
$goodsInfo['arrivalDate'] = $baseInfo['expectArrivalTime'] . '月';
|
|
@@ -318,23 +334,23 @@ class ItemModel |
|
@@ -318,23 +334,23 @@ class ItemModel |
318
|
unset($goodsInfo['salePrice']);
|
334
|
unset($goodsInfo['salePrice']);
|
319
|
$goodsInfo['hasOtherPrice'] = false;
|
335
|
$goodsInfo['hasOtherPrice'] = false;
|
320
|
}
|
336
|
}
|
321
|
-
|
337
|
+
|
322
|
//VIP数据
|
338
|
//VIP数据
|
323
|
$goodsInfo['vipPrice'] = self::getVipDataByProductBaseInfo($baseInfo, $vipLevel);
|
339
|
$goodsInfo['vipPrice'] = self::getVipDataByProductBaseInfo($baseInfo, $vipLevel);
|
324
|
//sku商品信息
|
340
|
//sku商品信息
|
325
|
$skuData = self::getSkuDataByProductBaseInfo($baseInfo);
|
341
|
$skuData = self::getSkuDataByProductBaseInfo($baseInfo);
|
326
|
$totalStorageNum = $skuData['totalStorageNum'];
|
342
|
$totalStorageNum = $skuData['totalStorageNum'];
|
327
|
-
|
343
|
+
|
328
|
$goodsInfo['img'] = $skuData['defaultImage'];
|
344
|
$goodsInfo['img'] = $skuData['defaultImage'];
|
329
|
$goodsInfo['colors'] = $skuData['skuGoods'];
|
345
|
$goodsInfo['colors'] = $skuData['skuGoods'];
|
330
|
$favoriteData = FavoriteData::getUidProductFav($uid, $productId);
|
346
|
$favoriteData = FavoriteData::getUidProductFav($uid, $productId);
|
331
|
- $goodsInfo['isCollect'] = $favoriteData['code'] == 200 && $favoriteData['data'] ? true:false;
|
347
|
+ $goodsInfo['isCollect'] = $favoriteData['code'] == 200 && $favoriteData['data'] ? true : false;
|
332
|
$sizeInfo = ItemData::sizeInfo($baseInfo['erpProductId']);
|
348
|
$sizeInfo = ItemData::sizeInfo($baseInfo['erpProductId']);
|
333
|
- if(!empty($sizeInfo)) {
|
349
|
+ if (!empty($sizeInfo)) {
|
334
|
$size = self::getSizeDataBySizeInfo($sizeInfo);
|
350
|
$size = self::getSizeDataBySizeInfo($sizeInfo);
|
335
|
$goodsInfo['size'] = $size;
|
351
|
$goodsInfo['size'] = $size;
|
336
|
}
|
352
|
}
|
337
|
-
|
353
|
+
|
338
|
// 限购商品
|
354
|
// 限购商品
|
339
|
if ($baseInfo['isLimitBuy'] === 'Y') {
|
355
|
if ($baseInfo['isLimitBuy'] === 'Y') {
|
340
|
// 是否开售
|
356
|
// 是否开售
|
|
@@ -344,16 +360,16 @@ class ItemModel |
|
@@ -344,16 +360,16 @@ class ItemModel |
344
|
if (isset($baseInfo['showStatus'])) {
|
360
|
if (isset($baseInfo['showStatus'])) {
|
345
|
$showStatus = intval($baseInfo['showStatus']);
|
361
|
$showStatus = intval($baseInfo['showStatus']);
|
346
|
}
|
362
|
}
|
347
|
-
|
363
|
+
|
348
|
$fashTopGoods = self::getFashionTopGoodsStatus($uid, $showStatus, $isBeginSale);
|
364
|
$fashTopGoods = self::getFashionTopGoodsStatus($uid, $showStatus, $isBeginSale);
|
349
|
//潮流尖货状态
|
365
|
//潮流尖货状态
|
350
|
$goodsInfo['fashionTopGoods'] = array(
|
366
|
$goodsInfo['fashionTopGoods'] = array(
|
351
|
'getLimitedCode' => $fashTopGoods['getLimitedCode'],//限购码状态
|
367
|
'getLimitedCode' => $fashTopGoods['getLimitedCode'],//限购码状态
|
352
|
'hasLimitedCode' => $fashTopGoods['hasLimitedCode'],//是否已经获取限购码
|
368
|
'hasLimitedCode' => $fashTopGoods['hasLimitedCode'],//是否已经获取限购码
|
353
|
- 'limitedCodeSoldOut'=> $fashTopGoods['limitedCodeSoldOut'],//限购码是否已经抢光
|
369
|
+ 'limitedCodeSoldOut' => $fashTopGoods['limitedCodeSoldOut'],//限购码是否已经抢光
|
354
|
'getLimitedCodeDis' => $fashTopGoods['getLimitedCodeDis'],//限购码是否失效
|
370
|
'getLimitedCodeDis' => $fashTopGoods['getLimitedCodeDis'],//限购码是否失效
|
355
|
);
|
371
|
);
|
356
|
- if($fashTopGoods['soldOut']) {
|
372
|
+ if ($fashTopGoods['soldOut']) {
|
357
|
$goodsInfo['soldOut'] = $fashTopGoods['soldOut'];
|
373
|
$goodsInfo['soldOut'] = $fashTopGoods['soldOut'];
|
358
|
$totalStorageNum = 0;//改总数为已售磬
|
374
|
$totalStorageNum = 0;//改总数为已售磬
|
359
|
} else {
|
375
|
} else {
|
|
@@ -362,7 +378,7 @@ class ItemModel |
|
@@ -362,7 +378,7 @@ class ItemModel |
362
|
$goodsInfo['buyNow'] = $fashTopGoods['buyNow'];//是否立即购买
|
378
|
$goodsInfo['buyNow'] = $fashTopGoods['buyNow'];//是否立即购买
|
363
|
}
|
379
|
}
|
364
|
}
|
380
|
}
|
365
|
-
|
381
|
+
|
366
|
//商品状态
|
382
|
//商品状态
|
367
|
$soldOut = $baseInfo['status'] == 0 || $totalStorageNum === 0;
|
383
|
$soldOut = $baseInfo['status'] == 0 || $totalStorageNum === 0;
|
368
|
$notForSale = $baseInfo['attribute'] == 2;//非卖品
|
384
|
$notForSale = $baseInfo['attribute'] == 2;//非卖品
|
|
@@ -370,54 +386,53 @@ class ItemModel |
|
@@ -370,54 +386,53 @@ class ItemModel |
370
|
if (!$soldOut && !$notForSale && !$virtualGoods) {
|
386
|
if (!$soldOut && !$notForSale && !$virtualGoods) {
|
371
|
$goodsInfo['addToCart'] = true;
|
387
|
$goodsInfo['addToCart'] = true;
|
372
|
//立即购买或者即将开售存在
|
388
|
//立即购买或者即将开售存在
|
373
|
- if((isset($goodsInfo['buyNow']) && $goodsInfo['buyNow']) ||
|
|
|
374
|
- (isset($goodsInfo['openSoon']) && $goodsInfo['openSoon'])) {
|
|
|
375
|
- unset($goodsInfo['addToCart']);
|
|
|
376
|
- }
|
389
|
+ if ((isset($goodsInfo['buyNow']) && $goodsInfo['buyNow']) ||
|
|
|
390
|
+ (isset($goodsInfo['openSoon']) && $goodsInfo['openSoon'])
|
|
|
391
|
+ ) {
|
|
|
392
|
+ unset($goodsInfo['addToCart']);
|
|
|
393
|
+ }
|
377
|
}// 非卖品
|
394
|
}// 非卖品
|
378
|
elseif ($notForSale) {
|
395
|
elseif ($notForSale) {
|
379
|
//$goodsInfo['notForSale'] = true;
|
396
|
//$goodsInfo['notForSale'] = true;
|
380
|
$goodsInfo['addToCart'] = true;//赠品
|
397
|
$goodsInfo['addToCart'] = true;//赠品
|
381
|
- }
|
|
|
382
|
- // 已售磬
|
398
|
+ } // 已售磬
|
383
|
elseif ($soldOut) {
|
399
|
elseif ($soldOut) {
|
384
|
$goodsInfo['soldOut'] = true;
|
400
|
$goodsInfo['soldOut'] = true;
|
385
|
- }
|
|
|
386
|
- else if($virtualGoods) {
|
401
|
+ } else if ($virtualGoods) {
|
387
|
$goodsInfo['buyNow'] = true;//是否立即购买
|
402
|
$goodsInfo['buyNow'] = true;//是否立即购买
|
388
|
$goodsInfo['buyNowBase'] = Helpers::url('/ticket', array(), 'shopping');
|
403
|
$goodsInfo['buyNowBase'] = Helpers::url('/ticket', array(), 'shopping');
|
389
|
$goodsInfo['virtualGoods'] = $virtualGoods;
|
404
|
$goodsInfo['virtualGoods'] = $virtualGoods;
|
390
|
- if(isset($goodsInfo['salePrice'])) {
|
405
|
+ if (isset($goodsInfo['salePrice'])) {
|
391
|
$goodsInfo['advancePrice'] = $goodsInfo['salePrice'];//先行价格
|
406
|
$goodsInfo['advancePrice'] = $goodsInfo['salePrice'];//先行价格
|
392
|
unset($goodsInfo['salePrice']);
|
407
|
unset($goodsInfo['salePrice']);
|
393
|
}
|
408
|
}
|
394
|
}
|
409
|
}
|
395
|
-
|
410
|
+
|
396
|
}
|
411
|
}
|
397
|
return $goodsInfo;
|
412
|
return $goodsInfo;
|
398
|
}
|
413
|
}
|
399
|
-
|
414
|
+
|
400
|
/**
|
415
|
/**
|
401
|
* 获取分类导航列表
|
416
|
* 获取分类导航列表
|
402
|
- *
|
417
|
+ *
|
403
|
* @param string $smallSortId
|
418
|
* @param string $smallSortId
|
404
|
* @return array
|
419
|
* @return array
|
405
|
*/
|
420
|
*/
|
406
|
- public static function getSortNav($smallSortId)
|
421
|
+ public static function getSortNav($smallSortId)
|
407
|
{
|
422
|
{
|
408
|
- $key = WebCacheConfig::KEY_WEB_ITEM_SORT_DATA.'_'.$smallSortId;
|
423
|
+ $key = WebCacheConfig::KEY_WEB_ITEM_SORT_DATA . '_' . $smallSortId;
|
409
|
$navs = Cache::get($key);
|
424
|
$navs = Cache::get($key);
|
410
|
- if(empty($navs)) {
|
|
|
411
|
- $data = SearchData::getSortByCondition(array('sort'=> $smallSortId));
|
|
|
412
|
- if(!empty($data['data'])) {
|
425
|
+ if (empty($navs)) {
|
|
|
426
|
+ $data = SearchData::getSortByCondition(array('sort' => $smallSortId));
|
|
|
427
|
+ if (!empty($data['data'])) {
|
413
|
$sort = current($data['data']['sort']);
|
428
|
$sort = current($data['data']['sort']);
|
414
|
//一级分类
|
429
|
//一级分类
|
415
|
- $navs[] = array('href' => Helpers::url('', array('msort'=> $sort['sort_id'],
|
|
|
416
|
- 'gender' => Helpers::getGenderByCookie()),'list'), 'name' => $sort['sort_name'],'pathTitle' => $sort['sort_name']);
|
|
|
417
|
- if(!empty($sort['sub'])) {//二级分类
|
430
|
+ $navs[] = array('href' => Helpers::url('', array('msort' => $sort['sort_id'],
|
|
|
431
|
+ 'gender' => Helpers::getGenderByCookie()), 'list'), 'name' => $sort['sort_name'], 'pathTitle' => $sort['sort_name']);
|
|
|
432
|
+ if (!empty($sort['sub'])) {//二级分类
|
418
|
$subSort = current($sort['sub']);
|
433
|
$subSort = current($sort['sub']);
|
419
|
- $navs[] = array('href' => Helpers::url('', array('msort'=> $sort['sort_id'],'misort'=>$subSort['sort_id'],
|
|
|
420
|
- 'gender' => Helpers::getGenderByCookie()),'list'), 'name' => $subSort['sort_name'], 'pathTitle' => $subSort['sort_name']);
|
434
|
+ $navs[] = array('href' => Helpers::url('', array('msort' => $sort['sort_id'], 'misort' => $subSort['sort_id'],
|
|
|
435
|
+ 'gender' => Helpers::getGenderByCookie()), 'list'), 'name' => $subSort['sort_name'], 'pathTitle' => $subSort['sort_name']);
|
421
|
}
|
436
|
}
|
422
|
Cache::set($key, $navs);
|
437
|
Cache::set($key, $navs);
|
423
|
}
|
438
|
}
|
|
@@ -427,17 +442,17 @@ class ItemModel |
|
@@ -427,17 +442,17 @@ class ItemModel |
427
|
}
|
442
|
}
|
428
|
return $navs;
|
443
|
return $navs;
|
429
|
}
|
444
|
}
|
430
|
-
|
445
|
+
|
431
|
/**
|
446
|
/**
|
432
|
* 获取咨询列表
|
447
|
* 获取咨询列表
|
433
|
- *
|
448
|
+ *
|
434
|
* @param int $uid
|
449
|
* @param int $uid
|
435
|
* @param int $productId
|
450
|
* @param int $productId
|
436
|
* @param int $pageNum
|
451
|
* @param int $pageNum
|
437
|
* @param int $pageSize
|
452
|
* @param int $pageSize
|
438
|
* @return array
|
453
|
* @return array
|
439
|
*/
|
454
|
*/
|
440
|
- public static function getConsults($uid, $productId, $pageNum = 1, $pageSize = 30)
|
455
|
+ public static function getConsults($uid, $productId, $pageNum = 1, $pageSize = 30)
|
441
|
{
|
456
|
{
|
442
|
$result = array();
|
457
|
$result = array();
|
443
|
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
|
458
|
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
|
|
@@ -454,23 +469,23 @@ class ItemModel |
|
@@ -454,23 +469,23 @@ class ItemModel |
454
|
$build['like'] = intval($value['like']);
|
469
|
$build['like'] = intval($value['like']);
|
455
|
$build['isUseful'] = $value['is_useful'] === 'Y';
|
470
|
$build['isUseful'] = $value['is_useful'] === 'Y';
|
456
|
$build['useful'] = intval($value['useful']);
|
471
|
$build['useful'] = intval($value['useful']);
|
457
|
- $build['total']= $value['total'];
|
472
|
+ $build['total'] = $value['total'];
|
458
|
$result[] = $build;
|
473
|
$result[] = $build;
|
459
|
}
|
474
|
}
|
460
|
}
|
475
|
}
|
461
|
}
|
476
|
}
|
462
|
return $result;
|
477
|
return $result;
|
463
|
}
|
478
|
}
|
464
|
-
|
479
|
+
|
465
|
/**
|
480
|
/**
|
466
|
* 获取评论
|
481
|
* 获取评论
|
467
|
- *
|
482
|
+ *
|
468
|
* @param int $productId
|
483
|
* @param int $productId
|
469
|
* @param int $pageNum
|
484
|
* @param int $pageNum
|
470
|
* @param int $pageSize
|
485
|
* @param int $pageSize
|
471
|
- * @return array
|
486
|
+ * @return array
|
472
|
*/
|
487
|
*/
|
473
|
- public static function getComments($productId, $pageNum = 1, $pageSize = 10)
|
488
|
+ public static function getComments($productId, $pageNum = 1, $pageSize = 10)
|
474
|
{
|
489
|
{
|
475
|
$result = array();
|
490
|
$result = array();
|
476
|
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
|
491
|
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
|
|
@@ -479,8 +494,8 @@ class ItemModel |
|
@@ -479,8 +494,8 @@ class ItemModel |
479
|
$build = array();
|
494
|
$build = array();
|
480
|
foreach ($commentList['data'] as $value) {
|
495
|
foreach ($commentList['data'] as $value) {
|
481
|
$headIco = ChannelConfig::$itemHeadDefaultImgIco;
|
496
|
$headIco = ChannelConfig::$itemHeadDefaultImgIco;
|
482
|
- if(!empty($value['head_ico'])) {
|
|
|
483
|
- if(preg_match('@http://@', $value['head_ico'])) {
|
497
|
+ if (!empty($value['head_ico'])) {
|
|
|
498
|
+ if (preg_match('@http://@', $value['head_ico'])) {
|
484
|
$headIco = preg_replace('@http:\/\/img(.+)\.static\.yhbimg\.com\/headimg@', 'http://head.static.yhbimg.com/yhb-head/', $value['head_ico']);
|
499
|
$headIco = preg_replace('@http:\/\/img(.+)\.static\.yhbimg\.com\/headimg@', 'http://head.static.yhbimg.com/yhb-head/', $value['head_ico']);
|
485
|
$headIco = Images::getImageUrl($headIco, 30, 30);
|
500
|
$headIco = Images::getImageUrl($headIco, 30, 30);
|
486
|
}
|
501
|
}
|
|
@@ -496,12 +511,12 @@ class ItemModel |
|
@@ -496,12 +511,12 @@ class ItemModel |
496
|
}
|
511
|
}
|
497
|
}
|
512
|
}
|
498
|
}
|
513
|
}
|
499
|
- return $result;
|
514
|
+ return $result;
|
500
|
}
|
515
|
}
|
501
|
-
|
516
|
+
|
502
|
/**
|
517
|
/**
|
503
|
* 获取商品活动banner
|
518
|
* 获取商品活动banner
|
504
|
- *
|
519
|
+ *
|
505
|
* @param int $productId
|
520
|
* @param int $productId
|
506
|
* @return array
|
521
|
* @return array
|
507
|
*/
|
522
|
*/
|
|
@@ -509,41 +524,40 @@ class ItemModel |
|
@@ -509,41 +524,40 @@ class ItemModel |
509
|
{
|
524
|
{
|
510
|
$result = array();
|
525
|
$result = array();
|
511
|
$data = self::getMultiDataByResourceName('ItemData::getProductBanner');
|
526
|
$data = self::getMultiDataByResourceName('ItemData::getProductBanner');
|
512
|
- if(empty($data)) {
|
527
|
+ if (empty($data)) {
|
513
|
$data = ItemData::getProductBanner($productId);
|
528
|
$data = ItemData::getProductBanner($productId);
|
514
|
}
|
529
|
}
|
515
|
- if(isset($data['code']) && $data['code'] == 200 && !empty($data['data']))
|
|
|
516
|
- {
|
530
|
+ if (isset($data['code']) && $data['code'] == 200 && !empty($data['data'])) {
|
517
|
$result['activityImg'] = Images::getImageUrl($data['data']['bannerImg'], 260, 64);
|
531
|
$result['activityImg'] = Images::getImageUrl($data['data']['bannerImg'], 260, 64);
|
518
|
$result['url'] = $data['data']['promotionUrl'];
|
532
|
$result['url'] = $data['data']['promotionUrl'];
|
519
|
}
|
533
|
}
|
520
|
return $result;
|
534
|
return $result;
|
521
|
}
|
535
|
}
|
522
|
-
|
536
|
+
|
523
|
/**
|
537
|
/**
|
524
|
* 获取商品热区
|
538
|
* 获取商品热区
|
525
|
- *
|
539
|
+ *
|
526
|
* @param string $productId
|
540
|
* @param string $productId
|
527
|
* @return array
|
541
|
* @return array
|
528
|
*/
|
542
|
*/
|
529
|
- public static function getProductHotArea($productId)
|
543
|
+ public static function getProductHotArea($productId)
|
530
|
{
|
544
|
{
|
531
|
$result = array();
|
545
|
$result = array();
|
532
|
$data = ItemData::getProductHotArea($productId);
|
546
|
$data = ItemData::getProductHotArea($productId);
|
533
|
- if(isset($data['code']) && $data['code'] == 200) {
|
|
|
534
|
- if(!empty($data['data'])) {
|
547
|
+ if (isset($data['code']) && $data['code'] == 200) {
|
|
|
548
|
+ if (!empty($data['data'])) {
|
535
|
foreach ($data['data'] as $area) {
|
549
|
foreach ($data['data'] as $area) {
|
536
|
$temp = array();
|
550
|
$temp = array();
|
537
|
$pos = 1;
|
551
|
$pos = 1;
|
538
|
- if(isset($area['imageUrl'])) {
|
552
|
+ if (isset($area['imageUrl'])) {
|
539
|
$temp['img'] = Images::getForceSourceUrl($area['imageUrl']);
|
553
|
$temp['img'] = Images::getForceSourceUrl($area['imageUrl']);
|
540
|
}
|
554
|
}
|
541
|
- foreach($area['infos'] as $val) {
|
|
|
542
|
- if(isset($val['product'])) {
|
|
|
543
|
- $point = array('label' => $pos++,'height' => $val['height'],
|
|
|
544
|
- 'left' => $val['left'],'top' => $val['top'],
|
|
|
545
|
- 'width'=> $val['width'],'product' => array());
|
|
|
546
|
- if(!empty($val['product']['goodsList'])) {
|
555
|
+ foreach ($area['infos'] as $val) {
|
|
|
556
|
+ if (isset($val['product'])) {
|
|
|
557
|
+ $point = array('label' => $pos++, 'height' => $val['height'],
|
|
|
558
|
+ 'left' => $val['left'], 'top' => $val['top'],
|
|
|
559
|
+ 'width' => $val['width'], 'product' => array());
|
|
|
560
|
+ if (!empty($val['product']['goodsList'])) {
|
547
|
$goods = current($val['product']['goodsList']);
|
561
|
$goods = current($val['product']['goodsList']);
|
548
|
//封面图
|
562
|
//封面图
|
549
|
$point['img'] = Images::getImageUrl($goods['colorImage'], 60, 60);
|
563
|
$point['img'] = Images::getImageUrl($goods['colorImage'], 60, 60);
|
|
@@ -557,22 +571,22 @@ class ItemModel |
|
@@ -557,22 +571,22 @@ class ItemModel |
557
|
);
|
571
|
);
|
558
|
}
|
572
|
}
|
559
|
}
|
573
|
}
|
560
|
- if(!empty($point)) {
|
574
|
+ if (!empty($point)) {
|
561
|
$temp['list'][] = $point;
|
575
|
$temp['list'][] = $point;
|
562
|
}
|
576
|
}
|
563
|
}
|
577
|
}
|
564
|
- if(!empty($temp)) {
|
|
|
565
|
- $result[] = $temp;
|
578
|
+ if (!empty($temp)) {
|
|
|
579
|
+ $result[] = $temp;
|
566
|
}
|
580
|
}
|
567
|
}
|
581
|
}
|
568
|
}
|
582
|
}
|
569
|
}
|
583
|
}
|
570
|
return $result;
|
584
|
return $result;
|
571
|
}
|
585
|
}
|
572
|
-
|
586
|
+
|
573
|
/**
|
587
|
/**
|
574
|
* 获取商品模特卡
|
588
|
* 获取商品模特卡
|
575
|
- *
|
589
|
+ *
|
576
|
* @param string $productId
|
590
|
* @param string $productId
|
577
|
* @return array
|
591
|
* @return array
|
578
|
*/
|
592
|
*/
|
|
@@ -580,11 +594,11 @@ class ItemModel |
|
@@ -580,11 +594,11 @@ class ItemModel |
580
|
{
|
594
|
{
|
581
|
$result = array();
|
595
|
$result = array();
|
582
|
$data = self::getMultiDataByResourceName('ItemData::getProductModelCard');
|
596
|
$data = self::getMultiDataByResourceName('ItemData::getProductModelCard');
|
583
|
- if(empty($data)) {
|
597
|
+ if (empty($data)) {
|
584
|
$data = ItemData::getProductModelCard($productId);
|
598
|
$data = ItemData::getProductModelCard($productId);
|
585
|
}
|
599
|
}
|
586
|
- if(isset($data['code']) && $data['code'] == 200) {
|
|
|
587
|
- foreach($data['data'] as $val) {
|
600
|
+ if (isset($data['code']) && $data['code'] == 200) {
|
|
|
601
|
+ foreach ($data['data'] as $val) {
|
588
|
$result[] = array(
|
602
|
$result[] = array(
|
589
|
'url' => Images::getForceSourceUrl($val['modelImg']),
|
603
|
'url' => Images::getForceSourceUrl($val['modelImg']),
|
590
|
'size' => $val['size'],
|
604
|
'size' => $val['size'],
|
|
@@ -594,7 +608,7 @@ class ItemModel |
|
@@ -594,7 +608,7 @@ class ItemModel |
594
|
}
|
608
|
}
|
595
|
return $result;
|
609
|
return $result;
|
596
|
}
|
610
|
}
|
597
|
-
|
611
|
+
|
598
|
/**
|
612
|
/**
|
599
|
* 添加咨询
|
613
|
* 添加咨询
|
600
|
*
|
614
|
*
|
|
@@ -607,10 +621,10 @@ class ItemModel |
|
@@ -607,10 +621,10 @@ class ItemModel |
607
|
{
|
621
|
{
|
608
|
return ItemData::addConsult($uid, $productId, $content);
|
622
|
return ItemData::addConsult($uid, $productId, $content);
|
609
|
}
|
623
|
}
|
610
|
-
|
624
|
+
|
611
|
/**
|
625
|
/**
|
612
|
* 获取商品的舒适度
|
626
|
* 获取商品的舒适度
|
613
|
- *
|
627
|
+ *
|
614
|
* @param int $productId
|
628
|
* @param int $productId
|
615
|
* @return array
|
629
|
* @return array
|
616
|
*/
|
630
|
*/
|
|
@@ -618,15 +632,15 @@ class ItemModel |
|
@@ -618,15 +632,15 @@ class ItemModel |
618
|
{
|
632
|
{
|
619
|
$result = array();
|
633
|
$result = array();
|
620
|
$comfort = self::getMultiDataByResourceName('ItemData::getProductComfort');
|
634
|
$comfort = self::getMultiDataByResourceName('ItemData::getProductComfort');
|
621
|
- if(empty($comfort)) {
|
635
|
+ if (empty($comfort)) {
|
622
|
$comfort = ItemData::getProductComfort($productId);
|
636
|
$comfort = ItemData::getProductComfort($productId);
|
623
|
}
|
637
|
}
|
624
|
- if(!empty($comfort['data'])) {
|
|
|
625
|
- foreach($comfort['data'] as $val) {
|
638
|
+ if (!empty($comfort['data'])) {
|
|
|
639
|
+ foreach ($comfort['data'] as $val) {
|
626
|
$blocks = array();
|
640
|
$blocks = array();
|
627
|
$flag = false;
|
641
|
$flag = false;
|
628
|
- for($i =1;$i<=5; $i++) {
|
|
|
629
|
- if($i == $val['wearSense']['value']) {
|
642
|
+ for ($i = 1; $i <= 5; $i++) {
|
|
|
643
|
+ if ($i == $val['wearSense']['value']) {
|
630
|
$flag = true;
|
644
|
$flag = true;
|
631
|
$blocks[] = array('cur' => true);
|
645
|
$blocks[] = array('cur' => true);
|
632
|
} else {
|
646
|
} else {
|
|
@@ -634,19 +648,19 @@ class ItemModel |
|
@@ -634,19 +648,19 @@ class ItemModel |
634
|
}
|
648
|
}
|
635
|
}
|
649
|
}
|
636
|
//存在,添加
|
650
|
//存在,添加
|
637
|
- if($flag) {
|
651
|
+ if ($flag) {
|
638
|
$result[] = array(
|
652
|
$result[] = array(
|
639
|
'name' => $val['caption']['caption'],
|
653
|
'name' => $val['caption']['caption'],
|
640
|
- 'minDes'=> $val['caption']['low'],
|
|
|
641
|
- 'blocks'=> $blocks,
|
|
|
642
|
- 'maxDes'=>$val['caption']['high']
|
654
|
+ 'minDes' => $val['caption']['low'],
|
|
|
655
|
+ 'blocks' => $blocks,
|
|
|
656
|
+ 'maxDes' => $val['caption']['high']
|
643
|
);
|
657
|
);
|
644
|
}
|
658
|
}
|
645
|
}
|
659
|
}
|
646
|
}
|
660
|
}
|
647
|
return $result;
|
661
|
return $result;
|
648
|
}
|
662
|
}
|
649
|
-
|
663
|
+
|
650
|
/**
|
664
|
/**
|
651
|
* 获取商品的喜欢
|
665
|
* 获取商品的喜欢
|
652
|
* @param int $uid
|
666
|
* @param int $uid
|
|
@@ -657,25 +671,25 @@ class ItemModel |
|
@@ -657,25 +671,25 @@ class ItemModel |
657
|
public static function getProductFavoriteData($uid, $productId, $brandId)
|
671
|
public static function getProductFavoriteData($uid, $productId, $brandId)
|
658
|
{
|
672
|
{
|
659
|
$result = array('product' => false, 'brand' => false);
|
673
|
$result = array('product' => false, 'brand' => false);
|
660
|
- if(!empty($uid)) {
|
|
|
661
|
- if(!empty($productId)) {
|
674
|
+ if (!empty($uid)) {
|
|
|
675
|
+ if (!empty($productId)) {
|
662
|
$productData = self::getMultiDataByResourceName('FavoriteData::getUidProductFav');
|
676
|
$productData = self::getMultiDataByResourceName('FavoriteData::getUidProductFav');
|
663
|
- if(empty($productData)) {
|
677
|
+ if (empty($productData)) {
|
664
|
$productData = FavoriteData::getUidProductFav($uid, $productId);
|
678
|
$productData = FavoriteData::getUidProductFav($uid, $productId);
|
665
|
}
|
679
|
}
|
666
|
$result['product'] = $productData['code'] == 200 && $productData['data'] ? true : false;
|
680
|
$result['product'] = $productData['code'] == 200 && $productData['data'] ? true : false;
|
667
|
}
|
681
|
}
|
668
|
- if(!empty($brandId)) {
|
682
|
+ if (!empty($brandId)) {
|
669
|
$brandData = FavoriteData::isFavoriteBrand($uid, $brandId);
|
683
|
$brandData = FavoriteData::isFavoriteBrand($uid, $brandId);
|
670
|
$result['brand'] = isset($brandData['code']) && $brandData['code'] == 200 ? true : false;
|
684
|
$result['brand'] = isset($brandData['code']) && $brandData['code'] == 200 ? true : false;
|
671
|
}
|
685
|
}
|
672
|
}
|
686
|
}
|
673
|
return $result;
|
687
|
return $result;
|
674
|
}
|
688
|
}
|
675
|
-
|
689
|
+
|
676
|
/**
|
690
|
/**
|
677
|
* 根据商品信息设置并发请求
|
691
|
* 根据商品信息设置并发请求
|
678
|
- *
|
692
|
+ *
|
679
|
* @param array $productInfo
|
693
|
* @param array $productInfo
|
680
|
*/
|
694
|
*/
|
681
|
private static function setMultiResourceByProductBaseInfo(&$baseInfo)
|
695
|
private static function setMultiResourceByProductBaseInfo(&$baseInfo)
|
|
@@ -693,33 +707,33 @@ class ItemModel |
|
@@ -693,33 +707,33 @@ class ItemModel |
693
|
$multiResourcesUrl['ItemData::getProductModelCard'] = ItemData::getProductModelCard($productId, $isOnlyUrl);
|
707
|
$multiResourcesUrl['ItemData::getProductModelCard'] = ItemData::getProductModelCard($productId, $isOnlyUrl);
|
694
|
$multiResourcesUrl['ItemData::getProductModelTry'] = ItemData::getProductModelTry($skn, $isOnlyUrl);
|
708
|
$multiResourcesUrl['ItemData::getProductModelTry'] = ItemData::getProductModelTry($skn, $isOnlyUrl);
|
695
|
$multiResourcesUrl['BrandData::getBannerInfo'] = BrandData::getBannerInfo($brandId, $isOnlyUrl);
|
709
|
$multiResourcesUrl['BrandData::getBannerInfo'] = BrandData::getBannerInfo($brandId, $isOnlyUrl);
|
696
|
- if(!empty($uid)) {
|
710
|
+ if (!empty($uid)) {
|
697
|
$multiResourcesUrl['FavoriteData::getUidProductFav'] = FavoriteData::getUidProductFav($uid, $productId, $isOnlyUrl);
|
711
|
$multiResourcesUrl['FavoriteData::getUidProductFav'] = FavoriteData::getUidProductFav($uid, $productId, $isOnlyUrl);
|
698
|
}
|
712
|
}
|
699
|
self::$multiResources = Yohobuy::getMulti($multiResourcesUrl, array(), false, 5, true);
|
713
|
self::$multiResources = Yohobuy::getMulti($multiResourcesUrl, array(), false, 5, true);
|
700
|
}
|
714
|
}
|
701
|
-
|
715
|
+
|
702
|
/**
|
716
|
/**
|
703
|
* 根据资源名称获取并发数据
|
717
|
* 根据资源名称获取并发数据
|
704
|
- *
|
718
|
+ *
|
705
|
* @param string $resourceName
|
719
|
* @param string $resourceName
|
706
|
* @return array
|
720
|
* @return array
|
707
|
*/
|
721
|
*/
|
708
|
private static function getMultiDataByResourceName($resourceName)
|
722
|
private static function getMultiDataByResourceName($resourceName)
|
709
|
{
|
723
|
{
|
710
|
- if(isset(self::$multiResources[$resourceName])) {
|
724
|
+ if (isset(self::$multiResources[$resourceName])) {
|
711
|
return self::$multiResources[$resourceName];
|
725
|
return self::$multiResources[$resourceName];
|
712
|
} else {
|
726
|
} else {
|
713
|
return false;
|
727
|
return false;
|
714
|
}
|
728
|
}
|
715
|
}
|
729
|
}
|
716
|
-
|
730
|
+
|
717
|
/**
|
731
|
/**
|
718
|
* 根据最大分类ID获取尺寸属性
|
732
|
* 根据最大分类ID获取尺寸属性
|
719
|
- *
|
733
|
+ *
|
720
|
* @param string $maxSortId
|
734
|
* @param string $maxSortId
|
721
|
* @param array $sizeList
|
735
|
* @param array $sizeList
|
722
|
- * @return array
|
736
|
+ * @return array
|
723
|
*/
|
737
|
*/
|
724
|
private static function getSizeAttrByMaxSortId($maxSortId, array $sizeList)
|
738
|
private static function getSizeAttrByMaxSortId($maxSortId, array $sizeList)
|
725
|
{
|
739
|
{
|
|
@@ -738,34 +752,34 @@ class ItemModel |
|
@@ -738,34 +752,34 @@ class ItemModel |
738
|
$sizeInfos = array();
|
752
|
$sizeInfos = array();
|
739
|
$attributeNames = array();
|
753
|
$attributeNames = array();
|
740
|
//获取属性名称
|
754
|
//获取属性名称
|
741
|
- foreach($sizeList['sizeAttributeBos'] as $size) {
|
755
|
+ foreach ($sizeList['sizeAttributeBos'] as $size) {
|
742
|
$attributeNames[$size['id']] = $size['attributeName'];
|
756
|
$attributeNames[$size['id']] = $size['attributeName'];
|
743
|
}
|
757
|
}
|
744
|
-
|
|
|
745
|
- foreach($sizeList['sizeBoList'] as $size) {
|
758
|
+
|
|
|
759
|
+ foreach ($sizeList['sizeBoList'] as $size) {
|
746
|
$sizeValues = array();
|
760
|
$sizeValues = array();
|
747
|
- foreach($size['sortAttributes'] as $sort) {
|
|
|
748
|
- if(in_array($sort['id'], $attributeIds)) {
|
|
|
749
|
- if(!empty($sort['sizeValue'])) {
|
|
|
750
|
- $sizeValues[] = $attributeNames[$sort['id']].' '.$sort['sizeValue'].'cm';
|
761
|
+ foreach ($size['sortAttributes'] as $sort) {
|
|
|
762
|
+ if (in_array($sort['id'], $attributeIds)) {
|
|
|
763
|
+ if (!empty($sort['sizeValue'])) {
|
|
|
764
|
+ $sizeValues[] = $attributeNames[$sort['id']] . ' ' . $sort['sizeValue'] . 'cm';
|
751
|
}
|
765
|
}
|
752
|
}
|
766
|
}
|
753
|
}
|
767
|
}
|
754
|
//获取尺寸属性
|
768
|
//获取尺寸属性
|
755
|
- if(!empty($sizeValues)) {
|
769
|
+ if (!empty($sizeValues)) {
|
756
|
$sizeInfos[$size['sizeName']] = implode(' / ', $sizeValues);
|
770
|
$sizeInfos[$size['sizeName']] = implode(' / ', $sizeValues);
|
757
|
}
|
771
|
}
|
758
|
}
|
772
|
}
|
759
|
return $sizeInfos;
|
773
|
return $sizeInfos;
|
760
|
}
|
774
|
}
|
761
|
-
|
775
|
+
|
762
|
/**
|
776
|
/**
|
763
|
* 获取尺寸信息
|
777
|
* 获取尺寸信息
|
764
|
- *
|
778
|
+ *
|
765
|
* @param array $sizeInfo
|
779
|
* @param array $sizeInfo
|
766
|
- * @return array
|
780
|
+ * @return array
|
767
|
*/
|
781
|
*/
|
768
|
- private static function getSizeDataBySizeInfo(array &$sizeInfo)
|
782
|
+ private static function getSizeDataBySizeInfo(array &$sizeInfo)
|
769
|
{
|
783
|
{
|
770
|
$size = array();
|
784
|
$size = array();
|
771
|
// 尺码信息
|
785
|
// 尺码信息
|
|
@@ -785,14 +799,14 @@ class ItemModel |
|
@@ -785,14 +799,14 @@ class ItemModel |
785
|
}
|
799
|
}
|
786
|
// 判断是否显示参考尺码
|
800
|
// 判断是否显示参考尺码
|
787
|
$showReference = ($boyReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['boyReferSize'])) ||
|
801
|
$showReference = ($boyReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['boyReferSize'])) ||
|
788
|
- ($girlReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['girlReferSize']) );
|
|
|
789
|
-
|
802
|
+ ($girlReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['girlReferSize']));
|
|
|
803
|
+
|
790
|
if (!empty($sizeInfo['sizeInfoBo']['sizeAttributeBos'])) {
|
804
|
if (!empty($sizeInfo['sizeInfoBo']['sizeAttributeBos'])) {
|
791
|
//尺码信息头部
|
805
|
//尺码信息头部
|
792
|
$size['thead'] = array(0 => array('name' => '吊牌尺码', 'id' => ''));
|
806
|
$size['thead'] = array(0 => array('name' => '吊牌尺码', 'id' => ''));
|
793
|
//显示参考尺码
|
807
|
//显示参考尺码
|
794
|
if ($showReference) {
|
808
|
if ($showReference) {
|
795
|
- $size['thead'][1] = array('name' => $referenceName,'id' => '');
|
809
|
+ $size['thead'][1] = array('name' => $referenceName, 'id' => '');
|
796
|
}
|
810
|
}
|
797
|
foreach ($sizeInfo['sizeInfoBo']['sizeAttributeBos'] as $attr) {
|
811
|
foreach ($sizeInfo['sizeInfoBo']['sizeAttributeBos'] as $attr) {
|
798
|
$size['thead'][] = array('name' => empty($attr['attributeName']) ? ' ' : $attr['attributeName'], 'id' => $attr['id']);
|
812
|
$size['thead'][] = array('name' => empty($attr['attributeName']) ? ' ' : $attr['attributeName'], 'id' => $attr['id']);
|
|
@@ -803,13 +817,13 @@ class ItemModel |
|
@@ -803,13 +817,13 @@ class ItemModel |
803
|
$sizes = array($value['sizeName']);
|
817
|
$sizes = array($value['sizeName']);
|
804
|
//判断是否显示参考尺码
|
818
|
//判断是否显示参考尺码
|
805
|
if ($boyReference && ($gender == 1 || $gender == 3) && $showReference) {
|
819
|
if ($boyReference && ($gender == 1 || $gender == 3) && $showReference) {
|
806
|
- $sizes[] = empty($value['boyReferSize']['referenceName']) ? ' ' : $value['boyReferSize']['referenceName'];
|
|
|
807
|
- } else if ($girlReference && ($gender == 2 || $gender == 3) && $showReference) {
|
820
|
+ $sizes[] = empty($value['boyReferSize']['referenceName']) ? ' ' : $value['boyReferSize']['referenceName'];
|
|
|
821
|
+ } else if ($girlReference && ($gender == 2 || $gender == 3) && $showReference) {
|
808
|
$sizes[] = empty($value['girlReferSize']['referenceName']) ? ' ' : $value['girlReferSize']['referenceName'];
|
822
|
$sizes[] = empty($value['girlReferSize']['referenceName']) ? ' ' : $value['girlReferSize']['referenceName'];
|
809
|
} else {
|
823
|
} else {
|
810
|
- if(isset($size['thead'][1]) && $showReference) {
|
824
|
+ if (isset($size['thead'][1]) && $showReference) {
|
811
|
$size['thead'][1] = array();
|
825
|
$size['thead'][1] = array();
|
812
|
- }
|
826
|
+ }
|
813
|
}
|
827
|
}
|
814
|
//其他尺码信息
|
828
|
//其他尺码信息
|
815
|
foreach ($value['sortAttributes'] as $attr) {
|
829
|
foreach ($value['sortAttributes'] as $attr) {
|
|
@@ -819,20 +833,20 @@ class ItemModel |
|
@@ -819,20 +833,20 @@ class ItemModel |
819
|
$size['tbody'][] = $sizes;
|
833
|
$size['tbody'][] = $sizes;
|
820
|
}
|
834
|
}
|
821
|
//参考尺码为空
|
835
|
//参考尺码为空
|
822
|
- if(isset($size['thead'][1]) && empty($size['thead'][1]) && $showReference) {
|
836
|
+ if (isset($size['thead'][1]) && empty($size['thead'][1]) && $showReference) {
|
823
|
unset($size['thead'][1]);
|
837
|
unset($size['thead'][1]);
|
824
|
$size['thead'] = array_values($size['thead']);
|
838
|
$size['thead'] = array_values($size['thead']);
|
825
|
}
|
839
|
}
|
826
|
}
|
840
|
}
|
827
|
}
|
841
|
}
|
828
|
-
|
842
|
+
|
829
|
// 测量方式
|
843
|
// 测量方式
|
830
|
if (!empty($sizeInfo['sizeImage'])) {
|
844
|
if (!empty($sizeInfo['sizeImage'])) {
|
831
|
$size['sizeImg'] = $sizeInfo['sizeImage'];
|
845
|
$size['sizeImg'] = $sizeInfo['sizeImage'];
|
832
|
}
|
846
|
}
|
833
|
return $size;
|
847
|
return $size;
|
834
|
}
|
848
|
}
|
835
|
-
|
849
|
+
|
836
|
/**
|
850
|
/**
|
837
|
* 使sizeBoList id以 sizeAttributeBos id顺序一样
|
851
|
* 使sizeBoList id以 sizeAttributeBos id顺序一样
|
838
|
* @param type array $sizeInfoBo
|
852
|
* @param type array $sizeInfoBo
|
|
@@ -843,7 +857,7 @@ class ItemModel |
|
@@ -843,7 +857,7 @@ class ItemModel |
843
|
if (empty($sizeInfoBo['sizeBoList']) || empty($sizeInfoBo['sizeAttributeBos'])) {
|
857
|
if (empty($sizeInfoBo['sizeBoList']) || empty($sizeInfoBo['sizeAttributeBos'])) {
|
844
|
return array();
|
858
|
return array();
|
845
|
}
|
859
|
}
|
846
|
-
|
860
|
+
|
847
|
foreach ($sizeInfoBo['sizeBoList'] as $sizek => $sizeBoList) {
|
861
|
foreach ($sizeInfoBo['sizeBoList'] as $sizek => $sizeBoList) {
|
848
|
$sortArr = array();
|
862
|
$sortArr = array();
|
849
|
foreach ($sizeBoList['sortAttributes'] as $sortAttributes) {
|
863
|
foreach ($sizeBoList['sortAttributes'] as $sortAttributes) {
|
|
@@ -851,7 +865,7 @@ class ItemModel |
|
@@ -851,7 +865,7 @@ class ItemModel |
851
|
}
|
865
|
}
|
852
|
$sizeInfoBo['sizeBoList'][$sizek]['sortAttributes'] = $sortArr;
|
866
|
$sizeInfoBo['sizeBoList'][$sizek]['sortAttributes'] = $sortArr;
|
853
|
}
|
867
|
}
|
854
|
-
|
868
|
+
|
855
|
foreach ($sizeInfoBo['sizeBoList'] as $sizek => $sizeBoList) {
|
869
|
foreach ($sizeInfoBo['sizeBoList'] as $sizek => $sizeBoList) {
|
856
|
$sortArr = array();
|
870
|
$sortArr = array();
|
857
|
foreach ($sizeInfoBo['sizeAttributeBos'] as $val) {
|
871
|
foreach ($sizeInfoBo['sizeAttributeBos'] as $val) {
|
|
@@ -859,17 +873,17 @@ class ItemModel |
|
@@ -859,17 +873,17 @@ class ItemModel |
859
|
}
|
873
|
}
|
860
|
$sizeInfoBo['sizeBoList'][$sizek]['sortAttributes'] = $sortArr;
|
874
|
$sizeInfoBo['sizeBoList'][$sizek]['sortAttributes'] = $sortArr;
|
861
|
}
|
875
|
}
|
862
|
-
|
876
|
+
|
863
|
return $sizeInfoBo;
|
877
|
return $sizeInfoBo;
|
864
|
}
|
878
|
}
|
865
|
-
|
879
|
+
|
866
|
/**
|
880
|
/**
|
867
|
* 获取模特数据
|
881
|
* 获取模特数据
|
868
|
- *
|
882
|
+ *
|
869
|
* @param array $sizeInfo
|
883
|
* @param array $sizeInfo
|
870
|
- * @return array
|
884
|
+ * @return array
|
871
|
*/
|
885
|
*/
|
872
|
- private static function getReferenceDataBySizeInfo(array &$sizeInfo)
|
886
|
+ private static function getReferenceDataBySizeInfo(array &$sizeInfo)
|
873
|
{
|
887
|
{
|
874
|
$reference = array();
|
888
|
$reference = array();
|
875
|
if (!empty($sizeInfo['modelBos'])) {
|
889
|
if (!empty($sizeInfo['modelBos'])) {
|
|
@@ -877,45 +891,45 @@ class ItemModel |
|
@@ -877,45 +891,45 @@ class ItemModel |
877
|
//模特信息
|
891
|
//模特信息
|
878
|
$reference['tbody'] = array();
|
892
|
$reference['tbody'] = array();
|
879
|
$reference['thead'] = array(
|
893
|
$reference['thead'] = array(
|
880
|
- array('name' => ''), array('name' => '模特', 'modelCol'=> true),
|
|
|
881
|
- array('name' => '身高'),array('name' => '体重'),
|
|
|
882
|
- array('name' => '三围'),array('name' => '吊牌尺码'),
|
894
|
+ array('name' => ''), array('name' => '模特', 'modelCol' => true),
|
|
|
895
|
+ array('name' => '身高'), array('name' => '体重'),
|
|
|
896
|
+ array('name' => '三围'), array('name' => '吊牌尺码'),
|
883
|
array('name' => '试穿描述'),
|
897
|
array('name' => '试穿描述'),
|
884
|
);
|
898
|
);
|
885
|
//模特数据
|
899
|
//模特数据
|
886
|
- foreach($sizeInfo['modelBos'] as $value) {
|
900
|
+ foreach ($sizeInfo['modelBos'] as $value) {
|
887
|
$modelValue = array(Images::getForceSourceUrl($value['avatar']),
|
901
|
$modelValue = array(Images::getForceSourceUrl($value['avatar']),
|
888
|
- $value['modelName'],$value['height'],$value['weight'],$value['vitalStatistics'],
|
|
|
889
|
- $value['fitModelBo']['fit_size'],$value['fitModelBo']['feel']
|
902
|
+ $value['modelName'], $value['height'], $value['weight'], $value['vitalStatistics'],
|
|
|
903
|
+ $value['fitModelBo']['fit_size'], $value['fitModelBo']['feel']
|
890
|
);
|
904
|
);
|
891
|
//是否有备注
|
905
|
//是否有备注
|
892
|
if (!empty($value['fitModelBo']['fit_remark'])) {
|
906
|
if (!empty($value['fitModelBo']['fit_remark'])) {
|
893
|
$modelValue[] = $value['fitModelBo']['fit_remark'];
|
907
|
$modelValue[] = $value['fitModelBo']['fit_remark'];
|
894
|
- $reference['thead'][7] = array('name' => '备注','remarkCol' => true);
|
908
|
+ $reference['thead'][7] = array('name' => '备注', 'remarkCol' => true);
|
895
|
}
|
909
|
}
|
896
|
$reference['tbody'][] = $modelValue;
|
910
|
$reference['tbody'][] = $modelValue;
|
897
|
}
|
911
|
}
|
898
|
}
|
912
|
}
|
899
|
return $reference;
|
913
|
return $reference;
|
900
|
}
|
914
|
}
|
901
|
-
|
915
|
+
|
902
|
/**
|
916
|
/**
|
903
|
* 获取洗涤材质
|
917
|
* 获取洗涤材质
|
904
|
- *
|
918
|
+ *
|
905
|
* @param array $sizeInfo
|
919
|
* @param array $sizeInfo
|
906
|
* @return array
|
920
|
* @return array
|
907
|
*/
|
921
|
*/
|
908
|
- private static function getMaterialDataBySizeInfo(array &$sizeInfo)
|
922
|
+ private static function getMaterialDataBySizeInfo(array &$sizeInfo)
|
909
|
{
|
923
|
{
|
910
|
$material = array();
|
924
|
$material = array();
|
911
|
//洗涤提示
|
925
|
//洗涤提示
|
912
|
if (!empty($sizeInfo['washTipsBoList'])) {
|
926
|
if (!empty($sizeInfo['washTipsBoList'])) {
|
913
|
$material['wash'] = array();
|
927
|
$material['wash'] = array();
|
914
|
foreach ($sizeInfo['washTipsBoList'] as $value) {
|
928
|
foreach ($sizeInfo['washTipsBoList'] as $value) {
|
915
|
- $material['wash'][] = array('name' => $value['caption'],'img' => $value['img']);
|
929
|
+ $material['wash'][] = array('name' => $value['caption'], 'img' => $value['img']);
|
916
|
}
|
930
|
}
|
917
|
}
|
931
|
}
|
918
|
-
|
932
|
+
|
919
|
if (!empty($sizeInfo['productMaterialList'])) {
|
933
|
if (!empty($sizeInfo['productMaterialList'])) {
|
920
|
//商品材质[洗涤说明]
|
934
|
//商品材质[洗涤说明]
|
921
|
$material['materialDetail'] = array();
|
935
|
$material['materialDetail'] = array();
|
|
@@ -930,14 +944,14 @@ class ItemModel |
|
@@ -930,14 +944,14 @@ class ItemModel |
930
|
}
|
944
|
}
|
931
|
return $material;
|
945
|
return $material;
|
932
|
}
|
946
|
}
|
933
|
-
|
947
|
+
|
934
|
/**
|
948
|
/**
|
935
|
* 获取描述数据
|
949
|
* 获取描述数据
|
936
|
- *
|
950
|
+ *
|
937
|
* @param array $sizeInfo
|
951
|
* @param array $sizeInfo
|
938
|
* @return array
|
952
|
* @return array
|
939
|
*/
|
953
|
*/
|
940
|
- private static function getDescriptionDataBySizeInfo(array &$sizeInfo)
|
954
|
+ private static function getDescriptionDataBySizeInfo(array &$sizeInfo)
|
941
|
{
|
955
|
{
|
942
|
$description = array();
|
956
|
$description = array();
|
943
|
// 商品信息
|
957
|
// 商品信息
|
|
@@ -951,26 +965,26 @@ class ItemModel |
|
@@ -951,26 +965,26 @@ class ItemModel |
951
|
$sex = '女款';
|
965
|
$sex = '女款';
|
952
|
break;
|
966
|
break;
|
953
|
}
|
967
|
}
|
954
|
- $description['basic'][] = array('key' =>'编号','value' => $sizeInfo['productDescBo']['erpProductId']);
|
|
|
955
|
- $description['basic'][] = array('key' =>'颜色','value' => $sizeInfo['productDescBo']['colorName'], 'dColor' => true);
|
|
|
956
|
- $description['basic'][] = array('key' =>'性别','value' => $sex);
|
968
|
+ $description['basic'][] = array('key' => '编号', 'value' => $sizeInfo['productDescBo']['erpProductId']);
|
|
|
969
|
+ $description['basic'][] = array('key' => '颜色', 'value' => $sizeInfo['productDescBo']['colorName'], 'dColor' => true);
|
|
|
970
|
+ $description['basic'][] = array('key' => '性别', 'value' => $sex);
|
957
|
if (!empty($sizeInfo['productDescBo']['standardBos'])) {
|
971
|
if (!empty($sizeInfo['productDescBo']['standardBos'])) {
|
958
|
foreach ($sizeInfo['productDescBo']['standardBos'] as $value) {
|
972
|
foreach ($sizeInfo['productDescBo']['standardBos'] as $value) {
|
959
|
- $description['basic'][] = array('key' => $value['standardName'], 'value'=> $value['standardVal']);
|
973
|
+ $description['basic'][] = array('key' => $value['standardName'], 'value' => $value['standardVal']);
|
960
|
}
|
974
|
}
|
961
|
}
|
975
|
}
|
962
|
$description['comfort'] = self::getProductComfort($sizeInfo['productBo']['id']);
|
976
|
$description['comfort'] = self::getProductComfort($sizeInfo['productBo']['id']);
|
963
|
}
|
977
|
}
|
964
|
return $description;
|
978
|
return $description;
|
965
|
}
|
979
|
}
|
966
|
-
|
980
|
+
|
967
|
/**
|
981
|
/**
|
968
|
* 获取商品详情页介绍
|
982
|
* 获取商品详情页介绍
|
969
|
- *
|
983
|
+ *
|
970
|
* @param array $sizeInfo
|
984
|
* @param array $sizeInfo
|
971
|
* @return string
|
985
|
* @return string
|
972
|
*/
|
986
|
*/
|
973
|
- private static function getDetailDataBySizeInfo(array &$sizeInfo)
|
987
|
+ private static function getDetailDataBySizeInfo(array &$sizeInfo)
|
974
|
{
|
988
|
{
|
975
|
$details = '';
|
989
|
$details = '';
|
976
|
// 详情配图
|
990
|
// 详情配图
|
|
@@ -987,14 +1001,14 @@ class ItemModel |
|
@@ -987,14 +1001,14 @@ class ItemModel |
987
|
}
|
1001
|
}
|
988
|
return $details;
|
1002
|
return $details;
|
989
|
}
|
1003
|
}
|
990
|
-
|
1004
|
+
|
991
|
/**
|
1005
|
/**
|
992
|
* 获取sku商品数据
|
1006
|
* 获取sku商品数据
|
993
|
- *
|
1007
|
+ *
|
994
|
* @param array $baseInfo
|
1008
|
* @param array $baseInfo
|
995
|
- * @return array
|
1009
|
+ * @return array
|
996
|
*/
|
1010
|
*/
|
997
|
- private static function getSkuDataByProductBaseInfo(array &$baseInfo)
|
1011
|
+ private static function getSkuDataByProductBaseInfo(array &$baseInfo)
|
998
|
{
|
1012
|
{
|
999
|
$totalStorageNum = 0;
|
1013
|
$totalStorageNum = 0;
|
1000
|
$skuGoods = array();//sku商品
|
1014
|
$skuGoods = array();//sku商品
|
|
@@ -1003,9 +1017,9 @@ class ItemModel |
|
@@ -1003,9 +1017,9 @@ class ItemModel |
1003
|
if (!empty($baseInfo['goodsList'])) {
|
1017
|
if (!empty($baseInfo['goodsList'])) {
|
1004
|
$goodsGroup = array();
|
1018
|
$goodsGroup = array();
|
1005
|
foreach ($baseInfo['goodsList'] as $pos => $value) {
|
1019
|
foreach ($baseInfo['goodsList'] as $pos => $value) {
|
1006
|
-
|
1020
|
+
|
1007
|
// 如果status为0,即skc下架时就跳过该商品$value['status'] === 0
|
1021
|
// 如果status为0,即skc下架时就跳过该商品$value['status'] === 0
|
1008
|
- if (empty($value['colorImage']) ) {
|
1022
|
+ if (empty($value['colorImage'])) {
|
1009
|
continue;
|
1023
|
continue;
|
1010
|
}
|
1024
|
}
|
1011
|
if (isset($value['goodsImagesList'])) {
|
1025
|
if (isset($value['goodsImagesList'])) {
|
|
@@ -1013,52 +1027,52 @@ class ItemModel |
|
@@ -1013,52 +1027,52 @@ class ItemModel |
1013
|
$goodsGroup = array(
|
1027
|
$goodsGroup = array(
|
1014
|
'productSkc' => $value['productSkc'],
|
1028
|
'productSkc' => $value['productSkc'],
|
1015
|
'src' => Images::getImageUrl($value['colorImage'], 40, 40),
|
1029
|
'src' => Images::getImageUrl($value['colorImage'], 40, 40),
|
1016
|
- 'title' => trim($baseInfo['productName']).' '.$value['colorName'],
|
1030
|
+ 'title' => trim($baseInfo['productName']) . ' ' . $value['colorName'],
|
1017
|
'name' => $value['colorName'],
|
1031
|
'name' => $value['colorName'],
|
1018
|
- 'focus'=> false,
|
1032
|
+ 'focus' => false,
|
1019
|
'total' => 0,
|
1033
|
'total' => 0,
|
1020
|
'thumbs' => array(),
|
1034
|
'thumbs' => array(),
|
1021
|
'size' => array(),
|
1035
|
'size' => array(),
|
1022
|
);
|
1036
|
);
|
1023
|
-
|
1037
|
+
|
1024
|
foreach ($value['goodsImagesList'] as $goods) {
|
1038
|
foreach ($value['goodsImagesList'] as $goods) {
|
1025
|
- if(!empty($goods['imageUrl'])) {
|
1039
|
+ if (!empty($goods['imageUrl'])) {
|
1026
|
$goodsGroup['thumbs'][] = array(
|
1040
|
$goodsGroup['thumbs'][] = array(
|
1027
|
- 'url' => '','shower' => Images::getImageUrl($goods['imageUrl'], 420, 560),
|
1041
|
+ 'url' => '', 'shower' => Images::getImageUrl($goods['imageUrl'], 420, 560),
|
1028
|
'img' => Images::getImageUrl($goods['imageUrl'], 75, 100),
|
1042
|
'img' => Images::getImageUrl($goods['imageUrl'], 75, 100),
|
1029
|
);
|
1043
|
);
|
1030
|
}
|
1044
|
}
|
1031
|
}
|
1045
|
}
|
1032
|
-
|
1046
|
+
|
1033
|
//缩略图空,不显示
|
1047
|
//缩略图空,不显示
|
1034
|
- if(empty($goodsGroup['thumbs'])) {
|
1048
|
+ if (empty($goodsGroup['thumbs'])) {
|
1035
|
continue;
|
1049
|
continue;
|
1036
|
}
|
1050
|
}
|
1037
|
-
|
1051
|
+
|
1038
|
//默认第一张图片
|
1052
|
//默认第一张图片
|
1039
|
- if($pos == 0) {
|
1053
|
+ if ($pos == 0) {
|
1040
|
$defaultImage = Images::getImageUrl($value['colorImage'], 420, 560);
|
1054
|
$defaultImage = Images::getImageUrl($value['colorImage'], 420, 560);
|
1041
|
}
|
1055
|
}
|
1042
|
-
|
1056
|
+
|
1043
|
//商品的尺码列表
|
1057
|
//商品的尺码列表
|
1044
|
foreach ($value['goodsSizeBoList'] as $size) {
|
1058
|
foreach ($value['goodsSizeBoList'] as $size) {
|
1045
|
- if($baseInfo['attribute'] == 3 ) { //虚拟商品,增加为一件
|
|
|
1046
|
- $size['goodsSizeStorageNum'] = $size['goodsSizeStorageNum'] > 1 ? 1: 0;
|
1059
|
+ if ($baseInfo['attribute'] == 3) { //虚拟商品,增加为一件
|
|
|
1060
|
+ $size['goodsSizeStorageNum'] = $size['goodsSizeStorageNum'] > 1 ? 1 : 0;
|
1047
|
}
|
1061
|
}
|
1048
|
//如果status为0,即skc下架时就跳过该商品
|
1062
|
//如果status为0,即skc下架时就跳过该商品
|
1049
|
if ($value['status'] === 0) {
|
1063
|
if ($value['status'] === 0) {
|
1050
|
- $size['goodsSizeStorageNum'] = 0;
|
1064
|
+ $size['goodsSizeStorageNum'] = 0;
|
1051
|
}
|
1065
|
}
|
1052
|
$goodsGroup['size'][] = array(
|
1066
|
$goodsGroup['size'][] = array(
|
1053
|
'name' => $size['sizeName'],
|
1067
|
'name' => $size['sizeName'],
|
1054
|
'sku' => $size['goodsSizeSkuId'],
|
1068
|
'sku' => $size['goodsSizeSkuId'],
|
1055
|
'num' => intval($size['goodsSizeStorageNum']),
|
1069
|
'num' => intval($size['goodsSizeStorageNum']),
|
1056
|
- 'goodsId'=> $size['goodsId']
|
1070
|
+ 'goodsId' => $size['goodsId']
|
1057
|
);
|
1071
|
);
|
1058
|
//单个sku商品的总数
|
1072
|
//单个sku商品的总数
|
1059
|
$goodsGroup['total'] += intval($size['goodsSizeStorageNum']);
|
1073
|
$goodsGroup['total'] += intval($size['goodsSizeStorageNum']);
|
1060
|
-
|
|
|
1061
|
- if($goodsGroup['total']> 0 && !$chooseSkuFlag) { //默认选中该sku商品
|
1074
|
+
|
|
|
1075
|
+ if ($goodsGroup['total'] > 0 && !$chooseSkuFlag) { //默认选中该sku商品
|
1062
|
$goodsGroup['focus'] = true;
|
1076
|
$goodsGroup['focus'] = true;
|
1063
|
$chooseSkuFlag = true;//选中sku商品
|
1077
|
$chooseSkuFlag = true;//选中sku商品
|
1064
|
}
|
1078
|
}
|
|
@@ -1067,23 +1081,23 @@ class ItemModel |
|
@@ -1067,23 +1081,23 @@ class ItemModel |
1067
|
}
|
1081
|
}
|
1068
|
$skuGoods[] = $goodsGroup;
|
1082
|
$skuGoods[] = $goodsGroup;
|
1069
|
}
|
1083
|
}
|
1070
|
- if(!empty($skuGoods) && !$chooseSkuFlag) {//没有选中一个sku商品,默认选中第一个sku商品
|
1084
|
+ if (!empty($skuGoods) && !$chooseSkuFlag) {//没有选中一个sku商品,默认选中第一个sku商品
|
1071
|
$skuGoods[0]['focus'] = true;
|
1085
|
$skuGoods[0]['focus'] = true;
|
1072
|
}
|
1086
|
}
|
1073
|
}
|
1087
|
}
|
1074
|
- return array('skuGoods' => $skuGoods,'totalStorageNum' => $totalStorageNum,
|
1088
|
+ return array('skuGoods' => $skuGoods, 'totalStorageNum' => $totalStorageNum,
|
1075
|
'defaultImage' => $defaultImage);
|
1089
|
'defaultImage' => $defaultImage);
|
1076
|
}
|
1090
|
}
|
1077
|
-
|
1091
|
+
|
1078
|
/**
|
1092
|
/**
|
1079
|
* 获取品牌数据
|
1093
|
* 获取品牌数据
|
1080
|
- *
|
1094
|
+ *
|
1081
|
* @param array $baseInfo
|
1095
|
* @param array $baseInfo
|
1082
|
* @return array
|
1096
|
* @return array
|
1083
|
*/
|
1097
|
*/
|
1084
|
- private static function getBrandDataByProductBaseInfo(array &$baseInfo)
|
1098
|
+ private static function getBrandDataByProductBaseInfo(array &$baseInfo)
|
1085
|
{
|
1099
|
{
|
1086
|
- if(empty($baseInfo['brand'])) {
|
1100
|
+ if (empty($baseInfo['brand'])) {
|
1087
|
return array();
|
1101
|
return array();
|
1088
|
}
|
1102
|
}
|
1089
|
$brandId = $baseInfo['brand']['id'];
|
1103
|
$brandId = $baseInfo['brand']['id'];
|
|
@@ -1091,56 +1105,55 @@ class ItemModel |
|
@@ -1091,56 +1105,55 @@ class ItemModel |
1091
|
$logo = '';
|
1105
|
$logo = '';
|
1092
|
$bannerInfo = array();
|
1106
|
$bannerInfo = array();
|
1093
|
$result = self::getMultiDataByResourceName('BrandData::getBannerInfo');
|
1107
|
$result = self::getMultiDataByResourceName('BrandData::getBannerInfo');
|
1094
|
- if(empty($result)) {
|
1108
|
+ if (empty($result)) {
|
1095
|
$result = BrandData::getBannerInfo($brandId);//品牌banner
|
1109
|
$result = BrandData::getBannerInfo($brandId);//品牌banner
|
1096
|
}
|
1110
|
}
|
1097
|
- if(!empty($baseInfo['brand']['brandIco'])) {
|
1111
|
+ if (!empty($baseInfo['brand']['brandIco'])) {
|
1098
|
$logo = Images::getForceSourceUrl($baseInfo['brand']['brandIco']);
|
1112
|
$logo = Images::getForceSourceUrl($baseInfo['brand']['brandIco']);
|
1099
|
}
|
1113
|
}
|
1100
|
- if(isset($result['code']) && $result['code'] == 200 && !empty($result['data'])) {
|
1114
|
+ if (isset($result['code']) && $result['code'] == 200 && !empty($result['data'])) {
|
1101
|
$bannerInfo = $result['data'];
|
1115
|
$bannerInfo = $result['data'];
|
1102
|
- if(!empty($bannerInfo['bannerUrl'])) {
|
1116
|
+ if (!empty($bannerInfo['bannerUrl'])) {
|
1103
|
$bgImg = Images::getForceSourceUrl($bannerInfo['bannerUrl']);
|
1117
|
$bgImg = Images::getForceSourceUrl($bannerInfo['bannerUrl']);
|
1104
|
}
|
1118
|
}
|
1105
|
- }
|
1119
|
+ }
|
1106
|
//banner的logo
|
1120
|
//banner的logo
|
1107
|
- if(!empty($bannerInfo['logo']))
|
|
|
1108
|
- {
|
1121
|
+ if (!empty($bannerInfo['logo'])) {
|
1109
|
$logo = Images::getForceSourceUrl($bannerInfo['logo']);
|
1122
|
$logo = Images::getForceSourceUrl($bannerInfo['logo']);
|
1110
|
- }
|
1123
|
+ }
|
1111
|
$homeUrl = 'javascript:void(0)';
|
1124
|
$homeUrl = 'javascript:void(0)';
|
1112
|
- if(!empty($baseInfo['brand']['brandDomain'])){
|
1125
|
+ if (!empty($baseInfo['brand']['brandDomain'])) {
|
1113
|
$homeUrl = Helpers::url('', array(), $baseInfo['brand']['brandDomain']);
|
1126
|
$homeUrl = Helpers::url('', array(), $baseInfo['brand']['brandDomain']);
|
1114
|
}
|
1127
|
}
|
1115
|
//导航的品牌banner
|
1128
|
//导航的品牌banner
|
1116
|
return array(
|
1129
|
return array(
|
1117
|
'brandId' => $baseInfo['brand']['id'],
|
1130
|
'brandId' => $baseInfo['brand']['id'],
|
1118
|
- 'bgColor' => !empty($bannerInfo['colorValue']) ? $bannerInfo['colorValue']: '#000000',
|
|
|
1119
|
- 'bgImg'=> $bgImg,
|
|
|
1120
|
- 'logo'=> $logo,
|
1131
|
+ 'bgColor' => !empty($bannerInfo['colorValue']) ? $bannerInfo['colorValue'] : '#000000',
|
|
|
1132
|
+ 'bgImg' => $bgImg,
|
|
|
1133
|
+ 'logo' => $logo,
|
1121
|
'alt' => $baseInfo['brand']['brandName'],
|
1134
|
'alt' => $baseInfo['brand']['brandName'],
|
1122
|
'brandName' => $baseInfo['brand']['brandName'],
|
1135
|
'brandName' => $baseInfo['brand']['brandName'],
|
1123
|
'brandDomain' => $baseInfo['brand']['brandDomain'],
|
1136
|
'brandDomain' => $baseInfo['brand']['brandDomain'],
|
1124
|
- 'homeUrl'=> $homeUrl,
|
|
|
1125
|
- 'isCollect'=> false
|
1137
|
+ 'homeUrl' => $homeUrl,
|
|
|
1138
|
+ 'isCollect' => false
|
1126
|
);
|
1139
|
);
|
1127
|
}
|
1140
|
}
|
1128
|
-
|
1141
|
+
|
1129
|
/**
|
1142
|
/**
|
1130
|
* 获取vip数据
|
1143
|
* 获取vip数据
|
1131
|
- *
|
1144
|
+ *
|
1132
|
* @param array $baseInfo
|
1145
|
* @param array $baseInfo
|
1133
|
* @param int $vipLevel
|
1146
|
* @param int $vipLevel
|
1134
|
* @param int $uid
|
1147
|
* @param int $uid
|
1135
|
* @return array
|
1148
|
* @return array
|
1136
|
*/
|
1149
|
*/
|
1137
|
- private static function getVipDataByProductBaseInfo(array &$baseInfo, $vipLevel = 0, $uid = 0)
|
1150
|
+ private static function getVipDataByProductBaseInfo(array &$baseInfo, $vipLevel = 0, $uid = 0)
|
1138
|
{
|
1151
|
{
|
1139
|
$vipData = array();
|
1152
|
$vipData = array();
|
1140
|
if (!empty($baseInfo['productPriceBo']['vipPrices'])) {
|
1153
|
if (!empty($baseInfo['productPriceBo']['vipPrices'])) {
|
1141
|
$build = array();
|
1154
|
$build = array();
|
1142
|
//不是普通会员
|
1155
|
//不是普通会员
|
1143
|
- if($vipLevel > 0) {
|
1156
|
+ if ($vipLevel > 0) {
|
1144
|
foreach ($baseInfo['productPriceBo']['vipPrices'] as $value) {
|
1157
|
foreach ($baseInfo['productPriceBo']['vipPrices'] as $value) {
|
1145
|
$build['level'] = $value['vipLevel'];
|
1158
|
$build['level'] = $value['vipLevel'];
|
1146
|
$build['price'] = $value['vipPrice'];
|
1159
|
$build['price'] = $value['vipPrice'];
|
|
@@ -1151,10 +1164,10 @@ class ItemModel |
|
@@ -1151,10 +1164,10 @@ class ItemModel |
1151
|
}
|
1164
|
}
|
1152
|
$vipData['unLogin'] = false;
|
1165
|
$vipData['unLogin'] = false;
|
1153
|
//登录状态
|
1166
|
//登录状态
|
1154
|
- if(empty($uid)) {
|
1167
|
+ if (empty($uid)) {
|
1155
|
$vipData['unLogin'] = Helpers::url('/signin.html', array());
|
1168
|
$vipData['unLogin'] = Helpers::url('/signin.html', array());
|
1156
|
}
|
1169
|
}
|
1157
|
- if(empty($vipLevel) && !empty($uid)) {
|
1170
|
+ if (empty($vipLevel) && !empty($uid)) {
|
1158
|
$vipData['normalUser'] = true;
|
1171
|
$vipData['normalUser'] = true;
|
1159
|
}
|
1172
|
}
|
1160
|
//查看vip进度
|
1173
|
//查看vip进度
|
|
@@ -1162,37 +1175,28 @@ class ItemModel |
|
@@ -1162,37 +1175,28 @@ class ItemModel |
1162
|
}
|
1175
|
}
|
1163
|
return $vipData;
|
1176
|
return $vipData;
|
1164
|
}
|
1177
|
}
|
1165
|
-
|
1178
|
+
|
1166
|
/**
|
1179
|
/**
|
1167
|
* 获取活动数据(促销相关活动)
|
1180
|
* 获取活动数据(促销相关活动)
|
1168
|
- *
|
1181
|
+ *
|
1169
|
* @param array $baseInfo
|
1182
|
* @param array $baseInfo
|
1170
|
* @return array
|
1183
|
* @return array
|
1171
|
*/
|
1184
|
*/
|
1172
|
- private static function getActivityDataByProductBaseInfo(array &$baseInfo)
|
1185
|
+ private static function getActivityDataByProductBaseInfo(array &$activityData)
|
1173
|
{
|
1186
|
{
|
1174
|
$activity = array();
|
1187
|
$activity = array();
|
1175
|
- //促销活动banner
|
|
|
1176
|
- $activityBanner = self::getProductActivityBanner($baseInfo['id']);
|
|
|
1177
|
-
|
|
|
1178
|
- if(!empty($activityBanner)) {
|
|
|
1179
|
- $activity[] = $activityBanner;
|
|
|
1180
|
- }
|
|
|
1181
|
- // 促销信息活动
|
|
|
1182
|
- if (isset($baseInfo['promotionBoList'])) {
|
|
|
1183
|
- $build = array();
|
|
|
1184
|
- foreach ($baseInfo['promotionBoList'] as $value) {
|
|
|
1185
|
- $build['type'] = $value['promotionType'];
|
|
|
1186
|
- $build['des'] = $value['promotionTitle'];
|
|
|
1187
|
- $activity[] = $build;
|
|
|
1188
|
- }
|
1188
|
+ $build = array();
|
|
|
1189
|
+ foreach ($activityData as $value) {
|
|
|
1190
|
+ $build['type'] = $value['promotionType'];
|
|
|
1191
|
+ $build['des'] = $value['promotionTitle'];
|
|
|
1192
|
+ $activity[] = $build;
|
1189
|
}
|
1193
|
}
|
1190
|
return $activity;
|
1194
|
return $activity;
|
1191
|
}
|
1195
|
}
|
1192
|
-
|
1196
|
+
|
1193
|
/**
|
1197
|
/**
|
1194
|
* 获取标签相关数据
|
1198
|
* 获取标签相关数据
|
1195
|
- *
|
1199
|
+ *
|
1196
|
* @param array $baseInfo
|
1200
|
* @param array $baseInfo
|
1197
|
* @return array
|
1201
|
* @return array
|
1198
|
*/
|
1202
|
*/
|
|
@@ -1231,45 +1235,46 @@ class ItemModel |
|
@@ -1231,45 +1235,46 @@ class ItemModel |
1231
|
}
|
1235
|
}
|
1232
|
return $tags;
|
1236
|
return $tags;
|
1233
|
}
|
1237
|
}
|
1234
|
-
|
1238
|
+
|
1235
|
/**
|
1239
|
/**
|
1236
|
* 获取模特试穿
|
1240
|
* 获取模特试穿
|
1237
|
- *
|
1241
|
+ *
|
1238
|
* @param string $productSkn
|
1242
|
* @param string $productSkn
|
1239
|
- * @return array
|
1243
|
+ * @return array
|
1240
|
*/
|
1244
|
*/
|
1241
|
public static function getProductModelTry($productSkn)
|
1245
|
public static function getProductModelTry($productSkn)
|
1242
|
{
|
1246
|
{
|
1243
|
$modelTry = array();
|
1247
|
$modelTry = array();
|
1244
|
$result = self::getMultiDataByResourceName('ItemData::getProductModelTry');
|
1248
|
$result = self::getMultiDataByResourceName('ItemData::getProductModelTry');
|
1245
|
- if(empty($result)) {
|
1249
|
+ if (empty($result)) {
|
1246
|
$result = ItemData::getProductModelTry($productSkn);
|
1250
|
$result = ItemData::getProductModelTry($productSkn);
|
1247
|
}
|
1251
|
}
|
1248
|
- if(isset($result['code']) && $result['code'] == 200 && !empty($result['data'])) {
|
1252
|
+ if (isset($result['code']) && $result['code'] == 200 && !empty($result['data'])) {
|
1249
|
//先显示模特信息
|
1253
|
//先显示模特信息
|
1250
|
- if(isset($result['data']['modelTryBoList']) && !empty($result['data']['modelTryBoList'])) {
|
|
|
1251
|
- $modelTry['thead'] = array('模特','身高','体重','三围','试穿尺码','试穿描述');
|
1254
|
+ if (isset($result['data']['modelTryBoList']) && !empty($result['data']['modelTryBoList'])) {
|
|
|
1255
|
+ $modelTry['thead'] = array('模特', '身高', '体重', '三围', '试穿尺码', '试穿描述');
|
1252
|
$modelTry['tbody'] = array();
|
1256
|
$modelTry['tbody'] = array();
|
1253
|
- foreach($result['data']['modelTryBoList'] as $val) {
|
|
|
1254
|
- if(isset($val['modelBo']) && isset($val['sizeBo']) &&
|
|
|
1255
|
- isset($val['modelBo']['modelName']) && isset($val['sizeBo']['sizeName'])) {
|
1257
|
+ foreach ($result['data']['modelTryBoList'] as $val) {
|
|
|
1258
|
+ if (isset($val['modelBo']) && isset($val['sizeBo']) &&
|
|
|
1259
|
+ isset($val['modelBo']['modelName']) && isset($val['sizeBo']['sizeName'])
|
|
|
1260
|
+ ) {
|
1256
|
$modelTry['tbody'][] = array($val['modelBo']['modelName'],
|
1261
|
$modelTry['tbody'][] = array($val['modelBo']['modelName'],
|
1257
|
- $val['modelBo']['height'],$val['modelBo']['weight'],$val['modelBo']['vitalStatistics'],
|
1262
|
+ $val['modelBo']['height'], $val['modelBo']['weight'], $val['modelBo']['vitalStatistics'],
|
1258
|
$val['sizeBo']['sizeName'], $val['tryDesc']);
|
1263
|
$val['sizeBo']['sizeName'], $val['tryDesc']);
|
1259
|
}
|
1264
|
}
|
1260
|
}
|
1265
|
}
|
1261
|
- } else if(isset($result['data']['modelTryImgBoList']) && !empty($result['data']['modelTryImgBoList'])) {//后显示模特图
|
1266
|
+ } else if (isset($result['data']['modelTryImgBoList']) && !empty($result['data']['modelTryImgBoList'])) {//后显示模特图
|
1262
|
$tryImg = current($result['data']['modelTryImgBoList']);
|
1267
|
$tryImg = current($result['data']['modelTryImgBoList']);
|
1263
|
$modelTry['frImg'] = Images::getForceSourceUrl($tryImg['tryImg']);
|
1268
|
$modelTry['frImg'] = Images::getForceSourceUrl($tryImg['tryImg']);
|
1264
|
}
|
1269
|
}
|
1265
|
}
|
1270
|
}
|
1266
|
return $modelTry;
|
1271
|
return $modelTry;
|
1267
|
}
|
1272
|
}
|
1268
|
-
|
1273
|
+
|
1269
|
/**
|
1274
|
/**
|
1270
|
* 处理限购商品的有关按钮状态(或取现购买以及底部商品购买按钮)
|
1275
|
* 处理限购商品的有关按钮状态(或取现购买以及底部商品购买按钮)
|
1271
|
*
|
1276
|
*
|
1272
|
- * @param int $uid
|
1277
|
+ * @param int $uid
|
1273
|
* @param int $showStatus 限购商品的关联状态
|
1278
|
* @param int $showStatus 限购商品的关联状态
|
1274
|
* @param boolean $isBeginSale 限购商品是否已开售
|
1279
|
* @param boolean $isBeginSale 限购商品是否已开售
|
1275
|
*/
|
1280
|
*/
|
|
@@ -1282,12 +1287,12 @@ class ItemModel |
|
@@ -1282,12 +1287,12 @@ class ItemModel |
1282
|
//openSoon//即将开售
|
1287
|
//openSoon//即将开售
|
1283
|
//dis //失效
|
1288
|
//dis //失效
|
1284
|
//buyNow //是否立即购买
|
1289
|
//buyNow //是否立即购买
|
1285
|
- $result = array('getLimitedCode' => false, 'hasLimitedCode' => false,
|
|
|
1286
|
- 'limitedCodeSoldOut' => false, 'openSoon' => false, 'dis' => false,
|
|
|
1287
|
- 'buyNow' => false, 'soldOut'=> false, 'getLimitedCodeDis'=> false);
|
1290
|
+ $result = array('getLimitedCode' => false, 'hasLimitedCode' => false,
|
|
|
1291
|
+ 'limitedCodeSoldOut' => false, 'openSoon' => false, 'dis' => false,
|
|
|
1292
|
+ 'buyNow' => false, 'soldOut' => false, 'getLimitedCodeDis' => false);
|
1288
|
// 显示获取限购码按钮
|
1293
|
// 显示获取限购码按钮
|
1289
|
$result['getLimitedCode'] = true;
|
1294
|
$result['getLimitedCode'] = true;
|
1290
|
- switch($showStatus) {
|
1295
|
+ switch ($showStatus) {
|
1291
|
case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码)
|
1296
|
case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码)
|
1292
|
if ($isBeginSale) { // 开售后
|
1297
|
if ($isBeginSale) { // 开售后
|
1293
|
$result['buyNow'] = true;
|
1298
|
$result['buyNow'] = true;
|
|
@@ -1312,7 +1317,7 @@ class ItemModel |
|
@@ -1312,7 +1317,7 @@ class ItemModel |
1312
|
$result['buyNow'] = true;
|
1317
|
$result['buyNow'] = true;
|
1313
|
$result['dis'] = false;
|
1318
|
$result['dis'] = false;
|
1314
|
$result['hasLimitedCode'] = true;
|
1319
|
$result['hasLimitedCode'] = true;
|
1315
|
- if(!empty($uid)) {//限购码失效
|
1320
|
+ if (!empty($uid)) {//限购码失效
|
1316
|
$result['getLimitedCodeDis'] = true;
|
1321
|
$result['getLimitedCodeDis'] = true;
|
1317
|
}
|
1322
|
}
|
1318
|
break;
|
1323
|
break;
|
|
@@ -1321,32 +1326,32 @@ class ItemModel |
|
@@ -1321,32 +1326,32 @@ class ItemModel |
1321
|
$result['hasLimitedCode'] = true;
|
1326
|
$result['hasLimitedCode'] = true;
|
1322
|
$result['limitedCodeSoldOut'] = true;
|
1327
|
$result['limitedCodeSoldOut'] = true;
|
1323
|
$result['getLimitedCode'] = false;
|
1328
|
$result['getLimitedCode'] = false;
|
1324
|
-
|
1329
|
+
|
1325
|
break;
|
1330
|
break;
|
1326
|
case 6: // 开售前,即将开售(用户已领取限购码)
|
1331
|
case 6: // 开售前,即将开售(用户已领取限购码)
|
1327
|
$result['openSoon'] = true;
|
1332
|
$result['openSoon'] = true;
|
1328
|
$result['hasLimitedCode'] = true;
|
1333
|
$result['hasLimitedCode'] = true;
|
1329
|
- if(!empty($uid)) {//限购码失效
|
1334
|
+ if (!empty($uid)) {//限购码失效
|
1330
|
$result['getLimitedCodeDis'] = true;
|
1335
|
$result['getLimitedCodeDis'] = true;
|
1331
|
- }
|
1336
|
+ }
|
1332
|
break;
|
1337
|
break;
|
1333
|
case 7: // 开售后,用户已经用获得的限购码购买过商品
|
1338
|
case 7: // 开售后,用户已经用获得的限购码购买过商品
|
1334
|
$result['buyNow'] = true;
|
1339
|
$result['buyNow'] = true;
|
1335
|
$result['dis'] = true;
|
1340
|
$result['dis'] = true;
|
1336
|
$result['hasLimitedCode'] = true;
|
1341
|
$result['hasLimitedCode'] = true;
|
1337
|
- if(!empty($uid)) {//限购码失效
|
1342
|
+ if (!empty($uid)) {//限购码失效
|
1338
|
$result['getLimitedCodeDis'] = true;
|
1343
|
$result['getLimitedCodeDis'] = true;
|
1339
|
}
|
1344
|
}
|
1340
|
default:
|
1345
|
default:
|
1341
|
break;
|
1346
|
break;
|
1342
|
}
|
1347
|
}
|
1343
|
return $result;
|
1348
|
return $result;
|
1344
|
-
|
1349
|
+
|
1345
|
}
|
1350
|
}
|
1346
|
-
|
1351
|
+
|
1347
|
/**
|
1352
|
/**
|
1348
|
* 获取商品咨询和评论数据
|
1353
|
* 获取商品咨询和评论数据
|
1349
|
- *
|
1354
|
+ *
|
1350
|
* @param array $baseInfo
|
1355
|
* @param array $baseInfo
|
1351
|
* @return array
|
1356
|
* @return array
|
1352
|
*/
|
1357
|
*/
|
|
@@ -1368,5 +1373,5 @@ class ItemModel |
|
@@ -1368,5 +1373,5 @@ class ItemModel |
1368
|
}
|
1373
|
}
|
1369
|
return $consultComment;
|
1374
|
return $consultComment;
|
1370
|
}
|
1375
|
}
|
1371
|
-
|
1376
|
+
|
1372
|
} |
1377
|
} |