do call java detail page api
Showing
4 changed files
with
101 additions
and
639 deletions
@@ -16,8 +16,8 @@ use Plugin\Cache; | @@ -16,8 +16,8 @@ use Plugin\Cache; | ||
16 | 16 | ||
17 | class Yohobuy | 17 | class Yohobuy |
18 | { | 18 | { |
19 | - | ||
20 | /* 正式环境 */ | 19 | /* 正式环境 */ |
20 | + | ||
21 | // const API_URL = 'http://api2.open.yohobuy.com/'; | 21 | // const API_URL = 'http://api2.open.yohobuy.com/'; |
22 | // const API_URL2 = 'http://api.open.yohobuy.com/'; | 22 | // const API_URL2 = 'http://api.open.yohobuy.com/'; |
23 | // const SERVICE_URL = 'http://service.api.yohobuy.com/'; | 23 | // const SERVICE_URL = 'http://service.api.yohobuy.com/'; |
@@ -29,14 +29,14 @@ class Yohobuy | @@ -29,14 +29,14 @@ class Yohobuy | ||
29 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; | 29 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; |
30 | const API_URL_MYCENTER = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的个人中心接口URL | 30 | const API_URL_MYCENTER = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的个人中心接口URL |
31 | const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL | 31 | const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL |
32 | - const API_URL_PRODUCTDETAIL = 'http://172.16.6.145:8080/'; // 商品详情页 | ||
33 | - | 32 | + const API_URL_PRODUCTDETAIL = 'http://192.168.102.209:18080/yoho-product/'; // 商品详情页 |
34 | 33 | ||
35 | /** | 34 | /** |
36 | * 私钥列表 | 35 | * 私钥列表 |
37 | * | 36 | * |
38 | * @var array | 37 | * @var array |
39 | */ | 38 | */ |
39 | + | ||
40 | private static $privateKeyList = array( | 40 | private static $privateKeyList = array( |
41 | 'android' => 'fd4ad5fcfa0de589ef238c0e7331b585', | 41 | 'android' => 'fd4ad5fcfa0de589ef238c0e7331b585', |
42 | 'iphone' => 'a85bb0674e08986c6b115d5e3a4884fa', | 42 | 'iphone' => 'a85bb0674e08986c6b115d5e3a4884fa', |
@@ -384,4 +384,51 @@ class Yohobuy | @@ -384,4 +384,51 @@ class Yohobuy | ||
384 | \Yar_Concurrent_Client::loop($callback); | 384 | \Yar_Concurrent_Client::loop($callback); |
385 | } | 385 | } |
386 | 386 | ||
387 | + /** | ||
388 | + * 提交json格式数据请求java有关接口 | ||
389 | + * | ||
390 | + * @param string $url 接口URL | ||
391 | + * @param array $data 参数列表 | ||
392 | + * @param bool $returnJson 控制是否返回json格式数据 | ||
393 | + * @param int $timeout 超时时间 | ||
394 | + * @param array $cookie | ||
395 | + * @return mixed | ||
396 | + */ | ||
397 | + public static function jsonPost($url, $data = array(), $returnJson = false, $timeout = 3, $cookie = array()) | ||
398 | + { | ||
399 | + $ch = curl_init($url); | ||
400 | + | ||
401 | + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); | ||
402 | + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); | ||
403 | + | ||
404 | + if (!empty($cookie)) { | ||
405 | + $cookie_str = array(); | ||
406 | + foreach ($cookie as $key => $val) { | ||
407 | + $cookie_str[] = urlencode($key) . '=' . urlencode($val); | ||
408 | + } | ||
409 | + curl_setopt($ch, CURLOPT_COOKIE, implode(';', $cookie_str)); | ||
410 | + } | ||
411 | + | ||
412 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
413 | + | ||
414 | + if (!empty($data)) { | ||
415 | + $data_string = json_encode($data); | ||
416 | + | ||
417 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); | ||
418 | + // 设置json的Header | ||
419 | + curl_setopt($ch, CURLOPT_HTTPHEADER, array( | ||
420 | + 'Content-Type: application/json', | ||
421 | + 'Content-Length: ' . strlen($data_string) | ||
422 | + )); | ||
423 | + } | ||
424 | + $result = curl_exec($ch); | ||
425 | + if (!$returnJson && !empty($result)) { | ||
426 | + $result = json_decode($result, true); | ||
427 | + } | ||
428 | + curl_close($ch); | ||
429 | + $data = array(); | ||
430 | + | ||
431 | + return $result; | ||
432 | + } | ||
433 | + | ||
387 | } | 434 | } |
@@ -17,403 +17,30 @@ use Api\Yohobuy; | @@ -17,403 +17,30 @@ use Api\Yohobuy; | ||
17 | class DetailData | 17 | class DetailData |
18 | { | 18 | { |
19 | 19 | ||
20 | - const PRODUCT_BASE_INFO = 'queryProductBasicInfo'; | ||
21 | - const PRODUCT_GOODS_INFO = 'queryGoodsById'; | 20 | + const PRODUCT_BASE_INFO = 'product/queryProductDetailByProductId'; |
21 | + const PRODUCT_SIZE_INFO = 'product/queryProductIntroBySkn'; | ||
22 | 22 | ||
23 | /** | 23 | /** |
24 | * 商品基本信息 | 24 | * 商品基本信息 |
25 | * | 25 | * |
26 | - * @param int $productId | 26 | + * @param int $productId 商品ID |
27 | + * @param int $uid 用户ID | ||
27 | * @return array | 28 | * @return array |
28 | */ | 29 | */ |
29 | public static function baseInfo($productId, $uid) | 30 | public static function baseInfo($productId, $uid) |
30 | { | 31 | { |
31 | - | ||
32 | - $data = json_decode('{ | ||
33 | - "arrivalTime": 1309514897, | ||
34 | - "attribute": 1, | ||
35 | - "auditingTime": 0, | ||
36 | - "brand": { | ||
37 | - "brandAlif": "R", | ||
38 | - "brandBanner": "/2011/06/26/14/02d2214a0a7feb6112a8ebbd39de301192.jpg", | ||
39 | - "brandCertificate": "", | ||
40 | - "brandCss": "", | ||
41 | - "brandDomain": "REVELATOR", | ||
42 | - "brandGroupId": 0, | ||
43 | - "brandIco": "http://img13.static.yhbimg.com/brandLogo/2011/06/26/14/020b083d91ebd1ff9a0600a8421fdbb388.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90", | ||
44 | - "brandInitials": "", | ||
45 | - "brandKeyword": "REVELATOR", | ||
46 | - "brandLevel": 1, | ||
47 | - "brandName": "REVELATOR", | ||
48 | - "brandNameCn": "", | ||
49 | - "brandNameEn": "REVELATOR", | ||
50 | - "brandOutline": "所有围绕在我们身边并且默默在对这个世界付出的人,都是我们所认知的启示者。", | ||
51 | - "brandScale": 3, | ||
52 | - "brandSign": "", | ||
53 | - "brandStyle": "个性,潮流,嘻哈,街头,", | ||
54 | - "brandTemplate": 1, | ||
55 | - "brandTypeId": 3, | ||
56 | - "brandUrl": "", | ||
57 | - "hotKeyword": "REVELATOR", | ||
58 | - "id": 119, | ||
59 | - "isHot": "N", | ||
60 | - "isIndependent": "N", | ||
61 | - "orderBy": 0, | ||
62 | - "parentId": 0, | ||
63 | - "relateBrandIds": "", | ||
64 | - "shelvesBrandTime": 0, | ||
65 | - "staticContentCode": "", | ||
66 | - "status": 0 | ||
67 | - }, | ||
68 | - "brandId": 119, | ||
69 | - "categoryBoList": [ | ||
70 | - { | ||
71 | - "categoryId": 1, | ||
72 | - "categoryName": "上衣", | ||
73 | - "isleaf": true, | ||
74 | - "level": 1 | ||
75 | - }, | ||
76 | - { | ||
77 | - "categoryId": 11, | ||
78 | - "categoryName": "T恤", | ||
79 | - "isleaf": true, | ||
80 | - "level": 2 | ||
81 | - }, | ||
82 | - { | ||
83 | - "categoryId": 114, | ||
84 | - "categoryName": "T恤", | ||
85 | - "isleaf": true, | ||
86 | - "level": 3 | ||
87 | - } | ||
88 | - ], | ||
89 | - "cnAlphabet": "REVELATORTHERDuanXiuTXu", | ||
90 | - "createTime": 1308726112, | ||
91 | - "editTime": 0, | ||
92 | - "erpProductId": 50004331, | ||
93 | - "expectArrivalTime": 1309514897, | ||
94 | - "firstShelveTime": 1309514897, | ||
95 | - "folderId": 0, | ||
96 | - "gender": "1", | ||
97 | - "goodsList": [ | ||
98 | - { | ||
99 | - "colorId": 1, | ||
100 | - "colorImage": "http://img12.static.yhbimg.com/goodsimg/2012/03/02/14/02ea70da41df2d162fe1ec1c5d53367086.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90", | ||
101 | - "colorName": "白", | ||
102 | - "factorySn": "", | ||
103 | - "firstShelveTime": 1309514897, | ||
104 | - "goodsImagesList": [ | ||
105 | - { | ||
106 | - "angle": 0, | ||
107 | - "genderCover": 0, | ||
108 | - "goodsId": 3241, | ||
109 | - "id": 131463, | ||
110 | - "imageName": "", | ||
111 | - "imageUrl": "http://img12.static.yhbimg.com/goodsimg/2012/03/02/14/02ea70da41df2d162fe1ec1c5d53367086.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90", | ||
112 | - "intro": 0, | ||
113 | - "isDefault": "Y", | ||
114 | - "orderBy": 1, | ||
115 | - "productId": 2631, | ||
116 | - "status": 1 | ||
117 | - }, | ||
118 | - { | ||
119 | - "angle": 0, | ||
120 | - "genderCover": 0, | ||
121 | - "goodsId": 3241, | ||
122 | - "id": 131462, | ||
123 | - "imageName": "", | ||
124 | - "imageUrl": "http://img13.static.yhbimg.com/goodsimg/2012/03/02/14/02df4081143c563f1d0ea8192a316f40fd.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90", | ||
125 | - "intro": 0, | ||
126 | - "isDefault": "N", | ||
127 | - "orderBy": 0, | ||
128 | - "productId": 2631, | ||
129 | - "status": 1 | ||
130 | - } | ||
131 | - ], | ||
132 | - "goodsName": "THE R TEE", | ||
133 | - "goodsSizeBoList": [ | ||
134 | - { | ||
135 | - "createTime": 0, | ||
136 | - "goodsId": 3241, | ||
137 | - "goodsSizeSkuId": 102000, | ||
138 | - "goodsSizeStorageNum": 0, | ||
139 | - "id": 203, | ||
140 | - "orderBy": 1175, | ||
141 | - "sizeName": "M", | ||
142 | - "sortId": 0, | ||
143 | - "updateTime": 0 | ||
144 | - }, | ||
145 | - { | ||
146 | - "createTime": 0, | ||
147 | - "goodsId": 3241, | ||
148 | - "goodsSizeSkuId": 102001, | ||
149 | - "goodsSizeStorageNum": 0, | ||
150 | - "id": 201, | ||
151 | - "orderBy": 1169, | ||
152 | - "sizeName": "L", | ||
153 | - "sortId": 0, | ||
154 | - "updateTime": 0 | ||
155 | - } | ||
156 | - ], | ||
157 | - "id": 3241, | ||
158 | - "isDefault": "N", | ||
159 | - "isDown": "N", | ||
160 | - "matchExplain": "", | ||
161 | - "productId": 2631, | ||
162 | - "productSkc": 3241, | ||
163 | - "status": 1, | ||
164 | - "viewNum": 0 | ||
165 | - } | ||
166 | - ], | ||
167 | - "id": 2631, | ||
168 | - "isAdvance": "N", | ||
169 | - "isAuditing": "Y", | ||
170 | - "isDown": "N", | ||
171 | - "isEdit": 1, | ||
172 | - "isHot": "N", | ||
173 | - "isJit": "N", | ||
174 | - "isLimited": "N", | ||
175 | - "isNew": "N", | ||
176 | - "isOutlets": "N", | ||
177 | - "isPromotion": 0, | ||
178 | - "isRecommend": "N", | ||
179 | - "isReplenishment": 0, | ||
180 | - "isRetrieval": "N", | ||
181 | - "isSales": "Y", | ||
182 | - "isSpecial": "N", | ||
183 | - "isCollect": "N", | ||
184 | - "maxSortId": 1, | ||
185 | - "middleSortId": 11, | ||
186 | - "phrase": "以品牌字首R字母為设计重点,环绕式轮廓线营造渐层视觉 ", | ||
187 | - "productName": "REVELATORTHER 短袖T恤", | ||
188 | - "productPriceBo": { | ||
189 | - "formatMarketPrice": "¥255.0", | ||
190 | - "formatSalesPrice": "¥99.0", | ||
191 | - "formatSpecialPrice": "¥99.0", | ||
192 | - "marketPrice": 255, | ||
193 | - "productId": 2631, | ||
194 | - "salesPrice": 99, | ||
195 | - "specialPrice": 99, | ||
196 | - "vipPrice": "¥0.0", | ||
197 | - "vipPrices": [ | ||
198 | - { | ||
199 | - "vipLevel": 1, | ||
200 | - "vipPrice": "¥94", | ||
201 | - "vipTitle": "银卡" | ||
202 | - }, | ||
203 | - { | ||
204 | - "vipLevel": 2, | ||
205 | - "vipPrice": "¥89", | ||
206 | - "vipTitle": "金卡" | ||
207 | - }, | ||
208 | - { | ||
209 | - "vipLevel": 3, | ||
210 | - "vipPrice": "¥87", | ||
211 | - "vipTitle": "白金" | ||
212 | - } | ||
213 | - ] | ||
214 | - }, | ||
215 | - "productTagBoList": [ | ||
216 | - { | ||
217 | - "tagLabel": "is_discount", | ||
218 | - "tagValue": "Y" | ||
219 | - }, | ||
220 | - { | ||
221 | - "tagLabel": "is_soon_sold_out", | ||
222 | - "tagValue": "Y" | ||
223 | - } | ||
224 | - ], | ||
225 | - "promotionBoList": [ | ||
226 | - { | ||
227 | - "promotionTitle": "【秋冬热促】满¥2188减¥800", | ||
228 | - "promotionType": "满减" | ||
229 | - }, | ||
230 | - { | ||
231 | - "promotionTitle": "【秋冬热促】满¥1488减¥500", | ||
232 | - "promotionType": "满减" | ||
233 | - } | ||
234 | - ], | ||
235 | - "consultBoWrapper": { | ||
236 | - "consultBoList": [ | ||
237 | - { | ||
238 | - "answer": "您好,我们会联系品牌尽快补货,目前没有办法给您确切的答复,建议您进行到货通知的登记,补货到了,会第一时间短信联系您的。感谢您对yoho!有货的关注。", | ||
239 | - "answerTime": "2012-05-02 15:10:08", | ||
240 | - "ask": "请问 这件的灰色的L码还会不会补货?", | ||
241 | - "askTime": "2012-05-02 14:23:09", | ||
242 | - "id": 68252 | ||
243 | - } | ||
244 | - ], | ||
245 | - "consultTotal": 5 | ||
246 | - }, | ||
247 | - "commentBoWrapper": { | ||
248 | - "commentBoList": [ | ||
249 | - { | ||
250 | - "productId":"您好,我们会联系品牌尽快补货,目前没有办法给您确切的答复,建议您进行到货通知的登记,补货到了,会第一时间短信联系您的。感谢您对yoho!有货的关注。", | ||
251 | - "id":"2012-05-02 15:10:08", | ||
252 | - "uid":"请问 这件的灰色的L码还会不会补货?", | ||
253 | - "content":"2012-05-02 14:23:09", | ||
254 | - "createTime":"2012-05-02 14:23:09", | ||
255 | - "sizeName":"L", | ||
256 | - "colorName":"red", | ||
257 | - "nickName":"xieyong", | ||
258 | - "headIcon":"http://dddd" | ||
259 | - } | ||
260 | - ], | ||
261 | - "commentTotal": 5 | ||
262 | - }, | ||
263 | - "productUrl":"http://m.yohobuy.com/product/pro_2631_3241/REVELATORTHERDuanXiuTXu.html", | ||
264 | - "salableTime": "0", | ||
265 | - "salesPhrase": "", | ||
266 | - "seasons": "summer", | ||
267 | - "sellChannels": "0", | ||
268 | - "seriesId": 0, | ||
269 | - "shelveTime": 1325135169, | ||
270 | - "shopId": 0, | ||
271 | - "smallSortId": 114, | ||
272 | - "sortId": 0, | ||
273 | - "status": 1, | ||
274 | - "storage": 0, | ||
275 | - "style": "", | ||
276 | - "supplierId": 0, | ||
277 | - "vipDiscountType": 1 | ||
278 | -}', true); | ||
279 | - | ||
280 | - return $data; | 32 | + return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_BASE_INFO, array('param' => $productId, 'userId' => $uid) ); |
281 | } | 33 | } |
282 | 34 | ||
283 | /** | 35 | /** |
284 | * 商品尺码信息 | 36 | * 商品尺码信息 |
285 | * | 37 | * |
286 | - * @param int $productSkn | 38 | + * @param int $productSkn 商品SKN号 |
287 | * @return array | 39 | * @return array |
288 | */ | 40 | */ |
289 | public static function sizeInfo($productSkn) | 41 | public static function sizeInfo($productSkn) |
290 | { | 42 | { |
291 | - $data = json_decode('{ | ||
292 | - "modelBos": [], | ||
293 | - "null": false, | ||
294 | - "productDescBo": { | ||
295 | - "colorName": "灰色", | ||
296 | - "erpProductId": "50002468", | ||
297 | - "gender": 1, | ||
298 | - "null": false, | ||
299 | - "standardBos": [] | ||
300 | - }, | ||
301 | - "productExtra": { | ||
302 | - "null": true | ||
303 | - }, | ||
304 | - "productIntroBo": { | ||
305 | - "productId": 10, | ||
306 | - "productIntro": "<p>\r\n\t破壳小队长印花笔记本,夸张而卡通的设计,简单白皙的纸张,配有手缝带,味道十足。<br />\r\n\t<br />\r\n\t<br />\r\n\t<img src=\"http://img04.static.yohobuy.com/thumb/2011/06/23/04/02efe1bb1bc80d0ffd2911dc2f160c7974-0750x1500-1-goodsimg.jpg\" /><br />\r\n\t<br />\r\n\t<br />\r\n\t<img src=\"http://img04.static.yohobuy.com/thumb/2011/06/23/04/02b741288ddc8095598bbc7c487c8bc892-0750x1500-1-goodsimg.jpg\" /><br />\r\n\t<br />\r\n\t<br />\r\n\t<img src=\"http://img04.static.yohobuy.com/thumb/2011/06/23/04/028c47cc3002d40c42f35120007f13ff17-0750x1500-1-goodsimg.jpg\" /><br />\r\n\t<br />\r\n\t<br />\r\n\t<img src=\"http://img04.static.yohobuy.com/thumb/2011/06/23/04/026c9a61457a93c0473e4674f85344c8f0-0750x1500-1-goodsimg.jpg\" /><br />\r\n\t<br />\r\n\t<br />\r\n\t<img src=\"http://img04.static.yohobuy.com/thumb/2011/06/23/04/02da50cfde3d6cf203d8cb3df1eaa29353-0750x1500-1-goodsimg.jpg\" /><br />\r\n\t<br />\r\n\t </p>" | ||
307 | - }, | ||
308 | - "productMaterialList": [], | ||
309 | - "sizeImage": "http://static.yohobuy.com/images/1.jpg", | ||
310 | - "sizeInfoBo": { | ||
311 | - "sizeAttributeBos": [ | ||
312 | - { | ||
313 | - "attributeName": "后衣长", | ||
314 | - "id": 49 | ||
315 | - }, | ||
316 | - { | ||
317 | - "attributeName": "前衣长", | ||
318 | - "id": 48 | ||
319 | - }, | ||
320 | - { | ||
321 | - "attributeName": "袖长", | ||
322 | - "id": 5 | ||
323 | - }, | ||
324 | - { | ||
325 | - "attributeName": "胸围", | ||
326 | - "id": 4 | ||
327 | - }, | ||
328 | - { | ||
329 | - "attributeName": "肩宽", | ||
330 | - "id": 3 | ||
331 | - }, | ||
332 | - { | ||
333 | - "attributeName": "后中长", | ||
334 | - "id": 1 | ||
335 | - } | ||
336 | - ], | ||
337 | - "sizeBoList": [ | ||
338 | - { | ||
339 | - "id": 201, | ||
340 | - "sizeName": "L", | ||
341 | - "sortAttributes": [ | ||
342 | - { | ||
343 | - "id": 49, | ||
344 | - "sizeValue": "" | ||
345 | - }, | ||
346 | - { | ||
347 | - "id": 48, | ||
348 | - "sizeValue": "" | ||
349 | - }, | ||
350 | - { | ||
351 | - "id": 5, | ||
352 | - "sizeValue": "64" | ||
353 | - }, | ||
354 | - { | ||
355 | - "id": 4, | ||
356 | - "sizeValue": "108" | ||
357 | - }, | ||
358 | - { | ||
359 | - "id": 3, | ||
360 | - "sizeValue": "49" | ||
361 | - }, | ||
362 | - { | ||
363 | - "id": 1, | ||
364 | - "sizeValue": "67" | ||
365 | - } | ||
366 | - ] | ||
367 | - }, | ||
368 | - { | ||
369 | - "id": 203, | ||
370 | - "sizeName": "M", | ||
371 | - "sortAttributes": [ | ||
372 | - { | ||
373 | - "id": 5, | ||
374 | - "sizeValue": "62" | ||
375 | - }, | ||
376 | - { | ||
377 | - "id": 4, | ||
378 | - "sizeValue": "102" | ||
379 | - }, | ||
380 | - { | ||
381 | - "id": 3, | ||
382 | - "sizeValue": "46" | ||
383 | - }, | ||
384 | - { | ||
385 | - "id": 1, | ||
386 | - "sizeValue": "64" | ||
387 | - }, | ||
388 | - { | ||
389 | - "id": 49, | ||
390 | - "sizeValue": "" | ||
391 | - }, | ||
392 | - { | ||
393 | - "id": 48, | ||
394 | - "sizeValue": "" | ||
395 | - } | ||
396 | - ] | ||
397 | - } | ||
398 | - ] | ||
399 | - }, | ||
400 | - "washTipsBoList": [ | ||
401 | - { | ||
402 | - "caption": "不可转笼翻转干燥", | ||
403 | - "img": "http://static.yohobuy.com/images/wash_2.png" | ||
404 | - }, | ||
405 | - { | ||
406 | - "caption": "30度水温弱速洗", | ||
407 | - "img": "http://static.yohobuy.com/images/wash_3.png" | ||
408 | - }, | ||
409 | - { | ||
410 | - "caption": "分色洗涤", | ||
411 | - "img": "http://static.yohobuy.com/images/wash_7.png" | ||
412 | - } | ||
413 | - ] | ||
414 | -}', true); | ||
415 | - | ||
416 | - return $data; | 43 | + return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_SIZE_INFO, array('param' => $productSkn) ); |
417 | } | 44 | } |
418 | 45 | ||
419 | } | 46 | } |
@@ -36,6 +36,8 @@ class DetailModel | @@ -36,6 +36,8 @@ class DetailModel | ||
36 | // 商品名称 | 36 | // 商品名称 |
37 | if (isset($baseInfo['productName'])) { | 37 | if (isset($baseInfo['productName'])) { |
38 | $result['goodsName'] = $baseInfo['productName']; | 38 | $result['goodsName'] = $baseInfo['productName']; |
39 | + } else { | ||
40 | + return $result; | ||
39 | } | 41 | } |
40 | 42 | ||
41 | // 商品价格 | 43 | // 商品价格 |
@@ -163,6 +165,12 @@ class DetailModel | @@ -163,6 +165,12 @@ class DetailModel | ||
163 | if (isset($baseInfo['erpProductId'])) { | 165 | if (isset($baseInfo['erpProductId'])) { |
164 | $result['skn'] = $baseInfo['erpProductId']; | 166 | $result['skn'] = $baseInfo['erpProductId']; |
165 | } | 167 | } |
168 | + | ||
169 | + // 底部悬浮的购物车信息 | ||
170 | + $result['cartInfo'] = array( | ||
171 | + 'numInCart' => 0, | ||
172 | + 'goodsInstore' => $baseInfo['storage'], | ||
173 | + ); | ||
166 | } | 174 | } |
167 | 175 | ||
168 | return $result; | 176 | return $result; |
@@ -201,7 +209,7 @@ class DetailModel | @@ -201,7 +209,7 @@ class DetailModel | ||
201 | if (isset($sizeInfo['productIntroBo']['productIntro'])) { | 209 | if (isset($sizeInfo['productIntroBo']['productIntro'])) { |
202 | $productIntro = strstr($sizeInfo['productIntroBo']['productIntro'], '<br />', true); | 210 | $productIntro = strstr($sizeInfo['productIntroBo']['productIntro'], '<br />', true); |
203 | if ($productIntro) { | 211 | if ($productIntro) { |
204 | - $result['goodsDescription']['desc'] = strtr($productIntro, array('<p>\r\n\t' => '')); | 212 | + $result['goodsDescription']['desc'] = strtr($productIntro, array('<p>' => '', '\r\n\t' => '')); |
205 | } | 213 | } |
206 | } | 214 | } |
207 | 215 | ||
@@ -267,43 +275,46 @@ class DetailModel | @@ -267,43 +275,46 @@ class DetailModel | ||
267 | 275 | ||
268 | // 商品材质 | 276 | // 商品材质 |
269 | if (!empty($sizeInfo['productMaterialList'])) { | 277 | if (!empty($sizeInfo['productMaterialList'])) { |
278 | + $result['materials'] = array( | ||
279 | + 'title' => '商品材质', | ||
280 | + 'enTitle' => 'MATERIALS', | ||
281 | + 'list' => array(), | ||
282 | + ); | ||
270 | foreach ($sizeInfo['productMaterialList'] as $value) { | 283 | foreach ($sizeInfo['productMaterialList'] as $value) { |
271 | - | 284 | + $result['materials']['list'][] = array( |
285 | + 'img' => $value['imageUrl'], | ||
286 | + 'desc' => $value['remark'], | ||
287 | + ); | ||
272 | } | 288 | } |
273 | } | 289 | } |
274 | 290 | ||
291 | + // 洗涤提示 | ||
292 | + if (!empty($sizeInfo['washTipsBoList'])) { | ||
293 | + $result['washTips']['list'] = array(); | ||
294 | + foreach ($sizeInfo['washTipsBoList'] as $value) { | ||
295 | + $result['washTips']['list'][] = $value; | ||
296 | + } | ||
275 | } | 297 | } |
276 | 298 | ||
277 | - return $result; | ||
278 | - | ||
279 | - 'materials' : { | ||
280 | - 'title' : '商品材质', | ||
281 | - 'enTitle' : '', | ||
282 | - 'list'' | ||
283 | - 'img' : '', | ||
284 | - 'desc' : '用各种洗涤剂',//remark | ||
285 | - 'materialType' : '' | ||
286 | - }, | ||
287 | - 'washTips' : { | ||
288 | - 'list' : [ | ||
289 | - { | ||
290 | - "caption":"不可干洗", | ||
291 | - "img":"http://static.yohobuy.com/images/wash_5.png" | 299 | + // 详情配图 |
300 | + if (isset($sizeInfo['productIntroBo']['productIntro'])) { | ||
301 | + $productIntro = strstr($sizeInfo['productIntroBo']['productIntro'], '<br />'); | ||
302 | + if ($productIntro) { | ||
303 | + $result['productDetail'] = array( | ||
304 | + 'title' => '商品详情', | ||
305 | + 'enTitle' => 'DETAILS', | ||
306 | + 'desc' => strtr($productIntro, array( | ||
307 | + '\r\n\t' => '', | ||
308 | + '</p>' => '', | ||
309 | + '<img src=' => '<img class=\"lazy\" src=\"data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==\" data-original=', | ||
310 | + )), | ||
311 | + ); | ||
292 | } | 312 | } |
293 | - ] | ||
294 | } | 313 | } |
295 | 314 | ||
296 | - 'productDetail' : { | ||
297 | - 'title' : '商品详情', | ||
298 | - 'enTitle' : '', | ||
299 | - 'desc' : 'Married to the MOB是由Leah McSweeney创立的女装品牌,一向标榜不羁、大胆的女性streetwear设计', | ||
300 | - 'img' : '' | ||
301 | - }, | ||
302 | - | ||
303 | - 'cartInfo' : { | ||
304 | - 'numInCart' : 3, | ||
305 | - 'goodsInstore' : 0 | ||
306 | } | 315 | } |
316 | + | ||
317 | + return $result; | ||
307 | } | 318 | } |
308 | 319 | ||
309 | } | 320 | } |
@@ -16,17 +16,20 @@ class DetailController extends AbstractAction | @@ -16,17 +16,20 @@ class DetailController extends AbstractAction | ||
16 | */ | 16 | */ |
17 | public function indexAction() | 17 | public function indexAction() |
18 | { | 18 | { |
19 | - $productId = $this->param('productId', 123); | 19 | + $productId = $this->param('productId', 22399); |
20 | if (!is_numeric($productId)) { | 20 | if (!is_numeric($productId)) { |
21 | $this->error(); | 21 | $this->error(); |
22 | } | 22 | } |
23 | - $goodsId = $this->param('goodsId', 3241); | 23 | + $goodsId = $this->param('goodsId', 382089); |
24 | if (!is_numeric($goodsId)) { | 24 | if (!is_numeric($goodsId)) { |
25 | $this->error(); | 25 | $this->error(); |
26 | } | 26 | } |
27 | $uid = $this->getUid(); | 27 | $uid = $this->getUid(); |
28 | 28 | ||
29 | $data = \Product\DetailModel::getBaseInfo($productId, $goodsId, $uid); | 29 | $data = \Product\DetailModel::getBaseInfo($productId, $goodsId, $uid); |
30 | + if (array() === $data) { | ||
31 | + $this->error(); | ||
32 | + } | ||
30 | $data['goodsDetailPage'] = true; | 33 | $data['goodsDetailPage'] = true; |
31 | 34 | ||
32 | if (isset($data['goodsName'])) { | 35 | if (isset($data['goodsName'])) { |
@@ -34,232 +37,6 @@ class DetailController extends AbstractAction | @@ -34,232 +37,6 @@ class DetailController extends AbstractAction | ||
34 | } | 37 | } |
35 | $this->setNavHeader('商品详情'); | 38 | $this->setNavHeader('商品详情'); |
36 | 39 | ||
37 | -// $data = array ( | ||
38 | -// 'goodsDetailPage' => true, | ||
39 | -// 'pageHeader' => array ( | ||
40 | -// 'navBack' => 'sss ', | ||
41 | -// 'navHome' => 'sss ', | ||
42 | -// 'navTitle' => '商品详情TEST' | ||
43 | -// ), | ||
44 | -// | ||
45 | -// 'bannerTop' => array ( | ||
46 | -// 'list' => array ( | ||
47 | -// array ( | ||
48 | -// 'url' => '', | ||
49 | -// 'img' => 'http://img13.static.yhbimg.com/goodsimg/2015/10/18/03/0250c3935f86dbd2baa7d45603d19fd637.jpg?imageMogr2/thumbnail/450x600/extent/450x600/background/d2hpdGU=/position/center/quality/90' | ||
50 | -// ), | ||
51 | -// array ( | ||
52 | -// 'url' => '', | ||
53 | -// 'img' => 'http://img11.static.yhbimg.com/goodsimg/2015/10/12/03/01bf4cf4444035a1930d33a9d0f8bff4fa.jpg?imageMogr2/thumbnail/450x600/extent/450x600/background/d2hpdGU=/position/center/quality/90' | ||
54 | -// ), | ||
55 | -// array ( | ||
56 | -// 'url' => '', | ||
57 | -// 'img' => 'http://img11.static.yhbimg.com/goodsimg/2015/10/12/03/01d7ef2f624eeea15e80bb374607aea317.jpg?imageMogr2/thumbnail/450x600/extent/450x600/background/d2hpdGU=/position/center/quality/90' | ||
58 | -// ) | ||
59 | -// ) | ||
60 | -// ), | ||
61 | -// 'goodsName' => 'Stussy No. 4 BOX TEE DC SPAR HIGH WC | ||
62 | -//SHOE BQT KEN BLOCK', | ||
63 | -// 'goodsSubtitle'=>'【全民拼抢购】经典印花T恤,满4件免一件!全场低至 | ||
64 | -//9.9元,拼购时代High起来。', | ||
65 | -// | ||
66 | -// 'goodsPrice' =>array( | ||
67 | -// 'currentPrice'=>'¥298.00', | ||
68 | -// 'previousPrice'=>'¥598.00' | ||
69 | -// ), | ||
70 | -// 'periodOfMarket'=>'11月', | ||
71 | -// 'goodsTitle' => '¥298.00', | ||
72 | -// 'vipLevel' => array ( | ||
73 | -// 'list' => array ( | ||
74 | -// array ( | ||
75 | -// 'img'=>'http://static.dev.yohobuy.com/img/product/silver.png', | ||
76 | -// 'text' => '¥284.00' | ||
77 | -// ), | ||
78 | -// array ( | ||
79 | -// 'img'=>'http://static.dev.yohobuy.com/img/product/golden.png', | ||
80 | -// 'text' => '¥269.00' | ||
81 | -// ), | ||
82 | -// array ( | ||
83 | -// 'img'=>'http://static.dev.yohobuy.com/img/product/platinum.png', | ||
84 | -// 'text' => '¥263.00' | ||
85 | -// ) | ||
86 | -// ) | ||
87 | -// ), | ||
88 | -// 'goodsDiscount'=>array( | ||
89 | -// 'list'=>array( | ||
90 | -// '【summer final sale】满¥499立享6.8折', | ||
91 | -// '【BACK TO SCHOOL】满¥499赠送Paul | ||
92 | -// Franke帽子一个,多买多送!', | ||
93 | -// '【BACK TO SCHOOL】满¥499赠送Paul | ||
94 | -// Franke帽子一个,多买多送!' | ||
95 | -// ) | ||
96 | -// ), | ||
97 | -// 'feedbacks'=>array( | ||
98 | -// 'commentsNum'=>0, | ||
99 | -// 'consultsNum'=>1, | ||
100 | -// // 'commentName'=>'商品评价', | ||
101 | -// // 'consultName' =>'购买咨询', | ||
102 | -// 'link'=>'', | ||
103 | -// 'comments'=>array( | ||
104 | -// array( | ||
105 | -// 'userName'=>'Lynnic', | ||
106 | -// 'desc'=>'购买了白色Mate7', | ||
107 | -// 'content'=>'活动时买的,挺超值。上身效果也不错。质量 | ||
108 | -//很好,买送人的,很满意。而且物流相当给...', | ||
109 | -// 'time'=>'2014-08-12 10:24:26' | ||
110 | -// ) | ||
111 | -// ), | ||
112 | -// 'consults'=>array( | ||
113 | -// array( | ||
114 | -// 'question' =>'您好 我一米七七 140斤 穿M的行吗', | ||
115 | -// 'time'=>'2014-08-12 10:24:26', | ||
116 | -// 'answer'=>'您好,建议您参考XL的款式,由于版型和个人穿衣风格不同,需要' | ||
117 | -// ) | ||
118 | -// ) | ||
119 | -// ), | ||
120 | -// | ||
121 | -// 'enterStore'=>array( | ||
122 | -// 'img'=>'http://static.dev.yohobuy.com/img/product/store.png', | ||
123 | -// 'storeName'=>'Stussy', | ||
124 | -// 'url'=>'http://stussy.m.yohobuy.com/' | ||
125 | -// ), | ||
126 | -// | ||
127 | -// 'goodsDescription'=>array( | ||
128 | -// 'title' =>'商品描述', | ||
129 | -// 'enTitle'=>'DESCRIPTON', | ||
130 | -// | ||
131 | -// 'detail'=>array( | ||
132 | -// 'nubmer' =>'51018059', | ||
133 | -// 'color' =>'黑', | ||
134 | -// 'type' =>'帽子', | ||
135 | -// 'gender' =>'女款', | ||
136 | -// 'hatType' =>'棒球帽', | ||
137 | -// 'bongrace' =>'平檐款式', | ||
138 | -// 'goodsDetail'=>'字母图案', | ||
139 | -// 'style'=>'街头' | ||
140 | -// ) | ||
141 | -// ), | ||
142 | -// | ||
143 | -// 'sizeInfo'=>array( | ||
144 | -// 'title' => '尺码信息', | ||
145 | -// 'enTitle' =>'xSIZE INFO', | ||
146 | -// | ||
147 | -// 'detail' =>array( | ||
148 | -// 'list'=>array( | ||
149 | -// array( | ||
150 | -// 'name'=>'尺寸', | ||
151 | -// 'sizem'=>'m', | ||
152 | -// 'sizexl' =>'XL' | ||
153 | -// ), | ||
154 | -// array( | ||
155 | -// 'name'=>'肩宽', | ||
156 | -// 'sizem'=>'43', | ||
157 | -// 'sizexl' =>'46' | ||
158 | -// ), | ||
159 | -// array( | ||
160 | -// 'name'=>'衣长', | ||
161 | -// 'sizem'=>'102', | ||
162 | -// 'sizexl' =>'106' | ||
163 | -// ), | ||
164 | -// array( | ||
165 | -// 'name'=>'肩宽', | ||
166 | -// 'sizem'=>'90', | ||
167 | -// 'sizexl' =>'96' | ||
168 | -// ), | ||
169 | -// array( | ||
170 | -// 'name'=>'胸围', | ||
171 | -// 'sizem'=>'90', | ||
172 | -// 'sizexl' =>'96' | ||
173 | -// ), | ||
174 | -// array( | ||
175 | -// 'name'=>'xx', | ||
176 | -// 'sizem'=>'xx', | ||
177 | -// 'sizexl' =>'xx' | ||
178 | -// ) | ||
179 | -// ) | ||
180 | -// ) | ||
181 | -// ), | ||
182 | -// | ||
183 | -// 'measurementMethod'=>array( | ||
184 | -// 'title' => '测量方式', | ||
185 | -// 'enTitle' =>'MEASUREMENT METHOD', | ||
186 | -// | ||
187 | -// 'detail'=>array( | ||
188 | -// 'sort' =>'上衣' , | ||
189 | -// 'enSort'=>'TOPS', | ||
190 | -// 'img' =>'http://static.dev.yohobuy.com/img/product/tops.png', | ||
191 | -// 'items'=>array( | ||
192 | -// '肩宽(两端肩线间的直线长度)', | ||
193 | -// '胸围(两端肩线间的直线长度)', | ||
194 | -// '肩宽(两端肩线间的直线长度)', | ||
195 | -// '肩宽(两端肩线间的直线长度)', | ||
196 | -// '肩宽(两端肩线间的直线长度)', | ||
197 | -// '肩宽(两端肩线间的直线长度)' | ||
198 | -// ) | ||
199 | -// ) | ||
200 | -// ), | ||
201 | -// | ||
202 | -// 'reference' => array( | ||
203 | -// 'title' => '模特试穿', | ||
204 | -// 'enTitle' =>'REFERENCE', | ||
205 | -// | ||
206 | -// 'detail' =>array( | ||
207 | -// 'list'=>array( | ||
208 | -// array( | ||
209 | -// 'fieldName'=>'1 ', | ||
210 | -// 'firstModel'=>'http://static.dev.yohobuy.com/img/product/avatar1.png', | ||
211 | -// 'secondModel' =>'http://static.dev.yohobuy.com/img/product/avatar2.png' | ||
212 | -// ), | ||
213 | -// array( | ||
214 | -// 'fieldName'=>'模特', | ||
215 | -// 'firstModel'=>'Oliver', | ||
216 | -// 'secondModel' =>'Jvly' | ||
217 | -// ), | ||
218 | -// array( | ||
219 | -// 'fieldName'=>'身高', | ||
220 | -// 'firstModel'=>'175', | ||
221 | -// 'secondModel' =>'170' | ||
222 | -// ), | ||
223 | -// array( | ||
224 | -// 'fieldName'=>'体重', | ||
225 | -// 'firstModel'=>'53', | ||
226 | -// 'secondModel' =>'59' | ||
227 | -// ), | ||
228 | -// array( | ||
229 | -// 'fieldName'=>'三围', | ||
230 | -// 'firstModel'=>'78/70/87', | ||
231 | -// 'secondModel' =>'78/70/87' | ||
232 | -// ), | ||
233 | -// array( | ||
234 | -// 'fieldName'=>'吊牌尺', | ||
235 | -// 'firstModel'=>'S', | ||
236 | -// 'secondModel' =>'L' | ||
237 | -// ) | ||
238 | -// ) | ||
239 | -// ) | ||
240 | -// ), | ||
241 | -// | ||
242 | -// 'materials' => array( | ||
243 | -// 'title' => '商品材质', | ||
244 | -// 'enTitle' =>'MATERIALS', | ||
245 | -// 'img' => 'http://static.dev.yohobuy.com/img/product/material.png', | ||
246 | -// 'desc' =>'用各种洗涤剂,可手洗机洗,但不宜氯漂,宜阴干,避免曝晒,以免深色衣物褪色,在日光下晾晒时,将里面朝外。浸泡时间不能太长,避免褪色,深色与浅色衣服最好请分开洗涤,避免染色。', | ||
247 | -// 'materialType'=>'http://static.dev.yohobuy.com/img/product/material-type.png' | ||
248 | -// ), | ||
249 | -// | ||
250 | -// 'productDetail' =>array( | ||
251 | -// 'title' => '商品详情', | ||
252 | -// 'enTitle' =>'DETAILS', | ||
253 | -// 'desc' => 'Married to the MOB是由Leah McSweeney创立的女装品牌,一向标榜不羁、大胆的女性streetwear设计。喜欢恶搞的女生们,赶紧入手吧。', | ||
254 | -// 'img' =>'http://static.dev.yohobuy.com/img/product/product.png' | ||
255 | -// ), | ||
256 | -// | ||
257 | -// 'cartInfo' =>array( | ||
258 | -// 'numInCart' => 3, | ||
259 | -// 'goodsInstore'=>0 | ||
260 | -// ) | ||
261 | -// | ||
262 | -// ); | ||
263 | // 渲染模板 | 40 | // 渲染模板 |
264 | $this->_view->display('index', $data); | 41 | $this->_view->display('index', $data); |
265 | } | 42 | } |
-
Please register or login to post a comment