Authored by 梁志锋

Merge remote-tracking branch 'origin/develop' into beta

@@ -32,7 +32,7 @@ class IndexData @@ -32,7 +32,7 @@ class IndexData
32 * @param string $client_type 32 * @param string $client_type
33 * @return array 33 * @return array
34 */ 34 */
35 - public static function getResourceData($content_code, $client_type = 'web') 35 + public static function getResourceData($content_code, $client_type = 'web')
36 { 36 {
37 // 构建必传参数 37 // 构建必传参数
38 $params = Yohobuy::param(); 38 $params = Yohobuy::param();
@@ -68,4 +68,33 @@ class IndexData @@ -68,4 +68,33 @@ class IndexData
68 unset($param['v']); 68 unset($param['v']);
69 return Yohobuy::get(Yohobuy::API_URL, $param); 69 return Yohobuy::get(Yohobuy::API_URL, $param);
70 } 70 }
  71 +
  72 + /**
  73 + * 意见反馈
  74 + *
  75 + * @param int $feedback_id
  76 + * @param int $question_id
  77 + * @param string $answer
  78 + * @param int $solution
  79 + * @return array
  80 + */
  81 + public static function suggestFeedback($feedback_id, $question_id, $answer, $solution)
  82 + {
  83 + //TODO 走老接口
  84 + $param = Yohobuy::param();
  85 + $param['page'] = 1;
  86 + $param['open_key'] = '12345';
  87 + $param['method'] = 'open.feedback.submit';
  88 + $param['feedback_id'] = $feedback_id;
  89 + $param['question_id'] = $question_id;
  90 + $param['answer'] = $answer;
  91 + $param['solution'] = $solution;
  92 + unset($param['app_version']);
  93 + unset($param['client_type']);
  94 + unset($param['os_version']);
  95 + unset($param['screen_size']);
  96 + unset($param['v']);
  97 + return Yohobuy::get(Yohobuy::API_URL, $param);
  98 + }
  99 +
