Authored by Lynnic

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop

@@ -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 }
@@ -45,4 +45,6 @@ class CacheConfig @@ -45,4 +45,6 @@ class CacheConfig
45 const KEY_ACTION_GUANG_DETAIL_DATA = 'key_action_guang_detail_data'; // 逛内容详情 45 const KEY_ACTION_GUANG_DETAIL_DATA = 'key_action_guang_detail_data'; // 逛内容详情
46 const KEY_ACTION_GUANG_RSS_DATA = 'key_action_guang_detail_data'; // 逛订阅内容 46 const KEY_ACTION_GUANG_RSS_DATA = 'key_action_guang_detail_data'; // 逛订阅内容
47 47
  48 + const KEY_ACTION_ADDRESS_LIST_DATA = 'key_action_address_list_data'; // 地址树数据
  49 +
48 } 50 }
@@ -171,12 +171,11 @@ class UserData @@ -171,12 +171,11 @@ class UserData
171 * 优惠券数据 171 * 优惠券数据
172 * 172 *
173 * @param int $uid 用户ID 173 * @param int $uid 用户ID
174 - * @param int $status 优惠券状态,0表示未使用,1表示已使用  
175 * @param int $page 第几页,默认1 174 * @param int $page 第几页,默认1
176 * @param int $limit 限制读取的数目,默认10 175 * @param int $limit 限制读取的数目,默认10
177 * @return array 优惠券接口返回的数据 176 * @return array 优惠券接口返回的数据
178 */ 177 */
179 - public static function couponData($uid, $status, $page = 1, $limit = 10) 178 + public static function couponData($uid, $page = 1, $limit = 10)
180 { 179 {
181 $urlList = array(); 180 $urlList = array();
182 181
@@ -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' => intval($productId), 'userId' => intval($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&nbsp;</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' => intval($productSkn) ) );
417 } 44 }
418 45
419 } 46 }
@@ -87,8 +87,6 @@ @@ -87,8 +87,6 @@
87 87
88 <div class="gap-block"></div> 88 <div class="gap-block"></div>
89 89
90 - {{> product/product_description}}  
91 -  
92 {{#cartInfo}} 90 {{#cartInfo}}
93 <div class="cart-bar"> 91 <div class="cart-bar">
94 <span class="num-tag">{{numInCart}}</span> 92 <span class="num-tag">{{numInCart}}</span>
@@ -20,20 +20,20 @@ class HomeController extends AbstractAction @@ -20,20 +20,20 @@ class HomeController extends AbstractAction
20 20
21 protected $_uid; 21 protected $_uid;
22 22
23 -// /**  
24 -// * 初始化  
25 -// */  
26 -// public function init()  
27 -// {  
28 -// // 检查用户是否登录, 未登录则跳转到登录页  
29 -// $uid = $this->getUid(true);  
30 -// $action = $this->getRequest()->getActionName();  
31 -// if (!$uid && $action !== 'index') {  
32 -// $this->go(Helpers::url('/signin.html'));  
33 -// }  
34 -//  
35 -// parent::init();  
36 -// } 23 + /**
  24 + * 初始化
  25 + */
  26 + public function init()
  27 + {
  28 + // 检查用户是否登录, 未登录则跳转到登录页
  29 + $uid = 8826435; //$this->getUid(true);
  30 + $action = $this->getRequest()->getActionName();
  31 + if (!$uid && $action !== 'index') {
  32 + $this->go(Helpers::url('/signin.html'));
  33 + }
  34 +
  35 + parent::init();
  36 + }
37 37
38 /** 38 /**
39 * 个人中心入口 39 * 个人中心入口
@@ -44,21 +44,20 @@ class HomeController extends AbstractAction @@ -44,21 +44,20 @@ class HomeController extends AbstractAction
44 $this->setTitle('个人中心'); 44 $this->setTitle('个人中心');
45 $this->setNavHeader('个人中心'); 45 $this->setNavHeader('个人中心');
46 46
47 - $data = array(  
48 - 'myIndexPage' => true,  
49 - 'pageFooter' => true  
50 - ); 47 + $data = array(
  48 + 'myIndexPage' => true,
  49 + 'pageFooter' => true
  50 + );
51 $uid = $this->getUid(); 51 $uid = $this->getUid();
52 - if ($uid) {  
53 - $data['isLogin'] = true;  
54 - $uid = 8826435;  
55 - $data += \Index\UserModel::getUserProfileData($uid);  
56 - $data += \Index\UserModel::getInfoNumData($uid);  
57 -  
58 - // 优选新品数据  
59 - $channel = Helpers::getChannelByCookie();  
60 - $data['recommendForYou'] = \Index\UserModel::getPreferenceData($channel);  
61 - } 52 + if ($uid) {
  53 + $data['isLogin'] = true;
  54 + $data += \Index\UserModel::getUserProfileData($uid);
  55 + $data += \Index\UserModel::getInfoNumData($uid);
  56 +
  57 + // 优选新品数据
  58 + $channel = Helpers::getChannelByCookie();
  59 + $data['recommendForYou'] = \Index\UserModel::getPreferenceData($channel);
  60 + }
62 61
63 $this->_view->display('index', $data); 62 $this->_view->display('index', $data);
64 } 63 }
@@ -74,23 +73,22 @@ class HomeController extends AbstractAction @@ -74,23 +73,22 @@ class HomeController extends AbstractAction
74 73
75 $tab = $this->get('tab', ''); 74 $tab = $this->get('tab', '');
76 $uid = $this->getUid(); 75 $uid = $this->getUid();
77 - $uid = 8826435;  
78 $gender = Helpers::getGenderByCookie(); 76 $gender = Helpers::getGenderByCookie();
79 77
80 $favProducts = \Index\UserModel::getFavProductData($uid); 78 $favProducts = \Index\UserModel::getFavProductData($uid);
81 $favBrands = \Index\UserModel::getFavBrandData($uid, $gender); 79 $favBrands = \Index\UserModel::getFavBrandData($uid, $gender);
82 80
83 - $data = array(  
84 - 'favPage' => true, //加载js  
85 - 'pageFooter' => true,  
86 - 'favorite' => true,  
87 - 'hasFavProduct' => $favProducts,  
88 - 'hasFavBrand' => $favBrands  
89 - );  
90 - // 判断是否为品牌收藏页  
91 - if ($tab === 'brand') {  
92 - $data['brandTab'] = true;  
93 - } 81 + $data = array(
  82 + 'favPage' => true, //加载js
  83 + 'pageFooter' => true,
  84 + 'favorite' => true,
  85 + 'hasFavProduct' => $favProducts,
  86 + 'hasFavBrand' => $favBrands
  87 + );
  88 + // 判断是否为品牌收藏页
  89 + if ($tab === 'brand') {
  90 + $data['brandTab'] = true;
  91 + }
94 92
95 $this->_view->display('favorite', $data); 93 $this->_view->display('favorite', $data);
96 } 94 }
@@ -102,20 +100,16 @@ class HomeController extends AbstractAction @@ -102,20 +100,16 @@ class HomeController extends AbstractAction
102 { 100 {
103 $result = array(); 101 $result = array();
104 102
105 - if ($this->isAjax())  
106 - { 103 + if ($this->isAjax()) {
107 $uid = $this->getUid(); 104 $uid = $this->getUid();
108 $fav_id = $this->post('fav_id', 0); 105 $fav_id = $this->post('fav_id', 0);
109 106
110 $result = \Index\UserModel::favoriteDelete($uid, $fav_id); 107 $result = \Index\UserModel::favoriteDelete($uid, $fav_id);
111 } 108 }
112 109
113 - if (empty($result))  
114 - { 110 + if (empty($result)) {
115 echo ' '; 111 echo ' ';
116 - }  
117 - else  
118 - { 112 + } else {
119 $this->echoJson($result); 113 $this->echoJson($result);
120 } 114 }
121 } 115 }
@@ -128,8 +122,7 @@ class HomeController extends AbstractAction @@ -128,8 +122,7 @@ class HomeController extends AbstractAction
128 $this->setTitle('个人信息'); 122 $this->setTitle('个人信息');
129 $this->setNavHeader('个人信息', true, SITE_MAIN); 123 $this->setNavHeader('个人信息', true, SITE_MAIN);
130 124
131 - // $uid = $this->getUid();  
132 - $uid = 967016; 125 + $uid = $this->getUid();
133 $data = \Index\UserModel::getUserProfileData($uid); 126 $data = \Index\UserModel::getUserProfileData($uid);
134 $data['personalDetailsPage'] = true; 127 $data['personalDetailsPage'] = true;
135 $data['pageFooter'] = true; 128 $data['pageFooter'] = true;
@@ -144,8 +137,7 @@ class HomeController extends AbstractAction @@ -144,8 +137,7 @@ class HomeController extends AbstractAction
144 $this->setTitle('YOHO币'); 137 $this->setTitle('YOHO币');
145 $this->setNavHeader('YOHO币', true, false); 138 $this->setNavHeader('YOHO币', true, false);
146 139
147 - // $uid = $this->getUid();  
148 - $uid = 8826435; 140 + $uid = $this->getUid();
149 $currency = \Index\UserModel::getYohoCoinData($uid); 141 $currency = \Index\UserModel::getYohoCoinData($uid);
150 142
151 $currency['pageFooter'] = true; 143 $currency['pageFooter'] = true;
@@ -157,14 +149,12 @@ class HomeController extends AbstractAction @@ -157,14 +149,12 @@ class HomeController extends AbstractAction
157 */ 149 */
158 public function couponsAction() 150 public function couponsAction()
159 { 151 {
160 -  
161 $this->setTitle('优惠券'); 152 $this->setTitle('优惠券');
162 - $this->setNavHeader('优惠券', true, SITE_MAIN);  
163 - // $uid = $this->getUid();  
164 - $uid = 8826435;  
165 - $status = $this->get('status', 0); 153 + $this->setNavHeader('优惠券');
  154 +
  155 + $uid = $this->getUid();
166 $coupons = array( 156 $coupons = array(
167 - 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status), 157 + 'couponsUrl' => \Index\UserModel::getCouponData($uid),
168 'couponsPage' => true 158 'couponsPage' => true
169 ); 159 );
170 $this->_view->display('coupons', $coupons); 160 $this->_view->display('coupons', $coupons);
@@ -175,11 +165,10 @@ class HomeController extends AbstractAction @@ -175,11 +165,10 @@ class HomeController extends AbstractAction
175 */ 165 */
176 public function messageAction() 166 public function messageAction()
177 { 167 {
178 - // $uid = $this->getUid(); 168 + $uid = $this->getUid();
179 $page = $this->get('page', 0); 169 $page = $this->get('page', 0);
180 $size = $this->get('size', 10); 170 $size = $this->get('size', 10);
181 171
182 - $uid = 8826435;  
183 $messages = \Index\UserModel::getMessageData($uid, $page, $size); 172 $messages = \Index\UserModel::getMessageData($uid, $page, $size);
184 173
185 print_r($messages); 174 print_r($messages);
@@ -192,16 +181,12 @@ class HomeController extends AbstractAction @@ -192,16 +181,12 @@ class HomeController extends AbstractAction
192 { 181 {
193 // 设置网站标题 182 // 设置网站标题
194 $this->setTitle('地址管理'); 183 $this->setTitle('地址管理');
195 - $this->setNavHeader('地址管理', true, SITE_MAIN);  
196 -  
197 - // $uid = $this->getUid();  
198 - $uid = 8826435; 184 + $this->setNavHeader('地址管理');
199 185
  186 + $uid = $this->getUid();
200 $address = \Index\UserModel::getAddressData($uid); 187 $address = \Index\UserModel::getAddressData($uid);
201 $addressList = \Index\UserModel::getAddressListData($uid); 188 $addressList = \Index\UserModel::getAddressListData($uid);
202 189
203 - // print_r($addressList);  
204 -  
205 $this->_view->display('address', array( 190 $this->_view->display('address', array(
206 'addressPage' => true, 191 'addressPage' => true,
207 'pageFooter' => true, 192 'pageFooter' => true,
@@ -217,10 +202,8 @@ class HomeController extends AbstractAction @@ -217,10 +202,8 @@ class HomeController extends AbstractAction
217 { 202 {
218 $result = array(); 203 $result = array();
219 204
220 - if ($this->isAjax())  
221 - {  
222 - // $uid = $this->getUid();  
223 - $uid = 8826435; 205 + if ($this->isAjax()) {
  206 + $uid = $this->getUid();
224 $address = $this->post('address', ''); 207 $address = $this->post('address', '');
225 $area_code = $this->post('area_code', ''); 208 $area_code = $this->post('area_code', '');
226 $consignee = $this->post('consignee', ''); 209 $consignee = $this->post('consignee', '');
@@ -232,12 +215,9 @@ class HomeController extends AbstractAction @@ -232,12 +215,9 @@ class HomeController extends AbstractAction
232 $result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code); 215 $result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
233 } 216 }
234 217
235 - if (empty($result))  
236 - { 218 + if (empty($result)) {
237 echo ' '; 219 echo ' ';
238 - }  
239 - else  
240 - { 220 + } else {
241 $this->echoJson($result); 221 $this->echoJson($result);
242 } 222 }
243 } 223 }
@@ -249,21 +229,15 @@ class HomeController extends AbstractAction @@ -249,21 +229,15 @@ class HomeController extends AbstractAction
249 { 229 {
250 $result = array(); 230 $result = array();
251 231
252 - if ($this->isAjax())  
253 - {  
254 - // $uid = $this->getUid();  
255 - $uid = 8826435; 232 + if ($this->isAjax()) {
  233 + $uid = $this->getUid();
256 $id = $this->post('id', ''); 234 $id = $this->post('id', '');
257 -  
258 $result = \Index\UserModel::setDefaultAddress($uid, $id); 235 $result = \Index\UserModel::setDefaultAddress($uid, $id);
259 } 236 }
260 237
261 - if (empty($result))  
262 - { 238 + if (empty($result)) {
263 echo ' '; 239 echo ' ';
264 - }  
265 - else  
266 - { 240 + } else {
267 $this->echoJson($result); 241 $this->echoJson($result);
268 } 242 }
269 } 243 }
@@ -275,21 +249,16 @@ class HomeController extends AbstractAction @@ -275,21 +249,16 @@ class HomeController extends AbstractAction
275 { 249 {
276 $result = array(); 250 $result = array();
277 251
278 - if ($this->isAjax())  
279 - {  
280 - // $uid = $this->getUid();  
281 - $uid = 8826435; 252 + if ($this->isAjax()) {
  253 + $uid = $this->getUid();
282 $id = $this->post('id', ''); 254 $id = $this->post('id', '');
283 255
284 $result = \Index\UserModel::deleteAddress($uid, $id); 256 $result = \Index\UserModel::deleteAddress($uid, $id);
285 } 257 }
286 258
287 - if (empty($result))  
288 - { 259 + if (empty($result)) {
289 echo ' '; 260 echo ' ';
290 - }  
291 - else  
292 - { 261 + } else {
293 $this->echoJson($result); 262 $this->echoJson($result);
294 } 263 }
295 } 264 }
@@ -316,8 +285,7 @@ class HomeController extends AbstractAction @@ -316,8 +285,7 @@ class HomeController extends AbstractAction
316 $service = array(); 285 $service = array();
317 $cateId = $this->get('cateId', 0); 286 $cateId = $this->get('cateId', 0);
318 $cateName = $this->get('cateName', ''); 287 $cateName = $this->get('cateName', '');
319 - if ($cateId > 0)  
320 - { 288 + if ($cateId > 0) {
321 $service = home\OnlineModel::getOnlineServiceDetail($cateId); 289 $service = home\OnlineModel::getOnlineServiceDetail($cateId);
322 } 290 }
323 $this->setTitle('在线客服'); 291 $this->setTitle('在线客服');
@@ -333,25 +301,19 @@ class HomeController extends AbstractAction @@ -333,25 +301,19 @@ class HomeController extends AbstractAction
333 $page = $this->get('page', 1); 301 $page = $this->get('page', 1);
334 $limit = $this->get('limit', 10); 302 $limit = $this->get('limit', 10);
335 $uid = $this->getUid(); 303 $uid = $this->getUid();
336 - $uid=5687179;  
337 $gender = Helpers::getGenderByCookie(); 304 $gender = Helpers::getGenderByCookie();
338 $yh_channel = Helpers::getChannelByCookie(); 305 $yh_channel = Helpers::getChannelByCookie();
339 $guangInfo = \home\GuangModel::getMyGuang($uid, $page, $yh_channel, $gender, $limit); 306 $guangInfo = \home\GuangModel::getMyGuang($uid, $page, $yh_channel, $gender, $limit);
340 $totalPage = $guangInfo['totalPage']; 307 $totalPage = $guangInfo['totalPage'];
341 unset($guangInfo['totalPage']); 308 unset($guangInfo['totalPage']);
342 - if ($page == 1)  
343 - { 309 + if ($page == 1) {
344 $this->setTitle('我收藏的'); 310 $this->setTitle('我收藏的');
345 $this->setNavHeader('我收藏的', true, ''); 311 $this->setNavHeader('我收藏的', true, '');
346 $this->_view->display('my-guang', array('myGuangPage' => true, 'myGuang' => array('infos' => $guangInfo), 'pageFooter' => true)); 312 $this->_view->display('my-guang', array('myGuangPage' => true, 'myGuang' => array('infos' => $guangInfo), 'pageFooter' => true));
347 - }  
348 - else if ($page > 1 && $page<=$totalPage)  
349 - { 313 + } else if ($page > 1 && $page <= $totalPage) {
350 $this->_view->display('my-guang-partial', array('infos' => $guangInfo)); 314 $this->_view->display('my-guang-partial', array('infos' => $guangInfo));
351 - }  
352 - else if ($page > 1 && $page>$totalPage)  
353 - {  
354 - echo ' ';//退出循环 315 + } else if ($page > 1 && $page > $totalPage) {
  316 + echo ' '; //退出循环
355 } 317 }
356 } 318 }
357 319
@@ -383,7 +345,6 @@ class HomeController extends AbstractAction @@ -383,7 +345,6 @@ class HomeController extends AbstractAction
383 */ 345 */
384 public function suggestSubAction() 346 public function suggestSubAction()
385 { 347 {
386 -  
387 // 设置网站标题 348 // 设置网站标题
388 $this->setTitle('反馈问题'); 349 $this->setTitle('反馈问题');
389 350
@@ -417,8 +378,7 @@ class HomeController extends AbstractAction @@ -417,8 +378,7 @@ class HomeController extends AbstractAction
417 */ 378 */
418 public function savesuggestAction() 379 public function savesuggestAction()
419 { 380 {
420 - if ($this->isAjax())  
421 - { 381 + if ($this->isAjax()) {
422 $uid = $this->getUid(); 382 $uid = $this->getUid();
423 $content = $this->post('content', ''); 383 $content = $this->post('content', '');
424 $suggest_type = $this->post('suggest_type', 2); 384 $suggest_type = $this->post('suggest_type', 2);
@@ -433,12 +393,11 @@ class HomeController extends AbstractAction @@ -433,12 +393,11 @@ class HomeController extends AbstractAction
433 */ 393 */
434 public function upAndDownAction() 394 public function upAndDownAction()
435 { 395 {
436 - if ($this->isAjax())  
437 - {  
438 - $uid = $this->getUid();  
439 - $udid = $this->getUdid();  
440 - $suggest_id = $this->post('suggest_id', 0);  
441 - $result = \Index\UserModel::upAndDown($uid, $udid, $suggest_id); 396 + if ($this->isAjax()) {
  397 + $uid = $this->getUid();
  398 + $udid = $this->getUdid();
  399 + $suggest_id = $this->post('suggest_id', 0);
  400 + $result = \Index\UserModel::upAndDown($uid, $udid, $suggest_id);
442 401
443 $this->echoJson($result); 402 $this->echoJson($result);
444 } 403 }
@@ -457,7 +416,6 @@ class HomeController extends AbstractAction @@ -457,7 +416,6 @@ class HomeController extends AbstractAction
457 $gender = Helpers::getGenderByCookie(); 416 $gender = Helpers::getGenderByCookie();
458 $channel = Helpers::getChannelByCookie(); 417 $channel = Helpers::getChannelByCookie();
459 $uid = $this->getUid(); 418 $uid = $this->getUid();
460 - $uid = '10267443'; //临时测试用  
461 $data = GradeModel::getGrade($gender, $channel, $uid); 419 $data = GradeModel::getGrade($gender, $channel, $uid);
462 $data['pageFooter'] = true; 420 $data['pageFooter'] = true;
463 $this->_view->display('vip-grade', $data); 421 $this->_view->display('vip-grade', $data);
@@ -492,12 +450,9 @@ class HomeController extends AbstractAction @@ -492,12 +450,9 @@ class HomeController extends AbstractAction
492 $this->setTitle('我的订单'); 450 $this->setTitle('我的订单');
493 $this->setNavHeader('我的订单'); 451 $this->setNavHeader('我的订单');
494 $data = OrderModel::getNavs($type); 452 $data = OrderModel::getNavs($type);
495 - if (!empty($data))  
496 - { 453 + if (!empty($data)) {
497 $order['navs'] = $data; 454 $order['navs'] = $data;
498 - }  
499 - else  
500 - { 455 + } else {
501 $this->error(); 456 $this->error();
502 } 457 }
503 //渲染模板 458 //渲染模板
@@ -512,8 +467,7 @@ class HomeController extends AbstractAction @@ -512,8 +467,7 @@ class HomeController extends AbstractAction
512 public function getOrdersAction() 467 public function getOrdersAction()
513 { 468 {
514 //判断是不是ajax请求 469 //判断是不是ajax请求
515 - if (!$this->isAjax())  
516 - { 470 + if (!$this->isAjax()) {
517 $this->error(); 471 $this->error();
518 } 472 }
519 //获取基本参数:type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论 473 //获取基本参数:type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论
@@ -523,7 +477,6 @@ class HomeController extends AbstractAction @@ -523,7 +477,6 @@ class HomeController extends AbstractAction
523 $gender = Helpers::getGenderByCookie(); 477 $gender = Helpers::getGenderByCookie();
524 $yh_channel = $this->get('yh_channel', 1); 478 $yh_channel = $this->get('yh_channel', 1);
525 $uid = $this->getUid(); 479 $uid = $this->getUid();
526 - $uid = '10267443'; //测试用  
527 //调用模型层getOrder方法获得并处理数据 480 //调用模型层getOrder方法获得并处理数据
528 $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid); 481 $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
529 /* 如果取不到订单数据时,分两种情况: 482 /* 如果取不到订单数据时,分两种情况:
@@ -531,18 +484,12 @@ class HomeController extends AbstractAction @@ -531,18 +484,12 @@ class HomeController extends AbstractAction
531 2、page=1时,就给一个随便逛逛的链接。 484 2、page=1时,就给一个随便逛逛的链接。
532 * */ 485 * */
533 $order = array(); 486 $order = array();
534 - if (!empty($data))  
535 - { 487 + if (!empty($data)) {
536 $order['orders'] = $data; 488 $order['orders'] = $data;
537 - }  
538 - else  
539 - {  
540 - if ($page > 1)  
541 - { 489 + } else {
  490 + if ($page > 1) {
542 echo " "; 491 echo " ";
543 - }  
544 - elseif ($page == 1)  
545 - { 492 + } elseif ($page == 1) {
546 $order['walkwayUrl'] = self::strollAction(); 493 $order['walkwayUrl'] = self::strollAction();
547 } 494 }
548 } 495 }
@@ -558,14 +505,12 @@ class HomeController extends AbstractAction @@ -558,14 +505,12 @@ class HomeController extends AbstractAction
558 { 505 {
559 506
560 //判断是不是ajax请求 507 //判断是不是ajax请求
561 - if (!$this->isAjax())  
562 - { 508 + if (!$this->isAjax()) {
563 $this->error(); 509 $this->error();
564 } 510 }
565 //传入order_code和uid以取消订单 511 //传入order_code和uid以取消订单
566 $order_code = $this->get('id'); 512 $order_code = $this->get('id');
567 $uid = $this->getUid(); 513 $uid = $this->getUid();
568 - $uid = '10267443'; //测试用  
569 $gender = Helpers::getGenderByCookie(); 514 $gender = Helpers::getGenderByCookie();
570 $yh_channel = $this->get('yh_channel', 1); 515 $yh_channel = $this->get('yh_channel', 1);
571 $method = 'app.SpaceOrders.close'; 516 $method = 'app.SpaceOrders.close';
@@ -582,14 +527,12 @@ class HomeController extends AbstractAction @@ -582,14 +527,12 @@ class HomeController extends AbstractAction
582 public function delOrderAction() 527 public function delOrderAction()
583 { 528 {
584 //判断是不是ajax请求 529 //判断是不是ajax请求
585 - if (!$this->isAjax())  
586 - { 530 + if (!$this->isAjax()) {
587 $this->error(); 531 $this->error();
588 } 532 }
589 //传入order_code和uid以删除订单 533 //传入order_code和uid以删除订单
590 $order_code = $this->get('id'); 534 $order_code = $this->get('id');
591 $uid = $this->getUid(); 535 $uid = $this->getUid();
592 - $uid = '10267443'; //测试用  
593 $gender = Helpers::getGenderByCookie(); 536 $gender = Helpers::getGenderByCookie();
594 $yh_channel = $this->get('yh_channel', 1); 537 $yh_channel = $this->get('yh_channel', 1);
595 $method = 'app.SpaceOrders.delOrderByCode'; 538 $method = 'app.SpaceOrders.delOrderByCode';
@@ -258,12 +258,12 @@ class UserModel @@ -258,12 +258,12 @@ class UserModel
258 * @param int $uid 用户ID 258 * @param int $uid 用户ID
259 * @return array|mixed 处理之后的优惠券数据 259 * @return array|mixed 处理之后的优惠券数据
260 */ 260 */
261 - public static function getCouponData($uid, $status) 261 + public static function getCouponData($uid)
262 { 262 {
263 $result = array(); 263 $result = array();
264 264
265 // 调用接口获取优惠券数据 265 // 调用接口获取优惠券数据
266 - $coupons = UserData::couponData($uid, $status); 266 + $coupons = UserData::couponData($uid);
267 267
268 // 处理优惠券数据 268 // 处理优惠券数据
269 if (!empty($coupons['unused'])) { 269 if (!empty($coupons['unused'])) {
@@ -307,6 +307,15 @@ class UserModel @@ -307,6 +307,15 @@ class UserModel
307 { 307 {
308 $result = array(); 308 $result = array();
309 309
  310 + if (USE_CACHE) {
  311 + $key = CacheConfig::KEY_ACTION_ADDRESS_LIST_DATA;
  312 + // 先尝试获取一级缓存(master), 有数据则直接返回.
  313 + $result = Cache::get($key, 'master');
  314 + if (!empty($result)) {
  315 + return $result;
  316 + }
  317 + }
  318 +
310 // 调用接口获取地址列表数据 319 // 调用接口获取地址列表数据
311 $address = UserData::addressListData($uid); 320 $address = UserData::addressListData($uid);
312 321
@@ -315,6 +324,17 @@ class UserModel @@ -315,6 +324,17 @@ class UserModel
315 $result = $address['data']; 324 $result = $address['data'];
316 } 325 }
317 326
  327 + if (USE_CACHE) {
  328 + // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
  329 + if (empty($result)) {
  330 + $result = Cache::get($key, 'slave');
  331 + }
  332 + // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
  333 + else {
  334 + Cache::set($key, $result, 1800); // 缓存30分钟
  335 + }
  336 + }
  337 +
318 return $result; 338 return $result;
319 } 339 }
320 340
@@ -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 // 商品价格
@@ -159,10 +161,14 @@ class DetailModel @@ -159,10 +161,14 @@ class DetailModel
159 } 161 }
160 } 162 }
161 163
162 - // 调用尺码需要的SKN号  
163 - if (isset($baseInfo['erpProductId'])) {  
164 - $result['skn'] = $baseInfo['erpProductId'];  
165 - } 164 + // 悬浮的购物车信息
  165 + $result['cartInfo'] = array(
  166 + 'numInCart' => 0,
  167 + 'goodsInstore' => $baseInfo['storage'],
  168 + );
  169 +
  170 + // 底部简介的URL链接
  171 + $result['introUrl'] = Helpers::url('/product/intro_' . $baseInfo['erpProductId'] . '/' . $baseInfo['cnAlphabet'] . '.html');
166 } 172 }
167 173
168 return $result; 174 return $result;
@@ -198,11 +204,8 @@ class DetailModel @@ -198,11 +204,8 @@ class DetailModel
198 $result['goodsDescription']['detail'][] = $value['standardName'] . ':' . $value['standardVal']; 204 $result['goodsDescription']['detail'][] = $value['standardName'] . ':' . $value['standardVal'];
199 } 205 }
200 } 206 }
201 - if (isset($sizeInfo['productIntroBo']['productIntro'])) {  
202 - $productIntro = strstr($sizeInfo['productIntroBo']['productIntro'], '<br />', true);  
203 - if ($productIntro) {  
204 - $result['goodsDescription']['desc'] = strtr($productIntro, array('<p>\r\n\t' => ''));  
205 - } 207 + if (isset($sizeInfo['phrase'])) {
  208 + $result['goodsDescription']['desc'] = $sizeInfo['phrase'];
206 } 209 }
207 210
208 // 尺码信息 211 // 尺码信息
@@ -267,43 +270,46 @@ class DetailModel @@ -267,43 +270,46 @@ class DetailModel
267 270
268 // 商品材质 271 // 商品材质
269 if (!empty($sizeInfo['productMaterialList'])) { 272 if (!empty($sizeInfo['productMaterialList'])) {
  273 + $result['materials'] = array(
  274 + 'title' => '商品材质',
  275 + 'enTitle' => 'MATERIALS',
  276 + 'list' => array(),
  277 + );
270 foreach ($sizeInfo['productMaterialList'] as $value) { 278 foreach ($sizeInfo['productMaterialList'] as $value) {
271 - 279 + $result['materials']['list'][] = array(
  280 + 'img' => $value['imageUrl'],
  281 + 'desc' => $value['remark'],
  282 + );
  283 + }
  284 + }
  285 +
  286 + // 洗涤提示
  287 + if (!empty($sizeInfo['washTipsBoList'])) {
  288 + $result['washTips']['list'] = array();
  289 + foreach ($sizeInfo['washTipsBoList'] as $value) {
  290 + $result['washTips']['list'][] = $value;
  291 + }
  292 + }
  293 +
  294 + // 详情配图
  295 + if (isset($sizeInfo['productIntroBo']['productIntro'])) {
  296 + $productIntro = strstr($sizeInfo['productIntroBo']['productIntro'], '<br />');
  297 + if ($productIntro) {
  298 + $result['productDetail'] = array(
  299 + 'title' => '商品详情',
  300 + 'enTitle' => 'DETAILS',
  301 + 'desc' => strtr($productIntro, array(
  302 + '\r\n\t' => '',
  303 + '</p>' => '',
  304 + '<img src=' => '<img class=\"lazy\" src=\"data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==\" data-original=',
  305 + )),
  306 + );
272 } 307 }
273 } 308 }
274 309
275 } 310 }
276 311
277 return $result; 312 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"  
292 - }  
293 - ]  
294 - }  
295 -  
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 - }  
307 } 313 }
308 314
309 } 315 }
@@ -186,15 +186,13 @@ class LoginController extends AbstractAction @@ -186,15 +186,13 @@ class LoginController extends AbstractAction
186 $userInfo = $alipay->getUserInfo($access); 186 $userInfo = $alipay->getUserInfo($access);
187 if ($userInfo && $userInfo['is_success'] === 'T' && isset($userInfo['response']['user_info']['user_name'])) { 187 if ($userInfo && $userInfo['is_success'] === 'T' && isset($userInfo['response']['user_info']['user_name'])) {
188 $nickname = $userInfo['response']['user_info']['user_name']; 188 $nickname = $userInfo['response']['user_info']['user_name'];
189 - $alipayEmail = $userInfo['response']['user_info']['email']; 189 + // $alipayEmail = $userInfo['response']['user_info']['email'];
190 } 190 }
191 - var_dump($userInfo);  
192 } 191 }
193 else { 192 else {
194 $nickname = $_GET['real_name']; 193 $nickname = $_GET['real_name'];
195 - $alipayEmail = isset($_GET['email']) ? $_GET['email'] : ''; 194 + // $alipayEmail = isset($_GET['email']) ? $_GET['email'] : '';
196 } 195 }
197 - var_dump($access);  
198 196
199 $result = LoginData::signinByOpenID($nickname, $access['user_id'], 'qq'); 197 $result = LoginData::signinByOpenID($nickname, $access['user_id'], 'qq');
200 198
@@ -16,17 +16,22 @@ class DetailController extends AbstractAction @@ -16,17 +16,22 @@ 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');
  20 + $productId = 22399;
20 if (!is_numeric($productId)) { 21 if (!is_numeric($productId)) {
21 $this->error(); 22 $this->error();
22 } 23 }
23 - $goodsId = $this->param('goodsId', 3241); 24 + $goodsId = $this->param('goodsId');
  25 + $goodsId = 32443;
24 if (!is_numeric($goodsId)) { 26 if (!is_numeric($goodsId)) {
25 $this->error(); 27 $this->error();
26 } 28 }
27 $uid = $this->getUid(); 29 $uid = $this->getUid();
28 30
29 - $data = \Product\DetailModel::getBaseInfo($productId, $goodsId, $uid); 31 + $data = \Product\DetailModel::getBaseInfo($productId, $goodsId, $uid); var_dump($data);
  32 + if (array() === $data) {
  33 + $this->error();
  34 + }
30 $data['goodsDetailPage'] = true; 35 $data['goodsDetailPage'] = true;
31 36
32 if (isset($data['goodsName'])) { 37 if (isset($data['goodsName'])) {
@@ -34,235 +39,27 @@ class DetailController extends AbstractAction @@ -34,235 +39,27 @@ class DetailController extends AbstractAction
34 } 39 }
35 $this->setNavHeader('商品详情'); 40 $this->setNavHeader('商品详情');
36 41
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 // 渲染模板 42 // 渲染模板
264 $this->_view->display('index', $data); 43 $this->_view->display('index', $data);
265 } 44 }
  45 +
  46 + /**
  47 + * 尺码描述信息
  48 + */
  49 + public function introAction()
  50 + {
  51 + $productSkn = $this->param('productSkn');
  52 + if (!is_numeric($productSkn)) {
  53 + $this->error();
  54 + }
  55 + $data = \Product\DetailModel::getSizeInfo($productSkn);
  56 + if (array() === $data) {
  57 + echo ' ';
  58 + exit();
  59 + }
  60 + $this->_view->display('intro', $data);
  61 + }
  62 +
