Authored by 梁志锋

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

@@ -1157,7 +1157,6 @@ class HelperSearch @@ -1157,7 +1157,6 @@ class HelperSearch
1157 'activities_id_desc' => 'activities.activity_id:desc', 1157 'activities_id_desc' => 'activities.activity_id:desc',
1158 'activities_id_asc' => 'activities.activity_id:asc', 1158 'activities_id_asc' => 'activities.activity_id:asc',
1159 ); 1159 );
1160 -  
1161 $param = array(); 1160 $param = array();
1162 $param['status'] = 1; // 是否上架,1表示在架,2表示不在 1161 $param['status'] = 1; // 是否上架,1表示在架,2表示不在
1163 $param['sales'] = 'Y'; // 只搜索销售的产品 1162 $param['sales'] = 'Y'; // 只搜索销售的产品
@@ -1182,7 +1181,6 @@ class HelperSearch @@ -1182,7 +1181,6 @@ class HelperSearch
1182 if (!empty($condition)) { 1181 if (!empty($condition)) {
1183 $param += $condition; 1182 $param += $condition;
1184 } 1183 }
1185 -  
1186 return Yohobuy::httpBuildQuery(self::getUrl(), $param); 1184 return Yohobuy::httpBuildQuery(self::getUrl(), $param);
1187 } 1185 }
1188 1186
@@ -1312,8 +1310,8 @@ class HelperSearch @@ -1312,8 +1310,8 @@ class HelperSearch
1312 elseif ($type == 'shop') { 1310 elseif ($type == 'shop') {
1313 return 'http://101.200.31.165/yohosearch/shops.json'; 1311 return 'http://101.200.31.165/yohosearch/shops.json';
1314 } 1312 }
1315 - return 'http://101.200.31.165/yohosearch/search.json';  
1316 -// return 'http://192.168.10.64:8080/yohosearch/search-once.json'; 1313 +// return 'http://101.200.31.165/yohosearch/search.json';
  1314 + return 'http://192.168.10.64:8080/yohosearch/search-once.json';
1317 } 1315 }
1318 } 1316 }
1319 1317
@@ -1050,28 +1050,34 @@ function actionNav() { @@ -1050,28 +1050,34 @@ function actionNav() {
1050 }); 1050 });
1051 } 1051 }
1052 1052
  1053 +/**
  1054 + * 获取三级导航的tip图标
  1055 + * @return {[type]} [description]
  1056 + */
