更新
This commit is contained in:
parent
eca0f18501
commit
9097c77c41
@ -13,7 +13,7 @@ class SearchController extends BaseController
|
|||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$keyword = input('keyword', '');
|
$keyword = input('keyword', '');
|
||||||
$type = input('type', 'article'); // 搜索类型:article-文章,resource-资源
|
$type = input('type', 'articles'); // 搜索类型:article-文章,resource-资源
|
||||||
$page = input('page', 1);
|
$page = input('page', 1);
|
||||||
$limit = input('limit', 10);
|
$limit = input('limit', 10);
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ class SearchController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 根据类型选择对应的表和分类表
|
// 根据类型选择对应的表和分类表
|
||||||
if ($type == 'article') {
|
if ($type == 'articles') {
|
||||||
$model = new Articles();
|
$model = new Articles();
|
||||||
$categoryModel = new ArticlesCategory();
|
$categoryModel = new ArticlesCategory();
|
||||||
$detailUrl = '/index/articles/detail';
|
$detailUrl = '/index/articles/detail';
|
||||||
@ -55,7 +55,7 @@ class SearchController extends BaseController
|
|||||||
|
|
||||||
// 获取分类名称和图片
|
// 获取分类名称和图片
|
||||||
foreach ($items as &$item) {
|
foreach ($items as &$item) {
|
||||||
if ($type == 'article') {
|
if ($type == 'articles') {
|
||||||
$category = $categoryModel->where('id', $item['cate'])
|
$category = $categoryModel->where('id', $item['cate'])
|
||||||
->field('id, name, image')
|
->field('id, name, image')
|
||||||
->find();
|
->find();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user