Search.php
2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
use Action\AbstractAction;
use LibModels\Wap\Product\SearchData;
/**
* 搜索页
*/
class SearchController extends AbstractAction
{
public function indexAction()
{
$data = array(
array(
'hot' => array(
array(
'name' => '夹克',
'url' => 'm.yohobuy.com'
),
array(
'name' => '休闲运动鞋',
'url' => 'm.yohobuy.com'
),
array(
'name' => 'Into the Rainbow',
'url' => 'm.yohobuy.com'
)
),
'history' => array(
array(
'name' => 'what',
'url' => 'm.yohobuy.com'
),
array(
'name' => 'the',
'url' => 'm.yohobuy.com'
),
array(
'name' => 'fuck',
'url' => 'm.yohobuy.com'
)
)
)
);
$this->_view->display('index', array('search' => $data, 'searchPage' => true, 'pageFooter' => true));
}
/**
* 模糊搜索指定字符
*
* @return array 模糊搜索的结果
*/
public function fuzzysearch()
{
if($this->isAjax())
{
$keyword = $this->post('keyword', '');
$result = SearchData::searchFuzzyDatas($keyword);
$this->_view->display('list', array('searchPage' => true, 'pageFooter' => true));
}
}
/**
* 根据指定字符串查询数据
*
* @return array 搜索的结果
*/
public function listsearch()
{
$query = $this->get('query', '');
$result = SearchData::searchLiDatas($query);
$this->echoJson($result);
}
/**
* 根据指定条件筛选查询到数据
*
* @return array 筛选之后的结果
*/
public function sortsearch()
{
if($this->isAjax())
{
$query = $this->post('query', '');
$result = SearchData::searchLiDatas($query);
$this->echoJson($result);
}
}
}