Authored by Lynnic

update

@@ -344,14 +344,18 @@ class UserData @@ -344,14 +344,18 @@ class UserData
344 * 344 *
345 * @param int $uid 用户ID 345 * @param int $uid 用户ID
346 * @param string $content 意见内容 346 * @param string $content 意见内容
  347 + * @param mixed $image 图片地址
347 * @param int $suggest_type 意见类型 348 * @param int $suggest_type 意见类型
348 * @return array 意见反馈接口返回的数据 349 * @return array 意见反馈接口返回的数据
349 */ 350 */
350 - public static function savesuggestData($uid, $content, $suggest_type) 351 + public static function savesuggestData($uid, $content, $image, $suggest_type)
351 { 352 {
352 $param = Yohobuy::param(); 353 $param = Yohobuy::param();
353 $param['uid'] = $uid; 354 $param['uid'] = $uid;
354 $param['content'] = $content; 355 $param['content'] = $content;
  356 + if($image !== null) {
  357 + $param['image'] = $image;
  358 + }
355 $param['suggest_type'] = $suggest_type; 359 $param['suggest_type'] = $suggest_type;
356 $param['client_secret'] = Sign::getSign($param); 360 $param['client_secret'] = Sign::getSign($param);
357 361
@@ -187,7 +187,11 @@ class Images @@ -187,7 +187,11 @@ class Images
187 187
188 if(count($file) == 1 || !is_array($file)) 188 if(count($file) == 1 || !is_array($file))
189 { 189 {
190 - $imgList['imgList'][] = array('imgUrl' => self::getSourceUrl(current($result['data']['imagesList']), 'suggest') . $imgExtra); 190 + $imgRelUrl = current($result['data']['imagesList']);
  191 + $imgList['imgList'][] = array(
  192 + 'imgUrl' => self::getSourceUrl($imgRelUrl, 'suggest') . $imgExtra,
  193 + 'imgRelUrl' => $imgRelUrl
  194 + );
191 } 195 }
192 else 196 else
193 { 197 {
@@ -195,6 +199,7 @@ class Images @@ -195,6 +199,7 @@ class Images
195 foreach ($result['data']['imagesList'] as $val) { 199 foreach ($result['data']['imagesList'] as $val) {
196 $img = array(); 200 $img = array();
197 $img['imgUrl'] = self::getSourceUrl($val, 'suggest') . $imgExtra; 201 $img['imgUrl'] = self::getSourceUrl($val, 'suggest') . $imgExtra;
  202 + $img['imgRelUrl'] = $val;
198 $imgList['imgList'][] = $img; 203 $imgList['imgList'][] = $img;
199 } 204 }
200 } 205 }
@@ -60,10 +60,10 @@ @@ -60,10 +60,10 @@
60 {{# feedbacks}} 60 {{# feedbacks}}
61 {{#if commentsNum}} 61 {{#if commentsNum}}
62 {{> product/feedback-tab}} 62 {{> product/feedback-tab}}
63 - {{else}} 63 + {{^}}
64 {{#if consultsNum}} 64 {{#if consultsNum}}
65 {{> product/feedback-tab}} 65 {{> product/feedback-tab}}
66 - {{else}} 66 + {{^}}
67 <div class="nodata"> 67 <div class="nodata">
68 <span>暂无商品评价和咨询</span> 68 <span>暂无商品评价和咨询</span>
69 <a class="go-consult">我要咨询<span class="iconfont">&#xe604;</span></a> 69 <a class="go-consult">我要咨询<span class="iconfont">&#xe604;</span></a>
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
22 </span> 22 </span>
23 {{/ comments}} 23 {{/ comments}}
24 </div> 24 </div>
25 - {{else}} 25 + {{^}}
26 <div class="comment-content-main content-main no-item"> 26 <div class="comment-content-main content-main no-item">
27 <span class="iconfont">&#xe63c;</span>暂无评论 27 <span class="iconfont">&#xe63c;</span>暂无评论
28 </div> 28 </div>
@@ -384,7 +384,8 @@ class HomeController extends AbstractAction @@ -384,7 +384,8 @@ class HomeController extends AbstractAction
384 $uid = $this->getUid(); 384 $uid = $this->getUid();
385 $content = $this->post('content', ''); 385 $content = $this->post('content', '');
386 $suggest_type = $this->post('suggest_type', 2); 386 $suggest_type = $this->post('suggest_type', 2);
387 - $result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type); 387 + $image = $this->post('image', null);
  388 + $result = \Index\UserModel::saveSuggestData($uid, $content, $image, $suggest_type);
388 389
389 $this->echoJson($result); 390 $this->echoJson($result);
390 } 391 }
@@ -487,15 +487,16 @@ class UserModel @@ -487,15 +487,16 @@ class UserModel
487 * 487 *
488 * @param int $uid 用户ID 488 * @param int $uid 用户ID
489 * @param string $content 意见内容 489 * @param string $content 意见内容
  490 + * @param mixed $image 图片地址
490 * @param int $suggest_type 意见类型 491 * @param int $suggest_type 意见类型
491 * @return array|mixed 保存意见反馈数据之后的返回 492 * @return array|mixed 保存意见反馈数据之后的返回
492 */ 493 */
493 - public static function saveSuggestData($uid, $content, $suggest_type) 494 + public static function saveSuggestData($uid, $content, $image, $suggest_type)
494 { 495 {
495 $result = array('code' => 400, 'message' => '保存出错'); 496 $result = array('code' => 400, 'message' => '保存出错');
496 497
497 // 调用接口保存意见反馈数据 498 // 调用接口保存意见反馈数据
498 - $save = UserData::savesuggestData($uid, $content, $suggest_type); 499 + $save = UserData::savesuggestData($uid, $content, $image, $suggest_type);
499 500
500 if (isset($save['code']) && $save['code'] == 200) { 501 if (isset($save['code']) && $save['code'] == 200) {
501 $result['code'] = 200; 502 $result['code'] = 200;
@@ -76,7 +76,7 @@ class DetailModel @@ -76,7 +76,7 @@ class DetailModel
76 // 商品咨询和商品评价 76 // 商品咨询和商品评价
77 $result['feedbacks'] = array(); 77 $result['feedbacks'] = array();
78 if (!empty($baseInfo['consultBoWrapper'])) { 78 if (!empty($baseInfo['consultBoWrapper'])) {
79 - $result['feedbacks']['consultNum'] = $baseInfo['consultBoWrapper']['consultTotal']; 79 + $result['feedbacks']['consultsNum'] = '0';//empty($baseInfo['consultBoWrapper']['consultTotal']) ? '0' : $baseInfo['consultBoWrapper']['consultTotal'];
80 $result['feedbacks']['consults'] = array(); 80 $result['feedbacks']['consults'] = array();
81 $build = array(); 81 $build = array();
82 foreach ($baseInfo['consultBoWrapper']['consultBoList'] as $value) { 82 foreach ($baseInfo['consultBoWrapper']['consultBoList'] as $value) {
@@ -87,7 +87,7 @@ class DetailModel @@ -87,7 +87,7 @@ class DetailModel
87 } 87 }
88 } 88 }
89 if (!empty($baseInfo['commentBoWrapper'])) { 89 if (!empty($baseInfo['commentBoWrapper'])) {
90 - $result['feedbacks']['commentNum'] = $baseInfo['commentBoWrapper']['commentTotal']; 90 + $result['feedbacks']['commentsNum'] = '0';//empty($baseInfo['commentBoWrapper']['commentTotal']) ? '0' : $baseInfo['commentBoWrapper']['commentTotal'];
91 $result['feedbacks']['comments'] = array(); 91 $result['feedbacks']['comments'] = array();
92 $build = array(); 92 $build = array();
93 foreach ($baseInfo['commentBoWrapper']['commentBoList'] as $value) { 93 foreach ($baseInfo['commentBoWrapper']['commentBoList'] as $value) {
@@ -301,7 +301,8 @@ class DetailModel @@ -301,7 +301,8 @@ class DetailModel
301 'desc' => strtr($productIntro, array( 301 'desc' => strtr($productIntro, array(
302 '\r\n\t' => '', 302 '\r\n\t' => '',
303 '</p>' => '', 303 '</p>' => '',
304 - '<img src=' => '<img class=\"lazy\" src=\"data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==\" data-original=', 304 + '<br />' => "\r\n",
  305 + '<img src=' => "<img class=\"lazy\" src=\"data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==\" data-original=",
305 )), 306 )),
306 ); 307 );
307 } 308 }
@@ -312,4 +313,20 @@ class DetailModel @@ -312,4 +313,20 @@ class DetailModel
312 return $result; 313 return $result;
313 } 314 }
314 315
  316 + /**
  317 + * 获取评价列表
  318 + */
  319 + public static function getComments()
  320 + {
  321 +
  322 + }
  323 +
  324 + /**
  325 + * 获取咨询列表
  326 + */
  327 + public static function getConsults()
  328 + {
  329 +
  330 + }
  331 +
315 } 332 }
@@ -16,382 +16,51 @@ class DetailController extends AbstractAction @@ -16,382 +16,51 @@ class DetailController extends AbstractAction
16 */ 16 */
17 public function indexAction() 17 public function indexAction()
18 { 18 {
19 - $productId = $this->param('productId', 123);  
20 - $goodsId = $this->param('goodsId', 3241); 19 + $productId = $this->param('productId');
  20 + $productId = 22399;
  21 + if (!is_numeric($productId)) {
  22 + $this->error();
  23 + }
  24 + $goodsId = $this->param('goodsId');
  25 + $goodsId = 32443;
  26 + if (!is_numeric($goodsId)) {
  27 + $this->error();
  28 + }
21 $uid = $this->getUid(); 29 $uid = $this->getUid();
22 30
  31 + $data = \Product\DetailModel::getBaseInfo($productId, $goodsId, $uid);
  32 + if (array() === $data) {
  33 + $this->error();
  34 + }
  35 + $data['goodsDetailPage'] = true;
23 36
  37 + if (isset($data['goodsName'])) {
  38 + $this->setTitle($data['goodsName']);
  39 + }
  40 + $this->setNavHeader('商品详情');
24 41
25 - // $data = \Product\DetailModel::getBaseInfo($productId, $goodsId, $uid);  
26 - // $data['goodsDetailPage'] = true;  
27 -  
28 - // if (isset($data['goodsName'])) {  
29 - // $this->setTitle($data['goodsName']);  
30 - // }  
31 - // $this->setNavHeader('商品详情');  
32 -  
33 - $data = array (  
34 - 'goodsDetailPage' => true,  
35 - 'pageHeader' => array (  
36 - 'navBack' => 'sss ',  
37 - 'navHome' => 'sss ',  
38 - 'navTitle' => '商品详情TEST'  
39 - ),  
40 -  
41 - 'bannerTop' => array (  
42 - 'list' => array (  
43 - array (  
44 - 'url' => '',  
45 - 'img' => 'http://img13.static.yhbimg.com/goodsimg/2015/10/18/03/0250c3935f86dbd2baa7d45603d19fd637.jpg?imageMogr2/thumbnail/450x600/extent/450x600/background/d2hpdGU=/position/center/quality/90'  
46 - ),  
47 - array (  
48 - 'url' => '',  
49 - 'img' => 'http://img11.static.yhbimg.com/goodsimg/2015/10/12/03/01bf4cf4444035a1930d33a9d0f8bff4fa.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/01d7ef2f624eeea15e80bb374607aea317.jpg?imageMogr2/thumbnail/450x600/extent/450x600/background/d2hpdGU=/position/center/quality/90'  
54 - )  
55 - )  
56 - ),  
57 - 'goodsName' => 'Stussy No. 4 BOX TEE DC SPAR HIGH WC  
58 -SHOE BQT KEN BLOCK',  
59 - 'goodsSubtitle'=>'【全民拼抢购】经典印花T恤,满4件免一件!全场低至  
60 -9.9元,拼购时代High起来。',  
61 -  
62 - 'goodsPrice' =>array(  
63 - 'currentPrice'=>'¥298.00',  
64 - 'previousPrice'=>'¥598.00'  
65 - ),  
66 - 'periodOfMarket'=>'11月',  
67 - 'goodsTitle' => '¥298.00',  
68 - 'vipLevel' => array (  
69 - 'list' => array (  
70 - array (  
71 - 'img'=>'http://static.dev.yohobuy.com/img/product/silver.png',  
72 - 'text' => '¥284.00'  
73 - ),  
74 - array (  
75 - 'img'=>'http://static.dev.yohobuy.com/img/product/golden.png',  
76 - 'text' => '¥269.00'  
77 - ),  
78 - array (  
79 - 'img'=>'http://static.dev.yohobuy.com/img/product/platinum.png',  
80 - 'text' => '¥263.00'  
81 - )  
82 - )  
83 - ),  
84 - 'goodsDiscount'=>array(  
85 - 'list'=>array(  
86 - array(  
87 - 'text' =>' 【summer final sale】满¥499立享6.8折'  
88 - ),  
89 - array(  
90 - 'text' =>' 【BACK TO SCHOOL】满¥499赠送Paul  
91 - Franke帽子一个,多买多送!'  
92 - ),  
93 - array(  
94 - 'text' =>' 【BACK TO SCHOOL】满¥499赠送Paul  
95 - Franke帽子一个,多买多送!'  
96 - )  
97 - )  
98 - ),  
99 - 'feedbacks'=>array(  
100 - 'commentsNum'=>0,  
101 - 'consultsNum'=>1,  
102 - // 'commentName'=>'商品评价',  
103 - // 'consultName' =>'购买咨询',  
104 - 'link'=>'',  
105 - 'comments'=>array(  
106 - array(  
107 - 'userName'=>'Lynnic',  
108 - 'desc'=>'购买了白色Mate7',  
109 - 'content'=>'活动时买的,挺超值。上身效果也不错。质量  
110 -很好,买送人的,很满意。而且物流相当给...',  
111 - 'time'=>'2014-08-12 10:24:26'  
112 - )  
113 - ),  
114 - 'consults'=>array(  
115 - array(  
116 - 'question' =>'您好 我一米七七 140斤 穿M的行吗',  
117 - 'time'=>'2014-08-12 10:24:26',  
118 - 'answer'=>'您好,建议您参考XL的款式,由于版型和个人穿衣风格不同,需要'  
119 - )  
120 - )  
121 - ),  
122 -  
123 - 'enterStore'=>array(  
124 - 'img'=>'http://static.dev.yohobuy.com/img/product/store.png',  
125 - 'storeName'=>'Stussy',  
126 - 'url'=>'http://stussy.m.yohobuy.com/'  
127 - ),  
128 -  
129 - 'goodsDescription'=>array(  
130 - 'title' =>'商品描述',  
131 - 'enTitle'=>'DESCRIPTON',  
132 -  
133 - 'detail'=>array(  
134 - 'list' =>array(  
135 - array(  
136 - 'param'=>'编号:100101'  
137 - ),  
138 - array(  
139 - 'param'=>'编号:100101'  
140 - ),  
141 - array(  
142 - 'param'=>'编号:100101'  
143 - )  
144 - )  
145 - ),  
146 -  
147 - 'desc'=>'fafdfa'  
148 - ),  
149 -  
150 - 'sizeInfo'=>array(  
151 - 'title' => '尺码信息',  
152 - 'enTitle' =>'xSIZE INFO',  
153 -  
154 - 'detail' =>array(  
155 - 'list'=>array(  
156 - array(  
157 - 'params'=>array(  
158 - array(  
159 - 'param' =>'M'  
160 - ),  
161 - array(  
162 - 'param' =>'XL'  
163 - ),  
164 - array(  
165 - 'param' =>'XXL'  
166 - )  
167 - )  
168 - ),  
169 - array(  
170 - 'params'=>array(  
171 - array(  
172 - 'param' =>'43'  
173 - ),  
174 - array(  
175 - 'param' =>'46'  
176 - ),  
177 - array(  
178 - 'param' =>'XXL'  
179 - )  
180 - )  
181 - ),  
182 - array(  
183 - 'params'=>array(  
184 - array(  
185 - 'param' =>'102'  
186 - ),  
187 - array(  
188 - 'param' =>'107'  
189 - ),  
190 - array(  
191 - 'param' =>'XXL'  
192 - )  
193 - )  
194 - ),  
195 - array(  
196 - 'params'=>array(  
197 - array(  
198 - 'param' =>'11'  
199 - ),  
200 - array(  
201 - 'param' =>'22'  
202 - ),  
203 - array(  
204 - 'param' =>'XXL'  
205 - )  
206 - )  
207 - ),  
208 - array(  
209 - 'params'=>array(  
210 - array(  
211 - 'param' =>'bb'  
212 - ),  
213 - array(  
214 - 'param' =>'cc'  
215 - ),  
216 - array(  
217 - 'param' =>'XXL'  
218 - )  
219 - )  
220 - ),  
221 - array(  
222 - 'params'=>array(  
223 - array(  
224 - 'param' =>'kk'  
225 - ),  
226 - array(  
227 - 'param' =>'bb'  
228 - ),  
229 - array(  
230 - 'param' =>'XXL'  
231 - )  
232 - )  
233 - )  
234 - )  
235 - )  
236 - ),  
237 -  
238 - 'measurementMethod'=>array(  
239 - 'title' => '测量方式',  
240 - 'enTitle' =>'MEASUREMENT METHOD',  
241 - 'img'=>'http://static.yohobuy.com/images/1.jpg'  
242 - ),  
243 -  
244 - 'reference' => array(  
245 - 'title' => '模特试穿',  
246 - 'enTitle' =>'REFERENCE',  
247 -  
248 - 'detail' =>array(  
249 - 'list'=>array(  
250 - array(  
251 - 'params'=>array(  
252 - array(  
253 - 'param' =>'M'  
254 - ),  
255 - array(  
256 - 'param' =>'http://static.dev.yohobuy.com/img/product/avatar1.png'  
257 - ),  
258 - array(  
259 - 'param' =>'http://static.dev.yohobuy.com/img/product/avatar2.png'  
260 - )  
261 - )  
262 - ),  
263 - array(  
264 - 'params'=>array(  
265 - array(  
266 - 'param' =>'模特'  
267 - ),  
268 - array(  
269 - 'param' =>'Oliver'  
270 - ),  
271 - array(  
272 - 'param' =>'http://static.dev.yohobuy.com/img/product/avatar2.png'  
273 - )  
274 - )  
275 - ),  
276 - array(  
277 - 'params'=>array(  
278 - array(  
279 - 'param' =>'102'  
280 - ),  
281 - array(  
282 - 'param' =>'107'  
283 - ),  
284 - array(  
285 - 'param' =>'XXL'  
286 - )  
287 - )  
288 - ),  
289 - array(  
290 - 'params'=>array(  
291 - array(  
292 - 'param' =>'11'  
293 - ),  
294 - array(  
295 - 'param' =>'22'  
296 - ),  
297 - array(  
298 - 'param' =>'XXL'  
299 - )  
300 - )  
301 - ),  
302 - array(  
303 - 'params'=>array(  
304 - array(  
305 - 'param' =>'bb'  
306 - ),  
307 - array(  
308 - 'param' =>'cc'  
309 - ),  
310 - array(  
311 - 'param' =>'XXL'  
312 - )  
313 - )  
314 - ),  
315 - array(  
316 - 'params'=>array(  
317 - array(  
318 - 'param' =>'kk'  
319 - ),  
320 - array(  
321 - 'param' =>'bb'  
322 - ),  
323 - array(  
324 - 'param' =>'XXL'  
325 - )  
326 - )  
327 - )  
328 - )  
329 - )  
330 - ),  
331 -  
332 - 'materials' => array(  
333 - 'title' => '商品材质',  
334 - 'enTitle' =>'MATERIALS',  
335 - 'list' => array(  
336 - array(  
337 - 'img' => 'http://static.dev.yohobuy.com/img/product/material.png',  
338 - 'desc' =>'用各种洗涤剂,可手洗机洗,但不宜氯漂,宜阴干,避免曝晒,以免深色衣物褪色,在日光下晾晒时,将里面朝外。浸泡时间不能太长,避免褪色,深色与浅色衣服最好请分开洗涤,避免染色。'  
339 - ),  
340 - array(  
341 - 'img' => 'http://static.dev.yohobuy.com/img/product/material.png',  
342 - 'desc' =>'用各种洗涤剂,可手洗机洗,但不宜氯漂,宜阴干,避免曝晒,以免深色衣物褪色,在日光下晾晒时,将里面朝外。浸泡时间不能太长,避免褪色,深色与浅色衣服最好请分开洗涤,避免染色。'  
343 - )  
344 -  
345 - )  
346 - ),  
347 -  
348 - 'washTips' => array(  
349 - array(  
350 - 'img' => 'http://static.dev.yohobuy.com/img/product/washtips/washtip-1.png',  
351 - 'caption'=>'不可干燥不可干洗'  
352 - ),  
353 - array(  
354 - 'img' => 'http://static.dev.yohobuy.com/img/product/washtips/washtip-1.png',  
355 - 'caption'=>'不可干燥不可干洗'  
356 - ),  
357 - array(  
358 - 'img' => 'http://static.dev.yohobuy.com/img/product/washtips/washtip-1.png',  
359 - 'caption'=>'不可干燥不可干洗'  
360 - ),  
361 - array(  
362 - 'img' => 'http://static.dev.yohobuy.com/img/product/washtips/washtip-1.png',  
363 - 'caption'=>'不可干燥不可干洗'  
364 - ),  
365 - array(  
366 - 'img' => 'http://static.dev.yohobuy.com/img/product/washtips/washtip-1.png',  
367 - 'caption'=>'不可干燥不可干洗'  
368 - ),  
369 - array(  
370 - 'img' => 'http://static.dev.yohobuy.com/img/product/washtips/washtip-1.png',  
371 - 'caption'=>'不可干燥不可干洗'  
372 - )  
373 - ),  
374 -  
375 - 'productDetail' =>array(  
376 - 'title' => '商品详情',  
377 - 'enTitle' =>'DETAILS',  
378 - 'desc' => 'Married to the MOB是由Leah McSweeney创立的女装品牌,一向标榜不羁、大胆的女性streetwear设计。喜欢恶搞的女生们,赶紧入手吧。',  
379 - 'list' => array (  
380 - array('img' =>'http://static.dev.yohobuy.com/img/product/product.png'),  
381 - array('img' =>'http://static.dev.yohobuy.com/img/product/product.png')  
382 - )  
383 - ),  
384 -  
385 - 'cartInfo' =>array(  
386 - 'numInCart' => 3,  
387 - 'goodsInstore'=>0  
388 - )  
389 -  
390 - );  
391 // 渲染模板 42 // 渲染模板
392 $this->_view->display('index', $data); 43 $this->_view->display('index', $data);
393 } 44 }
394 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 +
  63 +
395 public function commentsAction() 64 public function commentsAction()
396 { 65 {
397 $data = array( 66 $data = array(