diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index e99187b..1f7dc71 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -69,7 +69,7 @@ class Article extends BaseController //通用右栏 $ad_comm = Db::name('slider')->where('slid_status',1)->where('delete_time',0)->where('slid_type',2)->whereTime('slid_over','>=',time())->select(); - View::assign(['type'=>$type,'artList'=>$artList,'artHot'=>$artHot,'ad_cate'=>$ad_cate,'ad_comm'=>$ad_comm]); + View::assign(['type'=>$type,'artList'=>$artList,'artHot'=>$artHot,'ad_cate'=>$ad_cate,'ad_comm'=>$ad_comm,'jspage'=>'jie']); return View::fetch(); } @@ -112,7 +112,7 @@ class Article extends BaseController //通用右栏 $ad_comm = Db::name('slider')->where('slid_status',1)->where('delete_time',0)->where('slid_type',2)->whereTime('slid_over','>=',time())->select(); - View::assign(['article'=>$artDetail,'pv'=>$pv,'comments'=>$comments,'artHot'=>$artHot,'ad_art'=>$ad_article,'ad_comm'=>$ad_comm,$download]); + View::assign(['article'=>$artDetail,'pv'=>$pv,'comments'=>$comments,'artHot'=>$artHot,'ad_art'=>$ad_article,'ad_comm'=>$ad_comm,$download,'jspage'=>'jie']); return View::fetch(); } @@ -178,6 +178,7 @@ class Article extends BaseController } return $res; } + View::assign(['jspage'=>'jie']); return View::fetch(); } @@ -223,7 +224,7 @@ class Article extends BaseController } } - View::assign(['article'=>$article,'tags'=>$tags]); + View::assign(['article'=>$article,'tags'=>$tags,'jspage'=>'jie']); return View::fetch(); } diff --git a/app/index/controller/Doc.php b/app/index/controller/Doc.php new file mode 100644 index 0000000..2d2b23f --- /dev/null +++ b/app/index/controller/Doc.php @@ -0,0 +1,70 @@ +where('slid_status',1)->where('delete_time',0)->where('slid_type',1)->whereTime('slid_over','>=',time())->select(); + Cache::set('slider',$sliders,3600); + } + + //更新日志 + $timeline = Db::name('time_line')->where('delete_time',0)->order('create_time','desc')->select(); + + //热议文章 + $artHot = Article::field('id,title')->withCount('comments')->where(['status'=>1,'delete_time'=>0])->whereTime('create_time', 'year')->order('comments_count','desc')->limit(10)->select(); + + //首页赞助 + $ad_index = Cache::get('adindex'); + if(!$ad_index){ + $ad_index = Db::name('slider')->where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>3])->whereTime('slid_over','>=',time())->select(); + Cache::set('adindex',$ad_index,3600); + } + + //首页右栏 + $ad_comm = Cache::get('adcomm'); + if(!$ad_comm){ + $ad_comm = Db::name('slider')->where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>2])->whereTime('slid_over','>=',time())->select(); + Cache::set('adcomm',$ad_comm,3600); + } + + //友情链接 + $friend_links = Cache::get('flinks'); + if(!$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(); + Cache::set('flinks',$friend_links,3600); + } + + $vs = [ + 'slider' => $sliders, + 'timeline' => $timeline, + 'artHot' => $artHot, + 'type' => $types, + 'ad_index' => $ad_index, + 'ad_comm' => $ad_comm, + 'flinks' => $friend_links, + 'jspage' => '', + ]; + View::assign($vs); + + return View::fetch(); + } + +} diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index 264a507..953510c 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -64,6 +64,7 @@ class Index extends BaseController 'ad_index' => $ad_index, 'ad_comm' => $ad_comm, 'flinks' => $friend_links, + 'jspage' => '', ]; View::assign($vs); @@ -98,7 +99,7 @@ class Index extends BaseController $artHot = Article::getArtHot(10); View::assign($searchs); - View::assign(['flinks'=>$friend_links,'artHot'=>$artHot]); + View::assign(['flinks'=>$friend_links,'artHot'=>$artHot,'jspage'=>'']); return View::fetch('search'); } diff --git a/app/index/controller/Login.php b/app/index/controller/Login.php index 9b0867a..7a1e9b4 100644 --- a/app/index/controller/Login.php +++ b/app/index/controller/Login.php @@ -13,13 +13,19 @@ use think\facade\Cache; use think\facade\View; use app\common\model\User; - class Login extends BaseController { - //已登陆检测 + //已登陆中间件检测 protected $middleware = [ 'logedcheck' => ['except' => ['index'] ] ]; + + //给模板中JScace文件赋值 + protected function initialize() + { + parent::initialize(); + View::assign(['jspage'=>'user']); + } //用户登陆 public function index() @@ -75,6 +81,7 @@ class Login extends BaseController return Msgres::error($res); } } + return View::fetch('login'); } @@ -103,7 +110,6 @@ class Login extends BaseController } return json($res); } - //加载注册模板 return View::fetch(); } diff --git a/view/taoler/index/article/add.html b/view/taoler/index/article/add.html index 6d5c845..0762dcc 100644 --- a/view/taoler/index/article/add.html +++ b/view/taoler/index/article/add.html @@ -1,4 +1,5 @@ {extend name="public/base" /} + {block name="title"}发表帖子{/block} {block name="column"}{/block} {block name="content"} @@ -141,20 +142,7 @@ }); -{/block} -{block name="cachepage"}jie{/block} \ No newline at end of file +{/block} \ No newline at end of file diff --git a/view/taoler/index/article/cate.html b/view/taoler/index/article/cate.html index 9d53233..f0e3146 100644 --- a/view/taoler/index/article/cate.html +++ b/view/taoler/index/article/cate.html @@ -97,20 +97,7 @@ {/block} {block name="script"} - - {/block} \ No newline at end of file diff --git a/view/taoler/index/index/index.html b/view/taoler/index/index/index.html index 1885dd1..d991cf4 100644 --- a/view/taoler/index/index/index.html +++ b/view/taoler/index/index/index.html @@ -101,6 +101,7 @@ {block name="script"} - {/block} \ No newline at end of file diff --git a/view/taoler/index/index/search.html b/view/taoler/index/index/search.html index 3f602b1..828aa56 100644 --- a/view/taoler/index/index/search.html +++ b/view/taoler/index/index/search.html @@ -1,9 +1,7 @@ {extend name="public/base" /} -{block name="title"} -TP5学习制作:Tao.2019 -{/block} +{block name="title"}{$sysInfo.webname}{$keywords}搜索内容{/block} {block name="column"} {include file="/public/column" /} @@ -14,21 +12,16 @@ TP5学习制作:Tao.2019