71 } 100 }
@@ -110,6 +110,7 @@ class HelperSearch @@ -110,6 +110,7 @@ class HelperSearch
110 */ 110 */
111 public static function getProductList($product,$imgSize) 111 public static function getProductList($product,$imgSize)
112 { 112 {
  113 + $params = self::$params;
113 $goods = array(); 114 $goods = array();
114 foreach($product as $key => $val){ 115 foreach($product as $key => $val){
115 //NEW 116 //NEW
@@ -125,6 +126,10 @@ class HelperSearch @@ -125,6 +126,10 @@ class HelperSearch
125 // 年中大促 126 // 年中大促
126 foreach($val['goods_list'] as $k => $v){ 127 foreach($val['goods_list'] as $k => $v){
127 $goods_list[$k]['url'] = Helpers::getUrlBySkc($val['product_id'], $v['goods_id'], $val['cn_alphabet']); 128 $goods_list[$k]['url'] = Helpers::getUrlBySkc($val['product_id'], $v['goods_id'], $val['cn_alphabet']);
  129 + //筛选符合颜色条件的封面图片
  130 + if (isset($params['color']) && $params['color'] == $v['color_id']) {
  131 + $val['default_images'] = Images::getImageUrl($v['images_url'],$imgSize[0],$imgSize[1]);
  132 + }
128 } 133 }
129 if (!empty($val['default_images'])) { 134 if (!empty($val['default_images'])) {
130 $val['default_images'] = Images::getImageUrl($val['default_images'],$imgSize[0],$imgSize[1]); 135 $val['default_images'] = Images::getImageUrl($val['default_images'],$imgSize[0],$imgSize[1]);
@@ -439,6 +444,10 @@ class HelperSearch @@ -439,6 +444,10 @@ class HelperSearch
439 if (self::checkSearch('brand')) { 444 if (self::checkSearch('brand')) {
440 return array(); 445 return array();
441 } 446 }
  447 + //品牌数量小于等于10,隐藏更多按钮
  448 + if (count($result['brandsShow']) < 11) {
  449 + $result['hideMore'] = true;
  450 + }
442 return $result; 451 return $result;
443 } 452 }
444 /** 453 /**
@@ -613,18 +622,18 @@ class HelperSearch @@ -613,18 +622,18 @@ class HelperSearch
613 } 622 }
614 $result = array(); 623 $result = array();
615 $style = $filter['style']; 624 $style = $filter['style'];
  625 + $styleNum = 0;
  626 + $styleName = '';
616 foreach ($style as $v) { 627 foreach ($style as $v) {
617 //选中的筛选条件 628 //选中的筛选条件
618 if (in_array($v['style_id'], $styleIds)) { 629 if (in_array($v['style_id'], $styleIds)) {
619 - $selectedStyle = explode(',', self::$params['style']);  
620 - $selectedKey = array_search($v['style_id'], $selectedStyle);  
621 - unset($selectedStyle[$selectedKey]);  
622 - $selectedParams = $params;  
623 - $selectedParams['style'] = implode(',', $selectedStyle);  
624 - self::$selected['style'][] = array(  
625 - 'name' => $v['style_name'],  
626 - 'href' => self::buildUrl($selectedParams)  
627 - ); 630 + if (!$styleNum) {
  631 + $styleName = $v['style_name']."";
  632 + }
  633 + elseif ($styleNum ===1){
  634 + $styleName .= substr($v['style_name'], 0, 3).'...';
  635 + }
  636 + $styleNum ++;
628 } 637 }
629 $selectedStyle = isset(self::$params['style']) && !empty(self::$params['style']) ? explode(',', self::$params['style']) : array(); 638 $selectedStyle = isset(self::$params['style']) && !empty(self::$params['style']) ? explode(',', self::$params['style']) : array();
630 //风格id在提交的参数中,构造url参数去除该风格id 639 //风格id在提交的参数中,构造url参数去除该风格id
@@ -648,9 +657,11 @@ class HelperSearch @@ -648,9 +657,11 @@ class HelperSearch
648 'href' => $url, 657 'href' => $url,
649 ); 658 );
650 } 659 }
651 - //搜索页已选中,返回空  
652 - if (self::checkSearch('style')) {  
653 - return array(); 660 + if (isset(self::$params['style']) && !empty(self::$params['style'])) {
  661 + self::$selected['style'] = array(
  662 + 'name' => rtrim($styleName, '、'),
  663 + 'href' => self::buildUrl($params)
  664 + );
654 } 665 }
655 $data[0] = array( 666 $data[0] = array(
656 'attr' => 'style', 667 'attr' => 'style',
@@ -668,6 +679,10 @@ class HelperSearch @@ -668,6 +679,10 @@ class HelperSearch
668 $style = self::style($filter); 679 $style = self::style($filter);
669 $other = self::standard($filter); 680 $other = self::standard($filter);
670 $result = array_merge($style,$other); 681 $result = array_merge($style,$other);
  682 + //搜索页已选中,返回空
  683 + if (self::checkSearch('style') || self::checkSearch('parameter')) {
  684 + return array();
  685 + }
671 return $result; 686 return $result;
672 } 687 }
673 688
@@ -926,7 +941,6 @@ class HelperSearch @@ -926,7 +941,6 @@ class HelperSearch
926 if ($data) { 941 if ($data) {
927 $result['conditions'] = $data; 942 $result['conditions'] = $data;
928 } 943 }
929 -// print_r($result); exit;  
930 return $result; 944 return $result;
931 } 945 }
932 946
@@ -992,7 +1006,7 @@ class HelperSearch @@ -992,7 +1006,7 @@ class HelperSearch
992 */ 1006 */
993 public static function current() 1007 public static function current()
994 { 1008 {
995 - $url = explode('?', $_SERVER['REQUEST_URI']); 1009 + $url = explode('?', 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
996 self::$listNav[0]['href'] = $url[0]; 1010 self::$listNav[0]['href'] = $url[0];
997 return $url[0]; 1011 return $url[0];
998 } 1012 }
@@ -1102,8 +1116,12 @@ class HelperSearch @@ -1102,8 +1116,12 @@ class HelperSearch
1102 1116
1103 public static function checkSearch($param) 1117 public static function checkSearch($param)
1104 { 1118 {
1105 - if (isset(self::$params[$param]) && isset(self::$options['controller']) && self::$options['controller'] == 'Search') {  
1106 - return true; 1119 + if (isset(self::$options['controller']) && self::$options['controller'] == 'Search') {
  1120 + foreach (self::$params as $key =>$val) {
  1121 + if (strpos($key, $param) !== false) {
  1122 + return true;
  1123 + }
  1124 + }
1107 } 1125 }
1108 1126
1109 } 1127 }
@@ -1354,7 +1372,9 @@ class HelperSearch @@ -1354,7 +1372,9 @@ class HelperSearch
1354 //清除选中 1372 //清除选中
1355 $result['checkedConditions']['clearUrl'] = self::current(); 1373 $result['checkedConditions']['clearUrl'] = self::current();
1356 //频道 1374 //频道
1357 - $result['channel'] = self::gender(self::$filter); 1375 + $result['channel'] = array();
  1376 + //性别
  1377 + $result['gender'] = self::gender(self::$filter);
1358 //品牌 1378 //品牌
1359 $result['brand'] = self::brand(self::$filter); 1379 $result['brand'] = self::brand(self::$filter);
1360 //价格 1380 //价格
@@ -35,13 +35,18 @@ module.exports = function(specificGender) { @@ -35,13 +35,18 @@ module.exports = function(specificGender) {
35 } else if (lifestyleType) { 35 } else if (lifestyleType) {
36 36
37 //有货币页面加载男生首页的数据 37 //有货币页面加载男生首页的数据
38 - url = specificGender ? '/product/recom/maylike?gender=1,3' : '/product/recom/maylikelife'; 38 + url = specificGender === 'lifestyle' ? '/product/recom/maylike?gender=1,3' : '/product/recom/maylikelife';
39 } else { 39 } else {
40 gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ? 40 gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ?
41 '1,3' : '2,3', 41 '1,3' : '2,3',
42 url = '/product/recom/maylike?gender=' + gender; 42 url = '/product/recom/maylike?gender=' + gender;
43 } 43 }
44 44
  45 + //以防cookie异常,强制加载男首
  46 + if (specificGender === 'boys') {
  47 + url = '/product/recom/maylike?gender=1,3';
  48 + }
  49 +
45 $curNav = $navList.children('.focus'); 50 $curNav = $navList.children('.focus');
46 51
47 if (lifestyleType) { 52 if (lifestyleType) {
@@ -345,28 +345,28 @@ class HomeModel @@ -345,28 +345,28 @@ class HomeModel
345 $build = array(); 345 $build = array();
346 switch (intval($value['channel_id'])) { 346 switch (intval($value['channel_id'])) {
347 case 1: 347 case 1:
348 - $build['href'] = Helpers::getFilterUrl($value['url']); 348 + $build['href'] = '/boys';
349 $build['title'] = '男生'; 349 $build['title'] = '男生';
350 $build['entitle'] = 'BOYS'; 350 $build['entitle'] = 'BOYS';
351 break; 351 break;
352 case 2: 352 case 2:
353 - $build['href'] = Helpers::getFilterUrl($value['url']); 353 + $build['href'] = '/girls';
354 $build['title'] = '女生'; 354 $build['title'] = '女生';
355 $build['entitle'] = 'GIRLS'; 355 $build['entitle'] = 'GIRLS';
356 break; 356 break;
357 case 3: 357 case 3:
358 - $build['href'] = Helpers::getFilterUrl($value['url']); 358 + $build['href'] = '/kids';
359 $build['title'] = '潮童'; 359 $build['title'] = '潮童';
360 $build['entitle'] = 'KIDS'; 360 $build['entitle'] = 'KIDS';
361 break; 361 break;
362 case 4: 362 case 4:
363 - $build['href'] = Helpers::getFilterUrl($value['url']); 363 + $build['href'] = '/lifestyle';
364 $build['title'] = '创意生活'; 364 $build['title'] = '创意生活';
365 $build['entitle'] = 'LIFESTYLE'; 365 $build['entitle'] = 'LIFESTYLE';
366 break; 366 break;
367 case 5: 367 case 5:
368 $result['showYohood'] = true; 368 $result['showYohood'] = true;
369 - $result['yohoodHref'] = Helpers::getFilterUrl($value['url']); 369 + $result['yohoodHref'] = 'http://yohood.cn';
370 break; 370 break;
371 default: 371 default:
372 continue; 372 continue;
@@ -139,4 +139,24 @@ class CommonController extends WebAction @@ -139,4 +139,24 @@ class CommonController extends WebAction
139 return $this->helpJsonCallbackResult($callback, 403, '订阅失败', ''); 139 return $this->helpJsonCallbackResult($callback, 403, '订阅失败', '');
140 } 140 }
141 } 141 }
  142 +
  143 + /**
  144 + * 意见反馈
  145 + *
  146 + * @return jsonp
  147 + */
  148 + public function suggestfeedbackAction()
  149 + {
  150 + $callback = $this->get('callback', '');
  151 + $feedback_id = intval($this->get('feedback_id', 0));
  152 + $question_id = intval($this->get('question_id', 0));
  153 + $answer = trim($this->get('answer'));
  154 + $solution = intval($this->get('solution', 0));
  155 + if(!empty($feedback_id) || !empty($question_id) || !empty($answer) || !empty($solution)) {
  156 + $data = IndexData::suggestFeedback($feedback_id, $question_id, $answer, $solution);
  157 + return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $data['data']);
  158 + } else {
  159 + return $this->helpJsonCallbackResult($callback, 403, '意见反馈失败', '');
  160 + }
  161 + }
142 } 162 }