266 63
267 public function commentsAction() 64 public function commentsAction()
268 { 65 {
@@ -117,4 +117,19 @@ routes.brandsearch.route.module = Category @@ -117,4 +117,19 @@ routes.brandsearch.route.module = Category
117 routes.brandsearch.route.controller = Brand 117 routes.brandsearch.route.controller = Brand
118 routes.brandsearch.route.action = Search 118 routes.brandsearch.route.action = Search
119 119
  120 +; 商品详情
  121 +routes.product.type = "regex"
  122 +routes.product.match = "#/product/pro_([0-9]+)_([0-9]+)/(.*)#"
  123 +routes.product.route.module = Product
  124 +routes.product.route.controller = Detail
  125 +routes.product.route.action = Index
  126 +routes.product.map.1 = productId
  127 +routes.product.map.2 = goodsId
  128 +
  129 +routes.buy.type = "regex"
  130 +routes.buy.match = "#/product/intro_([0-9]+)/(.*).html#"
  131 +routes.buy.route.module = Product
  132 +routes.buy.route.controller = Detail
  133 +routes.buy.route.action = Intro
  134 +routes.buy.map.1 = productSkn
120 135
@@ -4,19 +4,3 @@ routes.goodsfilter.match = "/search/filter" @@ -4,19 +4,3 @@ routes.goodsfilter.match = "/search/filter"
4 routes.goodsfilter.route.module = Index 4 routes.goodsfilter.route.module = Index
5 routes.goodsfilter.route.controller = Search 5 routes.goodsfilter.route.controller = Search
6 routes.goodsfilter.route.action = Filter 6 routes.goodsfilter.route.action = Filter
7 -  
8 -routes.product.type = "regex"  
9 -routes.product.match = "#/product/pro_([0-9]+)_([0-9]+)/(.*)#"  
10 -routes.product.route.module = Product  
11 -routes.product.route.controller = Detail  
12 -routes.product.route.action = Index  
13 -routes.product.map.1 = productId  
14 -routes.product.map.2 = goodsId  
15 -  
16 -routes.buy.type = "regex"  
17 -routes.buy.match = "#/product/buy_([0-9]+)_([0-9]+).html#"  
18 -routes.buy.route.module = Product  
19 -routes.buy.route.controller = Detail  
20 -routes.buy.route.action = Index  
21 -routes.buy.map.1 = productId  
22 -routes.buy.map.2 = goodsId