diff --git a/app/admin/controller/Slider.php b/app/admin/controller/Slider.php index ff80124..d1b8a77 100644 --- a/app/admin/controller/Slider.php +++ b/app/admin/controller/Slider.php @@ -7,7 +7,7 @@ use think\facade\Db; use think\facade\Request; use think\facade\Config; use think\exception\ValidateException; -use app\admin\model\Slider as SliderModel; +use app\common\model\Slider as SliderModel; class Slider extends AdminController { diff --git a/app/admin/view/slider/add.html b/app/admin/view/slider/add.html index b072360..ec76771 100644 --- a/app/admin/view/slider/add.html +++ b/app/admin/view/slider/add.html @@ -8,16 +8,18 @@
@@ -26,42 +28,41 @@
- -
- -
- -
-
-
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
- +
- +
+ +
+ +
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
diff --git a/app/admin/view/slider/edit.html b/app/admin/view/slider/edit.html index 178617f..638a256 100644 --- a/app/admin/view/slider/edit.html +++ b/app/admin/view/slider/edit.html @@ -1,7 +1,6 @@ {extend name="public/base" /} {block name="body"} -
@@ -9,14 +8,16 @@
@@ -26,6 +27,13 @@
+
+ +
+ +
+ +
@@ -35,32 +43,24 @@
-
- -
- -
-
-
- -
- -
-
-
- -
- +
+ +
+ +
+
+
+ +
+ +
- -
-
diff --git a/app/admin/view/slider/index.html b/app/admin/view/slider/index.html index d8415c3..4a1dbbd 100644 --- a/app/admin/view/slider/index.html +++ b/app/admin/view/slider/index.html @@ -5,7 +5,6 @@
-
首页幻灯
@@ -18,7 +17,7 @@ ID 名称 - 图片 + 图片/icon 位置 路径 颜色 @@ -79,7 +78,7 @@ $('#slid-add').on('click', function(){ layer.open({ type: 2, - title: '添加广告', + title: '添加链接', content: 'add.html', maxmin: true, area : ['460px' , '530px'], @@ -92,7 +91,6 @@ //监听提交 iframeWindow.layui.form.on('submit('+ submitID +')', function(data){ var field = data.field; //获取提交的字段 - //console.log(field); //提交 Ajax 成功后,静态更新表格中的数据 $.ajax({ @@ -129,10 +127,10 @@ var id = $(this).attr('id-data'); layer.open({ type: 2, - title: '编辑幻灯', + title: '编辑链接', content: 'edit.html?id='+ id, maxmin: true, - area : ['460px' , '490px'], + area : ['460px' , '530px'], btn: ['确定', '取消'], yes: function(index, layero){ var iframeWindow = window['layui-layer-iframe'+ index] diff --git a/app/common/controller/BaseController.php b/app/common/controller/BaseController.php index 54a6bae..53a97dc 100644 --- a/app/common/controller/BaseController.php +++ b/app/common/controller/BaseController.php @@ -85,13 +85,13 @@ class BaseController extends BaseCtrl //头部链接 $head_links = Cache::get('headlinks'); if(!$head_links){ - $head_links = Db::name('slider')->where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>8])->whereTime('slid_over','>=',time())->field('slid_name,slid_img,slid_href')->select(); + $head_links = Db::name('slider')->where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>10])->whereTime('slid_over','>=',time())->field('slid_name,slid_img,slid_href')->select(); Cache::set('headlinks',$head_links,3600); } //页脚链接 $foot_links = Cache::get('footlinks'); if(!$foot_links){ - $foot_links = Db::name('slider')->where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>9])->whereTime('slid_over','>=',time())->field('slid_name,slid_href')->select(); + $foot_links = Db::name('slider')->where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>11])->whereTime('slid_over','>=',time())->field('slid_name,slid_href')->select(); Cache::set('footlinks',$foot_links,3600); } View::assign(['sysInfo'=>$sysInfo,'headlinks'=>$head_links,'footlinks'=>$foot_links]); diff --git a/app/common/model/Slider.php b/app/common/model/Slider.php index 6b4a23f..efc2b82 100644 --- a/app/common/model/Slider.php +++ b/app/common/model/Slider.php @@ -23,18 +23,19 @@ class Slider extends Model protected $defaultSoftDelete = 0; /** - * 首页幻灯 + * 链接投放获取 + * @param $type 链接类型 * @return mixed|\think\Collection * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function getSliderList() + public function getSliderList($type) { - $sliders = Cache::get('slider'); + $sliders = Cache::get('slider'.$type); if(!$sliders){ - $sliders = $this::where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>1])->whereTime('slid_over','>=',time())->select(); - Cache::set('slider',$sliders,3600); + $sliders = $this::where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>$type])->whereTime('slid_over','>=',time())->select(); + Cache::set('slider'.$type,$sliders,3600); } return $sliders; } @@ -62,6 +63,13 @@ class Slider extends Model return 'edit_error'; } } + + //获取器 + public function getSlidTypeAttr($value) + { + $slid_type = [1=>'首页幻灯',2=>'首页图片',3=>'分类图片',4=>'详情图片',5=>'首页赞助',6=>'分类赞助',7=>'详情赞助',8=>'温馨通道',9=>'友情链接',10=>'头部菜单',11=>'页脚链接']; + return $slid_type[$value]; + } diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index 022c9ae..ffdb25e 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -9,6 +9,7 @@ use think\facade\Cache; use think\facade\Config; use app\common\model\Comment; use app\common\model\Article as ArticleModel; +use app\common\model\Slider; use think\exception\ValidateException; use taoler\com\Message; use app\common\lib\Msgres; @@ -61,16 +62,18 @@ class Article extends BaseController //分类列表 $article = new ArticleModel(); $artList = $article->getCateList($ename,$type,$page,$url,$suffix); - - + // 热议文章 $artHot = $article->getArtHot(10); - //分类右栏广告 - $ad_cate = Db::name('slider')->where('slid_status',1)->where('delete_time',0)->where('slid_type',5)->whereTime('slid_over','>=',time())->select(); - //通用右栏 - $ad_comm = Db::name('slider')->where('slid_status',1)->where('delete_time',0)->where('slid_type',2)->whereTime('slid_over','>=',time())->select(); + + //广告 + $ad = new Slider(); + //分类图片 + $ad_cateImg = $ad->getSliderList(3); + //分类钻展赞助 + $ad_comm = $ad->getSliderList(6); - View::assign(['type'=>$type,'artList'=>$artList,'artHot'=>$artHot,'ad_cate'=>$ad_cate,'ad_comm'=>$ad_comm,'jspage'=>'jie']); + View::assign(['type'=>$type,'artList'=>$artList,'artHot'=>$artHot,'ad_cateImg'=>$ad_cateImg,'ad_comm'=>$ad_comm,'jspage'=>'jie']); return View::fetch(); } @@ -108,12 +111,14 @@ class Article extends BaseController // 热议文章 $artHot = $article->getArtHot(10); - //文章广告 - $ad_article = Db::name('slider')->where('slid_status',1)->where('delete_time',0)->where('slid_type',4)->whereTime('slid_over','>=',time())->select(); - //通用右栏 - $ad_comm = Db::name('slider')->where('slid_status',1)->where('delete_time',0)->where('slid_type',2)->whereTime('slid_over','>=',time())->select(); + //广告 + $ad = new Slider(); + //分类图片 + $ad_artImg = $ad->getSliderList(4); + //分类钻展赞助 + $ad_comm = $ad->getSliderList(7); - View::assign(['article'=>$artDetail,'pv'=>$pv,'comments'=>$comments,'artHot'=>$artHot,'ad_art'=>$ad_article,'ad_comm'=>$ad_comm,$download,'jspage'=>'jie']); + View::assign(['article'=>$artDetail,'pv'=>$pv,'comments'=>$comments,'artHot'=>$artHot,'ad_art'=>$ad_artImg,'ad_comm'=>$ad_comm,$download,'jspage'=>'jie']); return View::fetch(); } diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index 9c9b171..3b98297 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -6,8 +6,8 @@ use think\App; use think\facade\View; use think\facade\Request; use think\facade\Db; -use think\facade\Cache; use app\facade\Article; +use app\common\model\Slider; use app\common\lib\Msgres; class Index extends BaseController @@ -24,44 +24,23 @@ class Index extends BaseController $types = input('type'); //幻灯 - $slider = new \app\common\model\Slider(); - $sliders = $slider->getSliderList(); - + $slider = new Slider(); + $sliders = $slider->getSliderList(1); //置顶文章 $artTop = Article::getArtTop(5); //首页文章列表,显示20个 $artList = Article::getArtList(20); //热议文章 $artHot = Article::getArtHot(10); - + //温馨通道 + $fast_links = $slider->getSliderList(8); //首页赞助 - $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); - } - + $ad_index = $slider->getSliderList(5); + //首页右栏图片 + $ad_comm = $slider->getSliderList(2); //友情链接 - $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); - } - - //温馨通道 - $fast_links = Cache::get('fastlinks'); - if(!$fast_links){ - $fast_links = Db::name('slider')->where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>7])->whereTime('slid_over','>=',time())->field('slid_name,slid_href')->select(); - Cache::set('fastlinks',$fast_links,3600); - } - + $friend_links = $slider->getSliderList(9); + //友情链接申请 $adminEmail = Db::name('user')->where('id',1)->cache(true)->value('email'); @@ -98,31 +77,21 @@ class Index extends BaseController $search = new \app\index\controller\Search(); $artList = $search->getSearch($ser['keywords']); $counts = $artList->count(); + $slider = new Slider(); + //首页右栏 + $ad_comm = $slider->getSliderList(2); + // 查询热议 + $artHot = Article::getArtHot(10); + $searchs = [ 'artList' => $artList, 'keywords' => $ser['keywords'], - 'counts' => $counts + 'counts' => $counts, + 'ad_comm'=>$ad_comm, + 'artHot'=>$artHot, + 'jspage'=>'' ]; - - //首页右栏 - $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); - } - - //温馨通道 - $fast_links = Cache::get('fastlinks'); - if(!$fast_links){ - $fast_links = Db::name('slider')->where(['slid_status'=>1,'delete_time'=>0,'slid_type'=>7])->whereTime('slid_over','>=',time())->field('slid_name,slid_href')->select(); - Cache::set('fastlinks',$fast_links,3600); - } - // 查询热议 - //$article = new Article()1; - $artHot = Article::getArtHot(10); - View::assign($searchs); - View::assign(['fastlinks'=>$fast_links,'ad_comm'=>$ad_comm,'artHot'=>$artHot,'jspage'=>'']); return View::fetch('search'); } diff --git a/config/taoler.php b/config/taoler.php index 6b2c491..8d13ff8 100644 --- a/config/taoler.php +++ b/config/taoler.php @@ -7,7 +7,7 @@ return [ //应用名,此项不可更改 'appname' => 'TaoLer', //版本配置 - 'version' => '1.7.18', + 'version' => '1.7.19', //加盐 'salt' => 'taoler', //数据库备份目录 diff --git a/public/static/res/css/global.css b/public/static/res/css/global.css index f775758..9165dc4 100644 --- a/public/static/res/css/global.css +++ b/public/static/res/css/global.css @@ -26,7 +26,7 @@ i{font-style: normal;} @media screen and (max-width: 992px) { - .site-menu{position: fixed; top: 50px; bottom: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; z-index: 1000; left: -300px; background-color: #fff; transition: all .3s;} + .site-menu{position: fixed; top: 0px; bottom: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; z-index: 10001; left: -300px; background-color: #fff; transition: all .3s;} .site-tree-mobile{display: block!important; position: fixed; z-index: 16666669; bottom: 15px; left: 15px; width: 30px; height: 30px; line-height: 30px; border-radius: 2px; text-align: center; background-color: #009688; color: #fff;} .site-home .site-tree-mobile{display: none!important;} diff --git a/view/taoler/index/article/cate.html b/view/taoler/index/article/cate.html index 3ffa4cc..c0a9d03 100644 --- a/view/taoler/index/article/cate.html +++ b/view/taoler/index/article/cate.html @@ -62,7 +62,14 @@
-
+
+
+ {volist name="ad_cateImg" id="vo"} + + {/volist} +
+
+
{:lang('hot post list')}
{volist name="artHot" id="vo"}
@@ -77,22 +84,13 @@ {:lang('i want to join')}
- {volist name="ad_cate" id="vo"} + {volist name="ad_comm" id="vo"} {$vo.slid_name} {/volist}
-
-
- {:lang('ads area')} -
-
- {volist name="ad_comm" id="vo"} - - {/volist} -
-
+
diff --git a/view/taoler/index/article/detail.html b/view/taoler/index/article/detail.html index a951a5b..1c0b910 100644 --- a/view/taoler/index/article/detail.html +++ b/view/taoler/index/article/detail.html @@ -171,45 +171,30 @@
-
+
+
{:lang('sponsor')}- + {:lang('i want to join')} +
+
+ {volist name="ad_comm" id="vo"} + {$vo.slid_name} + {/volist} +
+
+
{:lang('hot post list')}
{volist name="artHot" id="vo"} -
+
{$vo.title} {$vo.comments_count}
- {/volist} - - - -
- -
-
{:lang('sponsor')}- - {:lang('i want to join')} -
-
- {volist name="ad_art" id="vo"} - {$vo.slid_name} - {/volist} -
-
- -
-
{:lang('ads area')}
- -
+
+ {volist name="ad_art" id="vo"} + + {/volist}
-
- -
- {volist name="ad_comm" id="vo"} - - {/volist} -
diff --git a/view/taoler/index/article/edit.html b/view/taoler/index/article/edit.html index fe4ec36..9c00d12 100644 --- a/view/taoler/index/article/edit.html +++ b/view/taoler/index/article/edit.html @@ -147,7 +147,6 @@ ,form = layui.form ,upload = layui.upload ,plyr = layui.plyr; - //预定义颜色项 colorpicker.render({ diff --git a/view/taoler/index/index/index.html b/view/taoler/index/index/index.html index 6d92618..01dd8fd 100644 --- a/view/taoler/index/index/index.html +++ b/view/taoler/index/index/index.html @@ -45,15 +45,15 @@
+ + + {include file="public/sign" /}

{:lang('links list')}

{include file="public/index-static" /}
- - {include file="public/sign" /} -
{:lang('sponsor')} @@ -73,7 +73,7 @@
-
+
{:lang('hot post list')}
{volist name="artHot" id="vo"}
@@ -82,8 +82,8 @@
{/volist}
- -
+ +
{volist name="ad_comm" id="vo"} {/volist} diff --git a/view/taoler/index/index/search.html b/view/taoler/index/index/search.html index 732e7f5..c1ff603 100644 --- a/view/taoler/index/index/search.html +++ b/view/taoler/index/index/search.html @@ -53,11 +53,6 @@
- -
-

{:lang('links list')}

- {include file="public/index-static" /} -
本周热议
{volist name="artHot" id="vo" empty="还没有帖子"} @@ -68,7 +63,7 @@ {/volist}
-
+
{volist name="ad_comm" id="vo"} {/volist} diff --git a/view/taoler/index/public/header.html b/view/taoler/index/public/header.html index 1f3bdab..8cc39f5 100644 --- a/view/taoler/index/public/header.html +++ b/view/taoler/index/public/header.html @@ -1,8 +1,7 @@
- + +
    {volist name="headlinks" id="vo"}
  • @@ -40,16 +39,16 @@
  • - +
  • -
  • +
  • {:lang('login')}
  • -
  • +
  • {:lang('register')}
  • -
  • - diff --git a/view/taoler/index/public/index-static.html b/view/taoler/index/public/index-static.html index 413b4da..bfb0908 100644 --- a/view/taoler/index/public/index-static.html +++ b/view/taoler/index/public/index-static.html @@ -1,10 +1,9 @@ -
    -
    - {volist name="fastlinks" id="vo"} - - {/volist} - -
    +
    +
    + {volist name="fastlinks" id="vo"} + + {/volist} +
    +
    diff --git a/view/taoler/index/public/menu.html b/view/taoler/index/public/menu.html index 95e1cbb..45317a9 100644 --- a/view/taoler/index/public/menu.html +++ b/view/taoler/index/public/menu.html @@ -1,6 +1,33 @@