Authored by whb

搜索api配置

... ... @@ -72,6 +72,12 @@ class Bootstrap extends Bootstrap_Abstract
$action = 'Index';
// 二级域名
if (2 === $level) {
$url = strtolower($dispatcher->getRequest()->getRequestUri());
if(empty($url) || $url == '/index' || $url == '/') {
$urlAction = '/index';
} else {
$urlAction = $url;
}
$subDomain = strval($hostParts[0]);
switch (strtolower($subDomain)) {
case 'www': // 主站
... ... @@ -80,17 +86,18 @@ class Bootstrap extends Bootstrap_Abstract
case 'web':
break;
case 'search': // 搜索
$searchRequest = new Yaf\Request\Http('/product/search/index');
$dispatcher->setRequest($searchRequest);
if($urlAction == '/index') {
$searchRequest = new Yaf\Request\Http('/product/search/index');
$dispatcher->setRequest($searchRequest);
}
break;
case 'guang': // 逛
$module = 'Guang';
break;
case 'list': // 商品列表
$module = 'Product';
$url = strtolower($dispatcher->getRequest()->getRequestUri());
//list列表的index
if(empty($url) || $url == '/index' || $url == '/') {
if($urlAction == '/index') {
$listRequest = new Yaf\Request\Http('/product/list/index');
$dispatcher->setRequest($listRequest);
}
... ...
... ... @@ -18,3 +18,10 @@ routes.productgetProductPic.match = "/getProductPic"
routes.productgetProductPic.route.module = Product
routes.productgetProductPic.route.controller = List
routes.productgetProductPic.route.action = getProductPic
;api(search api suggest)
routes.searchsuggest.type = "rewrite"
routes.searchsuggest.match = "/api/suggest"
routes.searchsuggest.route.module = Product
routes.searchsuggest.route.controller = Search
routes.searchsuggest.route.action = suggest
... ...