This commit is contained in:
zhao 2020-02-27 20:27:55 +08:00
parent b742da3ebb
commit 94f8d20a1e
5 changed files with 61 additions and 43 deletions

View File

@ -100,30 +100,30 @@ class Index extends BaseController
$map[] = ['status','=',1]; //这里等号不能省略
//实现搜索功能
$keywords = input('keywords');
if(!empty($keywords)){
$keywords = Request::only(['keywords']);
//var_dump($keywords['keywords']);
if(!empty($keywords['keywords'])){
//条件2
$map[] = ['title','like','%'.$keywords.'%'];
$map[] = ['title','like','%'.$keywords['keywords'].'%'];
$artList = Article::where($map)->withCount('comments')->order('create_time','desc')->paginate(10);
$counts = $artList->count();
$searchs = [
'artList' => $artList,
'keywords' => $keywords,
'keywords' => $keywords['keywords'],
'counts' => $counts
];
];
} else {
return response('输入非法');
}
View::assign($searchs);
//友情链接
$friend_links = Db::name('friend_link')->field('linkname,linksrc')->select();
View::assign('flinks',$friend_links);
//友情链接
$friend_links = Db::name('slider')->where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>6])->whereTime('slid_over','>=',time())->field('slid_name,slid_href')->select();
// 查询热议
$artHot = Article::withCount('comments')->field('title,comments_count')->where('status',1)->whereTime('create_time', 'year')->order('comments_count','desc')->limit(10)->select();
View::assign('artHot',$artHot);
} else{
return '请输入关键词';
}
View::assign(['flinks'=>$friend_links,'artHot'=>$artHot]);
return View::fetch('search');
}

View File

@ -92,7 +92,6 @@
</div>
</div>
</div>
{/block}
{block name="script"}
<script>
@ -111,4 +110,18 @@
fly: 'index'
}).use('fly');
</script>
<script>
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
{/block}

View File

@ -264,7 +264,6 @@ $(function() {
});
});
</script>
<script>
layui.cache.page = 'jie';
layui.cache.user = {
@ -290,4 +289,18 @@ layui.config({
});
});
</script>
<script>
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
{/block}

View File

@ -211,7 +211,6 @@
{/block}
{block name="script"}
<script>
layui.use(['form', 'layer'], function() {
var layer = layui.layer;
@ -335,7 +334,6 @@
});
</script>
<script>
layui.cache.page = 'index';
layui.cache.user = {
@ -352,4 +350,18 @@
fly: 'index'
}).use('fly');
</script>
<script>
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script>
{/block}

View File

@ -67,19 +67,19 @@ TP5学习制作Tao.2019
<div class="layui-row fly-panel-main" style="padding: 15px;">
<div class="layui-clear fly-list-quick">
<div class="layui-col-xs6">
<div><a href="#" target="_blank"> 组件平台 </a></div>
<div><a href="https://gitee.com/toogee/TaoLer/repository/archive/master.zip" target="_blank"> 程序下载 </a></div>
</div>
<div class="layui-col-xs6">
<div><a href="#" target="_blank"> 年度案例 </a></div>
<div><a href="http://www.aieok.com/index/jie/25.html" target="_blank"> 应用说明 </a></div>
</div>
<div class="layui-col-xs6">
<div><a href="#" target="_blank"> 精贴集锦 </a></div>
<div><a href="#" target="_blank"> 申请Key </a></div>
</div>
<div class="layui-col-xs6">
<div><a href="#" target="_blank"> Git 仓库 </a></div>
<div><a href="https://gitee.com/toogee/TaoLer" target="_blank"> Git 仓库 </a></div>
</div>
<div class="layui-col-xs6">
<div><a href="#" target="_blank"> 模板 </a></div>
<div><a href="#" target="_blank"> 模板 </a></div>
</div>
<div class="layui-col-xs6">
<div><a href="#" target="_blank"> 关于积分 </a></div>
@ -88,26 +88,6 @@ TP5学习制作Tao.2019
</div>
</div>
<div class="fly-panel fly-signin">
<div class="fly-panel-title">
签到
<i class="fly-mid"></i>
<a href="javascript:;" class="fly-link" id="LAY_signinHelp">说明</a>
<i class="fly-mid"></i>
<a href="javascript:;" class="fly-link" id="LAY_signinTop">活跃榜<span class="layui-badge-dot"></span></a>
<span class="fly-signin-days">已连续签到<cite>16</cite></span>
</div>
<div class="fly-panel-main fly-signin-main">
<button class="layui-btn layui-btn-danger" id="LAY_signin">今日签到</button>
<span>可获得<cite>5</cite>飞吻</span>
<!-- 已签到状态 -->
<!--
<button class="layui-btn layui-btn-disabled">今日已签到</button>
<span>获得了<cite>20</cite>飞吻</span>
-->
</div>
</div>
<div class="fly-panel fly-rank fly-rank-reply" id="LAY_replyRank">
<h3 class="fly-panel-title">回贴周榜</h3>