|
@@ -4,6 +4,7 @@ use Action\AbstractAction; |
|
@@ -4,6 +4,7 @@ use Action\AbstractAction; |
4
|
use LibModels\Wap\Guang\DetailData;
|
4
|
use LibModels\Wap\Guang\DetailData;
|
5
|
use LibModels\Wap\Product\ListData;
|
5
|
use LibModels\Wap\Product\ListData;
|
6
|
use Plugin\Helpers;
|
6
|
use Plugin\Helpers;
|
|
|
7
|
+use Plugin\Images;
|
7
|
|
8
|
|
8
|
/**
|
9
|
/**
|
9
|
* 逛详情页
|
10
|
* 逛详情页
|
|
@@ -42,7 +43,6 @@ class InfoController extends AbstractAction |
|
@@ -42,7 +43,6 @@ class InfoController extends AbstractAction |
42
|
// 获取详情内容信息, 异常则跳到错误页面
|
43
|
// 获取详情内容信息, 异常则跳到错误页面
|
43
|
$detail = array();
|
44
|
$detail = array();
|
44
|
$detail = DetailData::package($id, $isApp);
|
45
|
$detail = DetailData::package($id, $isApp);
|
45
|
-
|
|
|
46
|
if (isset($detail['code']) && $detail['code'] === 400) {
|
46
|
if (isset($detail['code']) && $detail['code'] === 400) {
|
47
|
$this->error();
|
47
|
$this->error();
|
48
|
}
|
48
|
}
|
|
@@ -95,11 +95,13 @@ class InfoController extends AbstractAction |
|
@@ -95,11 +95,13 @@ class InfoController extends AbstractAction |
95
|
}
|
95
|
}
|
96
|
// 相关推荐
|
96
|
// 相关推荐
|
97
|
elseif (isset($value['goods']['data'])) {
|
97
|
elseif (isset($value['goods']['data'])) {
|
98
|
- $good = array();
|
98
|
+ $reco = array();
|
99
|
// 遍历取得SKN
|
99
|
// 遍历取得SKN
|
100
|
$skns = array();
|
100
|
$skns = array();
|
|
|
101
|
+ $arr = array();
|
101
|
foreach ($value['goods']['data'] as $goods) {
|
102
|
foreach ($value['goods']['data'] as $goods) {
|
102
|
$skns[] = $goods['id'];
|
103
|
$skns[] = $goods['id'];
|
|
|
104
|
+ $arr[$goods['id']]=$goods['src'];
|
103
|
}
|
105
|
}
|
104
|
// 通过SKN获取商品信息
|
106
|
// 通过SKN获取商品信息
|
105
|
$product = ListData::productInfoBySkns($skns);
|
107
|
$product = ListData::productInfoBySkns($skns);
|
|
@@ -109,38 +111,58 @@ class InfoController extends AbstractAction |
|
@@ -109,38 +111,58 @@ class InfoController extends AbstractAction |
109
|
if ($i > 3) {
|
111
|
if ($i > 3) {
|
110
|
break;
|
112
|
break;
|
111
|
}
|
113
|
}
|
112
|
- $good[] = Helpers::formatProduct($goods, false, true, true, 235, 314, $isApp);
|
114
|
+ $d[] = Helpers::formatProduct($goods, false, true, true, 235, 314, $isApp);
|
|
|
115
|
+ }
|
|
|
116
|
+ foreach ($arr as $k=>$v) {
|
|
|
117
|
+ foreach ($d as $key=>$value) {
|
|
|
118
|
+ if ($k == $value['id']) {
|
|
|
119
|
+ $value['thumb'] = Images::getImageUrl($v,235,314);
|
|
|
120
|
+ $reco[] = $value;
|
|
|
121
|
+ }
|
|
|
122
|
+ }
|
113
|
}
|
123
|
}
|
114
|
}
|
124
|
}
|
|
|
125
|
+
|
115
|
// 没有商品
|
126
|
// 没有商品
|
116
|
if (!isset($i)) {
|
127
|
if (!isset($i)) {
|
117
|
continue;
|
128
|
continue;
|
118
|
}
|
129
|
}
|
119
|
// 单个商品
|
130
|
// 单个商品
|
120
|
- elseif ($i === 0 && isset($good[0])) {
|
131
|
+ elseif ($i === 0 && isset($reco[0])) {
|
121
|
$build['relatedReco'] = $good[0];
|
132
|
$build['relatedReco'] = $good[0];
|
122
|
}
|
133
|
}
|
123
|
// 多个商品
|
134
|
// 多个商品
|
124
|
else {
|
135
|
else {
|
125
|
- $build['relatedReco'] = $good;
|
136
|
+ $build['relatedReco'] = $reco;
|
126
|
}
|
137
|
}
|
127
|
}
|
138
|
}
|
128
|
// 悬停浮动商品
|
139
|
// 悬停浮动商品
|
129
|
elseif (isset($value['goodsGroup']['data'])) {
|
140
|
elseif (isset($value['goodsGroup']['data'])) {
|
|
|
141
|
+ $goods =array();
|
130
|
foreach ($value['goodsGroup']['data'] as $goods) {
|
142
|
foreach ($value['goodsGroup']['data'] as $goods) {
|
131
|
$good = array();
|
143
|
$good = array();
|
132
|
$good['thumb'] = Helpers::getImageUrl($goods['cover']['cover'], 235, 314);
|
144
|
$good['thumb'] = Helpers::getImageUrl($goods['cover']['cover'], 235, 314);
|
133
|
$good['type'] = Helpers::getProductIcon($goods['cover']['maxSortId']);
|
145
|
$good['type'] = Helpers::getProductIcon($goods['cover']['maxSortId']);
|
134
|
$good['goods'] = array();
|
146
|
$good['goods'] = array();
|
135
|
$skns = array();
|
147
|
$skns = array();
|
|
|
148
|
+ $arr = array();
|
136
|
foreach ($goods['list'] as $mini) {
|
149
|
foreach ($goods['list'] as $mini) {
|
137
|
$skns[] = $mini['id'];
|
150
|
$skns[] = $mini['id'];
|
|
|
151
|
+ $arr[$mini['id']]=$mini['src'];
|
138
|
}
|
152
|
}
|
139
|
// 通过SKN获取商品信息
|
153
|
// 通过SKN获取商品信息
|
140
|
$product = ListData::productInfoBySkns($skns);
|
154
|
$product = ListData::productInfoBySkns($skns);
|
141
|
if (!empty($product['data']['product_list'])) {
|
155
|
if (!empty($product['data']['product_list'])) {
|
142
|
foreach ($product['data']['product_list'] as $i => $goods) {
|
156
|
foreach ($product['data']['product_list'] as $i => $goods) {
|
143
|
- $good['goods'][] = Helpers::formatProduct($goods, false, true, true, 235, 314, $isApp);
|
157
|
+ $g[] = Helpers::formatProduct($goods, false, true, true, 235, 314, $isApp);
|
|
|
158
|
+ }
|
|
|
159
|
+ foreach ($arr as $k=>$v) {
|
|
|
160
|
+ foreach ($g as $key=>$value) {
|
|
|
161
|
+ if ($k == $value['id']) {
|
|
|
162
|
+ $value['thumb'] = Images::getImageUrl($v,235,314);
|
|
|
163
|
+ $good['goods'][] = $value;
|
|
|
164
|
+ }
|
|
|
165
|
+ }
|
144
|
}
|
166
|
}
|
145
|
$build['collocation'][] = $good;
|
167
|
$build['collocation'][] = $good;
|
146
|
}
|
168
|
}
|