提交 d643212c authored 作者: 邓奇's avatar 邓奇

搜索页面处理

上级 99341240
......@@ -468,11 +468,7 @@ class IndexController extends Controller
public function site_search(Request $request)
{
$search = $request->search;
if( empty($search) ){
$result = array('msg' => '请输入搜索关键字!','code'=>400);
return response()->json($result);
}
if( $search || $search == '0' ){
//产品搜索
$product = new Pack();
$packs = $product->where('title',$search )->orWhere('title','like','%'.$search.'%')->orderBy('add_time','desc')->get();
......@@ -494,12 +490,17 @@ class IndexController extends Controller
// 'packs'=>$packs,'packs_num'=>$packs_num,'videos'=>$videos,'videos_num'=>$videos_num,
// 'news'=>$news,'news_num'=>$news_num,'infomations'=>$infomations,'infomations_num'=>$infomations_num
//];
$total_num = intval($packs_num + $videos_num + $news_num + $infomations_num);
return view('index.index_search',[
'packs'=>$packs,'packs_num'=>$packs_num,'videos'=>$videos,'videos_num'=>$videos_num,
'news'=>$news,'news_num'=>$news_num,'infomations'=>$infomations,'infomations_num'=>$infomations_num,
'showType'=>$this->showType,'showType_b'=>$this->showType_b
'total_num'=>$total_num,'showType'=>$this->showType,'showType_b'=>$this->showType_b
]);
}else{
return view('index.index_search',[
'msg' => '搜索内容不能为空!','showType'=>$this->showType,'showType_b'=>$this->showType_b
]);
}
}
......
......@@ -5,7 +5,7 @@
</div>
<header class="am-show-lg-only pc_header" id="head-navbar" >
<div class="width1400 am-cf">
<div class="logo am-fl"><img src="{{asset('msk/img/logo.png')}}"></div>
<div class="logo am-fl"><a href="/"><img src="{{asset('msk/img/logo.png')}}"></a></div>
<form action="{{url('search')}}" method="get">
<div class="search am-fr">
<input name="search" type="text" placeholder="请输入关键字">
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论