Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
msk
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
邓奇
msk
Commits
d643212c
提交
d643212c
authored
5月 25, 2020
作者:
邓奇
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
搜索页面处理
上级
99341240
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
33 行增加
和
32 行删除
+33
-32
IndexController.php
app/Http/Controllers/IndexController.php
+32
-31
index_search.blade.php
resources/views/index/index_search.blade.php
+0
-0
top.blade.php
resources/views/layout/top.blade.php
+1
-1
没有找到文件。
app/Http/Controllers/IndexController.php
浏览文件 @
d643212c
...
@@ -468,38 +468,39 @@ class IndexController extends Controller
...
@@ -468,38 +468,39 @@ class IndexController extends Controller
public
function
site_search
(
Request
$request
)
public
function
site_search
(
Request
$request
)
{
{
$search
=
$request
->
search
;
$search
=
$request
->
search
;
if
(
empty
(
$search
)
){
if
(
$search
||
$search
==
'0'
){
$result
=
array
(
'msg'
=>
'请输入搜索关键字!'
,
'code'
=>
400
);
//产品搜索
return
response
()
->
json
(
$result
);
$product
=
new
Pack
();
$packs
=
$product
->
where
(
'title'
,
$search
)
->
orWhere
(
'title'
,
'like'
,
'%'
.
$search
.
'%'
)
->
orderBy
(
'add_time'
,
'desc'
)
->
get
();
$packs_num
=
$product
->
where
(
'title'
,
$search
)
->
orWhere
(
'title'
,
'like'
,
'%'
.
$search
.
'%'
)
->
orderBy
(
'add_time'
,
'desc'
)
->
count
();
//视频
$content
=
new
Content
();
$videos
=
$content
->
getContentListByTypeId
(
20
,
$search
);
$videos_num
=
$content
->
countContentListByTypeId
(
20
,
$search
);
//新闻
$news
=
$content
->
getContentListByTypeId
(
21
,
$search
);
$news_num
=
$content
->
countContentListByTypeId
(
21
,
$search
);
//媒体资讯
$infomations
=
$content
->
getContentListByTypeId
(
33
,
$search
);
$infomations_num
=
$content
->
countContentListByTypeId
(
33
,
$search
);
//$a = [
// '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
,
'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
]);
}
}
//产品搜索
$product
=
new
Pack
();
$packs
=
$product
->
where
(
'title'
,
$search
)
->
orWhere
(
'title'
,
'like'
,
'%'
.
$search
.
'%'
)
->
orderBy
(
'add_time'
,
'desc'
)
->
get
();
$packs_num
=
$product
->
where
(
'title'
,
$search
)
->
orWhere
(
'title'
,
'like'
,
'%'
.
$search
.
'%'
)
->
orderBy
(
'add_time'
,
'desc'
)
->
count
();
//视频
$content
=
new
Content
();
$videos
=
$content
->
getContentListByTypeId
(
20
,
$search
);
$videos_num
=
$content
->
countContentListByTypeId
(
20
,
$search
);
//新闻
$news
=
$content
->
getContentListByTypeId
(
21
,
$search
);
$news_num
=
$content
->
countContentListByTypeId
(
21
,
$search
);
//媒体资讯
$infomations
=
$content
->
getContentListByTypeId
(
33
,
$search
);
$infomations_num
=
$content
->
countContentListByTypeId
(
33
,
$search
);
//$a = [
// 'packs'=>$packs,'packs_num'=>$packs_num,'videos'=>$videos,'videos_num'=>$videos_num,
// 'news'=>$news,'news_num'=>$news_num,'infomations'=>$infomations,'infomations_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
]);
}
}
...
...
resources/views/index/index_search.blade.php
浏览文件 @
d643212c
差异被折叠。
点击展开。
resources/views/layout/top.blade.php
浏览文件 @
d643212c
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
</div>
</div>
<header
class=
"am-show-lg-only pc_header"
id=
"head-navbar"
>
<header
class=
"am-show-lg-only pc_header"
id=
"head-navbar"
>
<div
class=
"width1400 am-cf"
>
<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"
>
<form
action=
"{{url('search')}}"
method=
"get"
>
<div
class=
"search am-fr"
>
<div
class=
"search am-fr"
>
<input
name=
"search"
type=
"text"
placeholder=
"请输入关键字"
>
<input
name=
"search"
type=
"text"
placeholder=
"请输入关键字"
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论