|
@@ -3,6 +3,7 @@ |
|
@@ -3,6 +3,7 @@ |
3
|
namespace Product;
|
3
|
namespace Product;
|
4
|
|
4
|
|
5
|
use LibModels\Wap\Product\DetailData;
|
5
|
use LibModels\Wap\Product\DetailData;
|
|
|
6
|
+use Plugin\DataProcess\CouponFloorProcess;
|
6
|
use Plugin\Helpers;
|
7
|
use Plugin\Helpers;
|
7
|
use Plugin\Images;
|
8
|
use Plugin\Images;
|
8
|
|
9
|
|
|
@@ -36,8 +37,7 @@ class DetailModel |
|
@@ -36,8 +37,7 @@ class DetailModel |
36
|
// 通过ID获取
|
37
|
// 通过ID获取
|
37
|
if (is_numeric($productId) && is_numeric($goodsId)) {
|
38
|
if (is_numeric($productId) && is_numeric($goodsId)) {
|
38
|
$baseInfo = DetailData::baseInfo($productId, $uid);
|
39
|
$baseInfo = DetailData::baseInfo($productId, $uid);
|
39
|
- }
|
|
|
40
|
- // 通过SKN获取
|
40
|
+ } // 通过SKN获取
|
41
|
elseif (is_numeric($productSkn)) {
|
41
|
elseif (is_numeric($productSkn)) {
|
42
|
$baseInfo = DetailData::baseInfo(null, $uid, $productSkn);
|
42
|
$baseInfo = DetailData::baseInfo(null, $uid, $productSkn);
|
43
|
}
|
43
|
}
|
|
@@ -50,7 +50,7 @@ class DetailModel |
|
@@ -50,7 +50,7 @@ class DetailModel |
50
|
|
50
|
|
51
|
// 用户未登录时
|
51
|
// 用户未登录时
|
52
|
if (empty($uid)) {
|
52
|
if (empty($uid)) {
|
53
|
- $result['loginUrl'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/show_' . $baseInfo['erpProductId']. '.html')));
|
53
|
+ $result['loginUrl'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/show_' . $baseInfo['erpProductId'] . '.html')));
|
54
|
}
|
54
|
}
|
55
|
|
55
|
|
56
|
// 商品促销短语
|
56
|
// 商品促销短语
|
|
@@ -137,8 +137,7 @@ class DetailModel |
|
@@ -137,8 +137,7 @@ class DetailModel |
137
|
$result['feedbacks']['consults'][] = $build;
|
137
|
$result['feedbacks']['consults'][] = $build;
|
138
|
}
|
138
|
}
|
139
|
$result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $result['feedbacks']['consultsNum']));
|
139
|
$result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $result['feedbacks']['consultsNum']));
|
140
|
- }
|
|
|
141
|
- // 暂无咨询
|
140
|
+ } // 暂无咨询
|
142
|
else {
|
141
|
else {
|
143
|
$result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consultform', array('product_id' => $productId));
|
142
|
$result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consultform', array('product_id' => $productId));
|
144
|
}
|
143
|
}
|
|
@@ -161,16 +160,19 @@ class DetailModel |
|
@@ -161,16 +160,19 @@ class DetailModel |
161
|
|
160
|
|
162
|
// 品牌信息
|
161
|
// 品牌信息
|
163
|
if (!empty($baseInfo['brand'])) {
|
162
|
if (!empty($baseInfo['brand'])) {
|
164
|
- $result['enterStore'] = array(
|
|
|
165
|
- 'img' => Helpers::getImageUrl($baseInfo['brand']['brandIco'], 47, 47),
|
|
|
166
|
- 'storeName' => $baseInfo['brand']['brandName'],
|
|
|
167
|
- 'url' => Helpers::url('', array(), $baseInfo['brand']['brandDomain'])
|
|
|
168
|
- );
|
|
|
169
|
-// foreach ($baseInfo['brand'] as $key => $brand) {
|
|
|
170
|
-// $result['enterStore'][$key]['img'] = Helpers::getImageUrl($brand['brandIco'], 47, 47);
|
|
|
171
|
-// $result['enterStore'][$key]['storeName'] = $brand['brandName'];
|
|
|
172
|
-// $result['enterStore'][$key]['url'] = Helpers::url('', array(), $brand['brandDomain']);
|
|
|
173
|
-// }
|
163
|
+// $result['enterStore'] = array(
|
|
|
164
|
+// 'img' => Helpers::getImageUrl($baseInfo['brand']['brandIco'], 47, 47),
|
|
|
165
|
+// 'storeName' => $baseInfo['brand']['brandName'],
|
|
|
166
|
+// 'url' => Helpers::url('', array(), $baseInfo['brand']['brandDomain'])
|
|
|
167
|
+// );
|
|
|
168
|
+ $shops = DetailData::queryShopsByBrandId($baseInfo['brand']['id']);
|
|
|
169
|
+ if ($shops['code'] === 200) {
|
|
|
170
|
+ foreach ($shops['data'] as $key => $shop) {
|
|
|
171
|
+ $result['enterStore'][$key]['img'] = Helpers::getImageUrl($shop['brand_ico'], 47, 47);
|
|
|
172
|
+ $result['enterStore'][$key]['storeName'] = $shop['brand_name'];
|
|
|
173
|
+ $result['enterStore'][$key]['url'] = Helpers::url('/product/index/brand', array('shop_id' => $shop['shop_id']));
|
|
|
174
|
+ }
|
|
|
175
|
+ }
|
174
|
// 为你优选的链接
|
176
|
// 为你优选的链接
|
175
|
$result['preferenceUrl'] = Helpers::url('/product/detail/preference', array('productSkn' => $baseInfo['erpProductId'], 'brandId' => $baseInfo['brand']['id']), '');
|
177
|
$result['preferenceUrl'] = Helpers::url('/product/detail/preference', array('productSkn' => $baseInfo['erpProductId'], 'brandId' => $baseInfo['brand']['id']), '');
|
176
|
}
|
178
|
}
|
|
@@ -209,11 +211,11 @@ class DetailModel |
|
@@ -209,11 +211,11 @@ class DetailModel |
209
|
}
|
211
|
}
|
210
|
|
212
|
|
211
|
// 商品的尺码列表
|
213
|
// 商品的尺码列表
|
212
|
- $colorStorageGroup[ $value['productSkc'] ] = array();
|
214
|
+ $colorStorageGroup[$value['productSkc']] = array();
|
213
|
if (isset($value['goodsSizeBoList']) && !empty($value['goodsSizeBoList'])) {
|
215
|
if (isset($value['goodsSizeBoList']) && !empty($value['goodsSizeBoList'])) {
|
214
|
$sizeName = '';
|
216
|
$sizeName = '';
|
215
|
foreach ($value['goodsSizeBoList'] as $size) {
|
217
|
foreach ($value['goodsSizeBoList'] as $size) {
|
216
|
- $sizeList[ $value['productSkc'] ][] = array(
|
218
|
+ $sizeList[$value['productSkc']][] = array(
|
217
|
'id' => $size['id'],
|
219
|
'id' => $size['id'],
|
218
|
'skuId' => $size['goodsSizeSkuId'],
|
220
|
'skuId' => $size['goodsSizeSkuId'],
|
219
|
'goodsId' => $size['goodsId'],
|
221
|
'goodsId' => $size['goodsId'],
|
|
@@ -225,10 +227,10 @@ class DetailModel |
|
@@ -225,10 +227,10 @@ class DetailModel |
225
|
|
227
|
|
226
|
// 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
|
228
|
// 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
|
227
|
$allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage'])
|
229
|
$allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage'])
|
228
|
- ? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id'])
|
|
|
229
|
- : $allSizeList[$sizeName];
|
230
|
+ ? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id'])
|
|
|
231
|
+ : $allSizeList[$sizeName];
|
230
|
$colorStorageNum += intval($size['goodsSizeStorageNum']);
|
232
|
$colorStorageNum += intval($size['goodsSizeStorageNum']);
|
231
|
- $colorStorageGroup[ $value['productSkc'] ][$sizeName] = intval($size['goodsSizeStorageNum']);
|
233
|
+ $colorStorageGroup[$value['productSkc']][$sizeName] = intval($size['goodsSizeStorageNum']);
|
232
|
}
|
234
|
}
|
233
|
|
235
|
|
234
|
// 颜色分组
|
236
|
// 颜色分组
|
|
@@ -260,23 +262,23 @@ class DetailModel |
|
@@ -260,23 +262,23 @@ class DetailModel |
260
|
|
262
|
|
261
|
// 各个颜色的尺码, 每行显示一个尺码对应的颜色
|
263
|
// 各个颜色的尺码, 每行显示一个尺码对应的颜色
|
262
|
foreach ($colorList as $colorArr) {
|
264
|
foreach ($colorList as $colorArr) {
|
263
|
- $colorArr['colorNum'] = isset($colorStorageGroup[ $colorArr['skcId'] ][$sizeName]) ? $colorStorageGroup[ $colorArr['skcId'] ][$sizeName] : 0;
|
265
|
+ $colorArr['colorNum'] = isset($colorStorageGroup[$colorArr['skcId']][$sizeName]) ? $colorStorageGroup[$colorArr['skcId']][$sizeName] : 0;
|
264
|
$colorGroup[$i]['color'][] = $colorArr;
|
266
|
$colorGroup[$i]['color'][] = $colorArr;
|
265
|
}
|
267
|
}
|
266
|
$colorGroup[$i]['id'] = $value['id'];
|
268
|
$colorGroup[$i]['id'] = $value['id'];
|
267
|
|
269
|
|
268
|
- ++ $i;
|
270
|
+ ++$i;
|
269
|
}
|
271
|
}
|
270
|
// 遍历所有颜色, 构建尺码显示数据
|
272
|
// 遍历所有颜色, 构建尺码显示数据
|
271
|
$i = 1;
|
273
|
$i = 1;
|
272
|
foreach ($colorList as $value) {
|
274
|
foreach ($colorList as $value) {
|
273
|
// 各个尺码的颜色,每行显示一个颜色的对应尺码
|
275
|
// 各个尺码的颜色,每行显示一个颜色的对应尺码
|
274
|
- $sizeGroup[$i]['size'] = $sizeList[ $value['skcId'] ];
|
276
|
+ $sizeGroup[$i]['size'] = $sizeList[$value['skcId']];
|
275
|
$sizeGroup[$i]['colorId'] = $value['skcId'];
|
277
|
$sizeGroup[$i]['colorId'] = $value['skcId'];
|
276
|
// 默认颜色
|
278
|
// 默认颜色
|
277
|
$colorGroup[0]['color'][] = $value;
|
279
|
$colorGroup[0]['color'][] = $value;
|
278
|
|
280
|
|
279
|
- ++ $i;
|
281
|
+ ++$i;
|
280
|
}
|
282
|
}
|
281
|
|
283
|
|
282
|
// 商品图: 多个
|
284
|
// 商品图: 多个
|
|
@@ -286,8 +288,7 @@ class DetailModel |
|
@@ -286,8 +288,7 @@ class DetailModel |
286
|
'img' => Helpers::getImageUrl($value['img'], 450, 600)
|
288
|
'img' => Helpers::getImageUrl($value['img'], 450, 600)
|
287
|
);
|
289
|
);
|
288
|
}
|
290
|
}
|
289
|
- }
|
|
|
290
|
- // 商品图: 单个
|
291
|
+ } // 商品图: 单个
|
291
|
elseif (isset($goodsGroup[0])) {
|
292
|
elseif (isset($goodsGroup[0])) {
|
292
|
$result['bannerTop'] = array(
|
293
|
$result['bannerTop'] = array(
|
293
|
'img' => Helpers::getImageUrl($goodsGroup[0]['img'], 450, 600)
|
294
|
'img' => Helpers::getImageUrl($goodsGroup[0]['img'], 450, 600)
|
|
@@ -336,12 +337,10 @@ class DetailModel |
|
@@ -336,12 +337,10 @@ class DetailModel |
336
|
} else {
|
337
|
} else {
|
337
|
$result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html');
|
338
|
$result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html');
|
338
|
}
|
339
|
}
|
339
|
- }
|
|
|
340
|
- // 非卖品
|
340
|
+ } // 非卖品
|
341
|
elseif ($notForSale) {
|
341
|
elseif ($notForSale) {
|
342
|
$result['cartInfo']['notForSale'] = true;
|
342
|
$result['cartInfo']['notForSale'] = true;
|
343
|
- }
|
|
|
344
|
- // 已售磬
|
343
|
+ } // 已售磬
|
345
|
elseif ($soldOut) {
|
344
|
elseif ($soldOut) {
|
346
|
$result['cartInfo']['soldOut'] = true;
|
345
|
$result['cartInfo']['soldOut'] = true;
|
347
|
}
|
346
|
}
|
|
@@ -436,7 +435,7 @@ class DetailModel |
|
@@ -436,7 +435,7 @@ class DetailModel |
436
|
|
435
|
|
437
|
$referenceList = array();
|
436
|
$referenceList = array();
|
438
|
// 判断是否显示参考尺码
|
437
|
// 判断是否显示参考尺码
|
439
|
- $showReference = ($boyReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['boyReferSize'])) || ($girlReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['girlReferSize']) );
|
438
|
+ $showReference = ($boyReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['boyReferSize'])) || ($girlReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['girlReferSize']));
|
440
|
if ($showReference) {
|
439
|
if ($showReference) {
|
441
|
$referenceList[0] = array('param' => $referenceName);
|
440
|
$referenceList[0] = array('param' => $referenceName);
|
442
|
}
|
441
|
}
|
|
@@ -794,7 +793,7 @@ class DetailModel |
|
@@ -794,7 +793,7 @@ class DetailModel |
794
|
$result['attaches'][] = self::procLimitProductAttach($item);
|
793
|
$result['attaches'][] = self::procLimitProductAttach($item);
|
795
|
}
|
794
|
}
|
796
|
|
795
|
|
797
|
- if(count($result['attaches']) > 1) {
|
796
|
+ if (count($result['attaches']) > 1) {
|
798
|
Helpers::sortArrByField($result['attaches'], 'orderBy', true);
|
797
|
Helpers::sortArrByField($result['attaches'], 'orderBy', true);
|
799
|
}
|
798
|
}
|
800
|
} while (false);
|
799
|
} while (false);
|
|
@@ -812,7 +811,7 @@ class DetailModel |
|
@@ -812,7 +811,7 @@ class DetailModel |
812
|
{
|
811
|
{
|
813
|
$result = array();
|
812
|
$result = array();
|
814
|
|
813
|
|
815
|
- switch(intval($attachment['attachType'])) {
|
814
|
+ switch (intval($attachment['attachType'])) {
|
816
|
case 1: // 大图文字
|
815
|
case 1: // 大图文字
|
817
|
$result['img'] = array(
|
816
|
$result['img'] = array(
|
818
|
'attachUrl' => Helpers::getImageUrl($attachment['attachUrl'], 750, ''),
|
817
|
'attachUrl' => Helpers::getImageUrl($attachment['attachUrl'], 750, ''),
|
|
@@ -850,7 +849,7 @@ class DetailModel |
|
@@ -850,7 +849,7 @@ class DetailModel |
850
|
*/
|
849
|
*/
|
851
|
private static function procShowStatus(&$data, $showStatus, $isBeginSale)
|
850
|
private static function procShowStatus(&$data, $showStatus, $isBeginSale)
|
852
|
{
|
851
|
{
|
853
|
- switch($showStatus) {
|
852
|
+ switch ($showStatus) {
|
854
|
case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码)
|
853
|
case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码)
|
855
|
// 显示获取限购码按钮
|
854
|
// 显示获取限购码按钮
|
856
|
$data['canGetLimitCode'] = true;
|
855
|
$data['canGetLimitCode'] = true;
|