1053 function actionTipPic() { 1057 function actionTipPic() {
1054 - var $content_code = '' 1058 + var tipscode = {};
  1059 + var $contentcode = '';
1055 var serverApi = 'http://www.yohobuy.com/common/getbanner?content_code='; 1060 var serverApi = 'http://www.yohobuy.com/common/getbanner?content_code=';
1056 var $img = ''; 1061 var $img = '';
1057 var $title = ''; 1062 var $title = '';
1058 var $link = ''; 1063 var $link = '';
1059 1064
1060 - $(document).on('mouseenter','.sub-nav-item',function(){  
1061 - $content_code = $(this).find('.showdetail').attr('data-code');  
1062 - if($content_code){ 1065 + $(document).on('mouseenter', '.sub-nav-item', function() {
  1066 + $contentcode = $(this).find('.showdetail').attr('data-code');
  1067 + if ($contentcode) {
  1068 + if (!tipscode[$contentcode]) {
  1069 + tipscode[$contentcode] = $contentcode;
1063 $img = $(this).find('.showdetail').find('img'); 1070 $img = $(this).find('.showdetail').find('img');
1064 $title = $(this).find('.showdetail').find('.title'); 1071 $title = $(this).find('.showdetail').find('.title');
1065 $link = $(this).find('.showdetail').find('a'); 1072 $link = $(this).find('.showdetail').find('a');
1066 - $.get(serverApi + $content_code+'&width=337&height=250&client_type=web', function(rsdata) {  
1067 - $img.attr('src',rsdata.data.src);  
1068 - $link.attr('href',rsdata.data.url); 1073 + $.get(serverApi + $contentcode + '&width=337&height=250&client_type=web', function(rsdata) {
  1074 + $img.attr('src', rsdata.data.src);
  1075 + $link.attr('href', rsdata.data.url);
1069 $title.text(rsdata.data.title); 1076 $title.text(rsdata.data.title);
1070 }, 'jsonp'); 1077 }, 'jsonp');
1071 } 1078 }
1072 -  
1073 - })  
1074 - 1079 + }
  1080 + });
1075 } 1081 }
1076 1082
1077 /** 1083 /**
@@ -1678,7 +1684,7 @@ function actionLoginInfo() { @@ -1678,7 +1684,7 @@ function actionLoginInfo() {
1678 */ 1684 */
1679 function init() { 1685 function init() {
1680 actionNav(); //处理导航 1686 actionNav(); //处理导航
1681 - actionTipPic();//鼠标移入后查询 1687 + actionTipPic(); //鼠标移入后查询
1682 actionExeTemplate(); //处理模板 1688 actionExeTemplate(); //处理模板
1683 actionInitCookie(); //初始化cookie 1689 actionInitCookie(); //初始化cookie
1684 actionExeCookieMap(); //格式化cookie 1690 actionExeCookieMap(); //格式化cookie
This diff could not be displayed because it is too large.
@@ -72,6 +72,12 @@ class Bootstrap extends Bootstrap_Abstract @@ -72,6 +72,12 @@ class Bootstrap extends Bootstrap_Abstract
72 $action = 'Index'; 72 $action = 'Index';
73 // 二级域名 73 // 二级域名
74 if (2 === $level) { 74 if (2 === $level) {
  75 + $url = strtolower($dispatcher->getRequest()->getRequestUri());
  76 + if(empty($url) || $url == '/index' || $url == '/') {
  77 + $urlAction = '/index';
  78 + } else {
  79 + $urlAction = $url;
  80 + }
75 $subDomain = strval($hostParts[0]); 81 $subDomain = strval($hostParts[0]);
76 switch (strtolower($subDomain)) { 82 switch (strtolower($subDomain)) {
77 case 'www': // 主站 83 case 'www': // 主站
@@ -80,17 +86,18 @@ class Bootstrap extends Bootstrap_Abstract @@ -80,17 +86,18 @@ class Bootstrap extends Bootstrap_Abstract
80 case 'web': 86 case 'web':
81 break; 87 break;
82 case 'search': // 搜索 88 case 'search': // 搜索
  89 + if($urlAction == '/index') {
83 $searchRequest = new Yaf\Request\Http('/product/search/index'); 90 $searchRequest = new Yaf\Request\Http('/product/search/index');
84 $dispatcher->setRequest($searchRequest); 91 $dispatcher->setRequest($searchRequest);
  92 + }
85 break; 93 break;
86 case 'guang': // 逛 94 case 'guang': // 逛
87 $module = 'Guang'; 95 $module = 'Guang';
88 break; 96 break;
89 case 'list': // 商品列表 97 case 'list': // 商品列表
90 $module = 'Product'; 98 $module = 'Product';
91 - $url = strtolower($dispatcher->getRequest()->getRequestUri());  
92 //list列表的index 99 //list列表的index
93 - if(empty($url) || $url == '/index' || $url == '/') { 100 + if($urlAction == '/index') {
94 $listRequest = new Yaf\Request\Http('/product/list/index'); 101 $listRequest = new Yaf\Request\Http('/product/list/index');
95 $dispatcher->setRequest($listRequest); 102 $dispatcher->setRequest($listRequest);
96 } 103 }
@@ -110,7 +110,7 @@ class SearchModel @@ -110,7 +110,7 @@ class SearchModel
110 ); 110 );
111 //接收高级选项 111 //接收高级选项
112 foreach ($_GET as $key =>$val) { 112 foreach ($_GET as $key =>$val) {
113 - if (strpos('parameter_',$key) !== false) { 113 + if (strpos($key, 'parameter_') !== false) {
114 $condition[$key] = (int) $val; 114 $condition[$key] = (int) $val;
115 } 115 }
116 } 116 }
@@ -129,7 +129,6 @@ class SearchModel @@ -129,7 +129,6 @@ class SearchModel
129 $data['condition'] = $condition; 129 $data['condition'] = $condition;
130 $data['sortCondition'] = $sortCondition; 130 $data['sortCondition'] = $sortCondition;
131 $data['options'] = $options; 131 $data['options'] = $options;
132 -  
133 return $data; 132 return $data;
134 } 133 }
135 134
@@ -221,7 +220,7 @@ class SearchModel @@ -221,7 +220,7 @@ class SearchModel
221 $data .= '<li><a style="display: block;" href="http://search.yohobuy.com/?query='.$v['item'].'" class="clearfix clear search-item" title="'.$v['item'].'" act="http://search.yohobuy.com/?query='.$v['item'].'"><span class="searchvalue" >'.$v['item'].'</span><span class="valuenum">约'.$v['frequency'].'个商品</span></a></li>'; 220 $data .= '<li><a style="display: block;" href="http://search.yohobuy.com/?query='.$v['item'].'" class="clearfix clear search-item" title="'.$v['item'].'" act="http://search.yohobuy.com/?query='.$v['item'].'"><span class="searchvalue" >'.$v['item'].'</span><span class="valuenum">约'.$v['frequency'].'个商品</span></a></li>';
222 } 221 }
223 } 222 }
224 - echo $data; 223 + return $data;
225 } 224 }
226 225
227 /** 226 /**
@@ -49,10 +49,7 @@ class ListController extends WebAction @@ -49,10 +49,7 @@ class ListController extends WebAction
49 */ 49 */
50 public function saleAction() 50 public function saleAction()
51 { 51 {
52 - //排序  
53 - $condition['order'] = 's_n_desc';  
54 - //打折  
55 - $condition['p_d'] = '0,0.9'; 52 + $condition = array();
56 $list = SearchModel::getListData($condition); 53 $list = SearchModel::getListData($condition);
57 $data = array( 54 $data = array(
58 //初始化js 55 //初始化js
@@ -21,11 +21,13 @@ class SearchController extends WebAction @@ -21,11 +21,13 @@ class SearchController extends WebAction
21 */ 21 */
22 public function suggestAction() 22 public function suggestAction()
23 { 23 {
  24 + $suggest = '';
24 $query = rawurldecode($this->get('query')); 25 $query = rawurldecode($this->get('query'));
25 if ($query) { 26 if ($query) {
26 $param['query'] = $query; 27 $param['query'] = $query;
27 - SearchModel::getSuggest($param); 28 + $suggest = SearchModel::getSuggest($param);
28 } 29 }
  30 + echo $suggest;
29 } 31 }
30 32
31 /** 33 /**
@@ -35,7 +37,6 @@ class SearchController extends WebAction @@ -35,7 +37,6 @@ class SearchController extends WebAction
35 { 37 {
36 $condition['msort'] = $this->get('msort'); 38 $condition['msort'] = $this->get('msort');
37 $size = SearchModel::getSortSize($condition); 39 $size = SearchModel::getSortSize($condition);
38 - print_r($size); exit;  
39 $this->echoJson($size); 40 $this->echoJson($size);
40 } 41 }
41 } 42 }
@@ -18,3 +18,10 @@ routes.productgetProductPic.match = "/getProductPic" @@ -18,3 +18,10 @@ routes.productgetProductPic.match = "/getProductPic"
18 routes.productgetProductPic.route.module = Product 18 routes.productgetProductPic.route.module = Product
19 routes.productgetProductPic.route.controller = List 19 routes.productgetProductPic.route.controller = List
20 routes.productgetProductPic.route.action = getProductPic 20 routes.productgetProductPic.route.action = getProductPic
  21 +
  22 +;api(search api suggest)
  23 +routes.searchsuggest.type = "rewrite"
  24 +routes.searchsuggest.match = "/api/suggest"
  25 +routes.searchsuggest.route.module = Product
  26 +routes.searchsuggest.route.controller = Search
  27 +routes.searchsuggest.route.action = suggest