From 032426f71e637013e6f094f1507d61e201f9784b Mon Sep 17 00:00:00 2001 From: taoser Date: Wed, 7 Jul 2021 17:17:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=A4=9A=E5=A4=84=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=EF=BC=8C=E6=B8=A9=E9=A6=A8=E9=80=9A=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Set.php | 2 +- app/admin/model/Slider.php | 2 +- app/admin/view/set/system/website.html | 8 ++++- app/admin/view/slider/add.html | 5 +++- app/admin/view/slider/edit.html | 5 +++- app/admin/view/slider/index.html | 4 +-- app/common/controller/BaseController.php | 30 ++++++++++++++++++- app/index/controller/Article.php | 29 ++++++++++++++++-- app/index/controller/Index.php | 29 ++++++++++++++++-- app/install/data/taoler.sql | 4 +-- config/taoler.php | 2 +- public/static/res/mods/index.js | 2 +- view/taoler/index/article/cate.html | 2 +- view/taoler/index/article/detail.html | 4 +-- view/taoler/index/index/index.html | 2 +- view/taoler/index/index/search.html | 19 +++++------- view/taoler/index/public/footer.html | 8 +++-- view/taoler/index/public/header.html | 22 ++++++-------- view/taoler/index/public/index-forumlist.html | 2 +- view/taoler/index/public/index-static.html | 23 ++++---------- view/taoler/index/public/index-topforum.html | 2 +- 21 files changed, 136 insertions(+), 70 deletions(-) diff --git a/app/admin/controller/Set.php b/app/admin/controller/Set.php index 53ff404..b2ee101 100644 --- a/app/admin/controller/Set.php +++ b/app/admin/controller/Set.php @@ -34,7 +34,7 @@ class Set extends AdminController public function website() { if(Request::isPost()){ - $data = Request::only(['webname','template','cache','upsize','uptype','blackname','webtitle','keywords','descript','copyright']); + $data = Request::only(['webname','template','cache','upsize','uptype','blackname','webtitle','keywords','descript','icp','copyright']); $result = Db::name('system')->cache('system')->where('id', 1)->update($data); if($result){ return json(['code'=>0,'msg'=>'更新成功']); diff --git a/app/admin/model/Slider.php b/app/admin/model/Slider.php index 1cee35a..395e401 100644 --- a/app/admin/model/Slider.php +++ b/app/admin/model/Slider.php @@ -13,7 +13,7 @@ class Slider extends Model public function getSlidTypeAttr($value) { - $slid_type = [1=>'首页幻灯',2=>'通用右底',3=>'首页赞助',4=>'文章赞助',5=>'分类赞助',6=>'友情链接']; + $slid_type = [1=>'首页幻灯',2=>'通用右底',3=>'首页赞助',4=>'文章赞助',5=>'分类赞助',6=>'友情链接',7=>'温馨通道',8=>'头部菜单',9=>'页脚链接']; return $slid_type[$value]; } diff --git a/app/admin/view/set/system/website.html b/app/admin/view/set/system/website.html index 792d552..708a6a3 100644 --- a/app/admin/view/set/system/website.html +++ b/app/admin/view/set/system/website.html @@ -67,7 +67,7 @@
- +
@@ -96,6 +96,12 @@ +
+ +
+ +
+
diff --git a/app/admin/view/slider/add.html b/app/admin/view/slider/add.html index 0d2eea2..b455fdb 100644 --- a/app/admin/view/slider/add.html +++ b/app/admin/view/slider/add.html @@ -15,6 +15,9 @@ + + +
@@ -54,7 +57,7 @@
- +
diff --git a/app/admin/view/slider/edit.html b/app/admin/view/slider/edit.html index fefb57f..262056c 100644 --- a/app/admin/view/slider/edit.html +++ b/app/admin/view/slider/edit.html @@ -14,6 +14,9 @@ + + + @@ -53,7 +56,7 @@
- +
diff --git a/app/admin/view/slider/index.html b/app/admin/view/slider/index.html index 163b065..d8415c3 100644 --- a/app/admin/view/slider/index.html +++ b/app/admin/view/slider/index.html @@ -33,7 +33,7 @@ {$vo.id} {$vo.slid_name} - {if condition="$vo.slid_img != ''"}{/if} + {notempty name="$vo.slid_img"}{if $vo.slid_type == '头部菜单'}
{else /}{/if}{/notempty} {$vo.slid_type} {$vo.slid_href} {$vo.slid_color} @@ -82,7 +82,7 @@ title: '添加广告', content: 'add.html', 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 1dabed2..1ca27e3 100644 --- a/app/common/controller/BaseController.php +++ b/app/common/controller/BaseController.php @@ -260,8 +260,36 @@ abstract class BaseController { //1.查询分类表获取所有分类 $sysInfo = Db::name('system')->cache('system',3600)->find(1); - View::assign('sysInfo',$sysInfo); + //头部链接 + $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(); + 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(); + Cache::set('footlinks',$foot_links,3600); + } + View::assign(['sysInfo'=>$sysInfo,'headlinks'=>$head_links,'footlinks'=>$foot_links]); } + //返回上传文件配置类型 + protected function getExtType($ext) + { + $extType = Db::name('system')->where('id',1)->value('uptype'); + $extArr = explode(',',$extType); + foreach ($extArr as $v){ + $fileMime = stristr($v,':',true);//返回字符:前字符串 + if($ext == $fileMime){ + $arr = explode('|',stristr($v,':')); //返回:后字符串 + //var_dump($arr); + return $arr; + } + return []; + } + } + } diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index 4aacae9..ef39143 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -256,7 +256,7 @@ class Article extends BaseController { $file = request()->file('file'); try { - validate(['file'=>['fileSize'=>'102400','fileExt'=>['jpg','jpeg','png']]]) + validate(['file'=>['fileSize'=>'1024000','fileExt'=>$this->getExtType('image')]]) ->check(['file'=>$file]); } catch (ValidateException $e) { @@ -285,7 +285,7 @@ class Article extends BaseController { $file = request()->file('file'); try { - validate(['file'=>'fileSize:1024000|fileExt:jpg,zip']) + validate(['file'=>['fileSize'=>'1024000','fileExt'=>$this->getExtType('file')]]) ->check(['file'=>$file]); $savename = \think\facade\Filesystem::disk('public')->putFile('article_zip',$file); } catch (ValidateException $e) { @@ -307,7 +307,7 @@ class Article extends BaseController { $file = request()->file('file'); try { - validate(['file'=>'fileSize:102400000|fileExt:mp4,mp3']) + validate(['file'=>['fileSize'=>'102400000','fileExt'=>$this->getExtType('mp4')]]) ->check(['file'=>$file]); $savename = \think\facade\Filesystem::disk('public')->putFile('video',$file); } catch (ValidateException $e) { @@ -323,6 +323,29 @@ class Article extends BaseController } return json($res); } + + //上传音频 + public function upAudio() + { + $file = request()->file('file'); + try { + validate(['file'=>['fileSize'=>'10240000','fileExt'=>$this->getExtType('mp3')]]) + ->check(['file'=>$file]); + $savename = \think\facade\Filesystem::disk('public')->putFile('audio',$file); + } catch (ValidateException $e) { + return json(['status'=>-1,'msg'=>$e->getMessage()]); + } + $upload = Config::get('filesystem.disks.public.url'); + + if($savename){ + $name_path =str_replace('\\',"/",$upload.'/'.$savename); + $res = ['status'=>0,'msg'=>'上传成功','url'=> $name_path]; + }else{ + $res = ['status'=>-1,'msg'=>'上传错误']; + } + return json($res); + } + //附件下载 public function download($id) diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index 953510c..9c9b171 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -55,6 +55,16 @@ class Index extends BaseController 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); + } + + //友情链接申请 + $adminEmail = Db::name('user')->where('id',1)->cache(true)->value('email'); + $vs = [ 'slider' => $sliders, 'artTop' => $artTop, @@ -63,7 +73,9 @@ class Index extends BaseController 'type' => $types, 'ad_index' => $ad_index, 'ad_comm' => $ad_comm, + 'fastlinks' => $fast_links, 'flinks' => $friend_links, + 'adminEmail' => $adminEmail, 'jspage' => '', ]; View::assign($vs); @@ -92,14 +104,25 @@ class Index extends BaseController 'counts' => $counts ]; - //友情链接 - $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(); + //首页右栏 + $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(['flinks'=>$friend_links,'artHot'=>$artHot,'jspage'=>'']); + View::assign(['fastlinks'=>$fast_links,'ad_comm'=>$ad_comm,'artHot'=>$artHot,'jspage'=>'']); return View::fetch('search'); } diff --git a/app/install/data/taoler.sql b/app/install/data/taoler.sql index 05f6585..3a45977 100644 --- a/app/install/data/taoler.sql +++ b/app/install/data/taoler.sql @@ -480,7 +480,7 @@ CREATE TABLE `tao_system` ( `logo` varchar(70) NOT NULL DEFAULT '' COMMENT '网站logo', `cache` tinyint(5) NOT NULL DEFAULT '0' COMMENT '缓存时间分钟', `upsize` int(5) NOT NULL DEFAULT '0' COMMENT '上传文件大小KB', - `uptype` varchar(50) NOT NULL DEFAULT '' COMMENT '上传文件类型', + `uptype` varchar(100) NOT NULL DEFAULT '' COMMENT '上传文件类型', `copyright` varchar(80) NOT NULL DEFAULT '' COMMENT '版权', `keywords` tinytext NOT NULL COMMENT '网站关键字', `descript` tinytext NOT NULL COMMENT '网站描述', @@ -503,7 +503,7 @@ CREATE TABLE `tao_system` ( -- ---------------------------- -- Records of tao_system -- ---------------------------- -INSERT INTO `tao_system` VALUES ('1', 'TaoLer社区演示站', '轻论坛系统', 'http://www.xxx.com', 'taoler', '/storage/logo/logo.png', '10', '2048', 'png|gif|jpg|jpeg|zip|rarr', 'TaoLer', 'TaoLer,轻社区系统,bbs,论坛,Thinkphp6,layui,fly模板,', '这是一个Taoler轻社区论坛系统', '1', '1', '1', '0.0.0.0', '管理员|admin|审核员|超级|垃圾', '1.6.3', '', 'http://api.aieok.com', 'http://api.aieok.com/v1/cy', 'http://api.aieok.com/v1/upload/check', 'http://api.aieok.com/v1/upload/api', '1581221008', '1577419197'); +INSERT INTO `tao_system` VALUES ('1', 'TaoLer社区演示站', '轻论坛系统', 'http://www.xxx.com', 'taoler', '/storage/logo/logo.png', '10', '2048', 'image:png|gif|jpg|jpeg,file:zip|rar,video:mp4,audio:mp3|m4a', 'TaoLer', 'TaoLer,轻社区系统,bbs,论坛,Thinkphp6,layui,fly模板,', '这是一个Taoler轻社区论坛系统', '1', '1', '1', '0.0.0.0', '管理员|admin|审核员|超级|垃圾', '1.6.3', '', 'http://api.aieok.com', 'http://api.aieok.com/v1/cy', 'http://api.aieok.com/v1/upload/check', 'http://api.aieok.com/v1/upload/api', '1581221008', '1577419197'); -- ---------------------------- -- Table structure for tao_user diff --git a/config/taoler.php b/config/taoler.php index 27a9d54..476a436 100644 --- a/config/taoler.php +++ b/config/taoler.php @@ -7,7 +7,7 @@ return [ //应用名,此项不可更改 'appname' => 'TaoLer', //版本配置 - 'version' => '1.7.11', + 'version' => '1.7.13', //加盐 'salt' => 'taoler', //数据库备份目录 diff --git a/public/static/res/mods/index.js b/public/static/res/mods/index.js index fd9598d..8da8f99 100644 --- a/public/static/res/mods/index.js +++ b/public/static/res/mods/index.js @@ -397,7 +397,7 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'], var loding,audio = layero.find('input[name="audio"]'); upload.render({ - url: videoUrl + url: audioUrl ,elem: '#fly-jie-audio-upload .upload-audio' ,accept: 'audio' ,acceptMime: 'audio/mp3' diff --git a/view/taoler/index/article/cate.html b/view/taoler/index/article/cate.html index 1324ab4..3ffa4cc 100644 --- a/view/taoler/index/article/cate.html +++ b/view/taoler/index/article/cate.html @@ -50,7 +50,7 @@
- {if ($art.is_hot == 1)} {:lang('hot')} {/if} + {if ($art.is_hot == 1)}{:lang('hot')} {/if}
{/volist} diff --git a/view/taoler/index/article/detail.html b/view/taoler/index/article/detail.html index 2a9680d..a951a5b 100644 --- a/view/taoler/index/article/detail.html +++ b/view/taoler/index/article/detail.html @@ -135,7 +135,7 @@ {if (session('user_id') == $vo.user.id) && (getLimtTime($vo.create_time) < 2) OR ($user.auth ?? '')} {:lang('edit')} {:lang('delete')} - {if $vo.cai == 0 && session('user_id') == $article.user_id /} + {if $vo.cai == 0 && (session('user_id') == $article.user_id) OR ($user.auth ?? '') /} {:lang('accept')} {/if} {/if} @@ -356,7 +356,7 @@ $("#rdown").hover(function(){ },function(){ $("#phonedl").hide().stop(); }); - + function PhoneDown(){ layer.open({ title: "扫码查阅", diff --git a/view/taoler/index/index/index.html b/view/taoler/index/index/index.html index c35fc51..471fdcb 100644 --- a/view/taoler/index/index/index.html +++ b/view/taoler/index/index/index.html @@ -107,7 +107,7 @@ var signJsonUrl = "{:url('sign/signJson')}"; $('#friend-link').on('click', function(){ layer.open({ title: '申请友链', - content: '发送邮件至:changlin_zhao@qq.com ', + content: '发送邮件至:{$adminEmail} ', yes: function(index, layero){ layer.close(index); } diff --git a/view/taoler/index/index/search.html b/view/taoler/index/index/search.html index 828aa56..732e7f5 100644 --- a/view/taoler/index/index/search.html +++ b/view/taoler/index/index/search.html @@ -53,12 +53,11 @@
- +
-

温馨通道

+

{:lang('links list')}

{include file="public/index-static" /}
-
本周热议
{volist name="artHot" id="vo" empty="还没有帖子"} @@ -68,16 +67,12 @@ {/volist}
- -
-
- 这里可作为广告区域 + +
+ {volist name="ad_comm" id="vo"} + + {/volist}
- -
- {include file="public/flink" /}
diff --git a/view/taoler/index/public/footer.html b/view/taoler/index/public/footer.html index 66fbaf4..d0cc323 100644 --- a/view/taoler/index/public/footer.html +++ b/view/taoler/index/public/footer.html @@ -1,9 +1,10 @@ @@ -17,6 +18,7 @@ var messageNums = "{:url('message/nums')}", articleAdd = "{:url('Article/add')}", textImgUpload = "{:url('article/textImgUpload')}", videoUrl = "{:url('article/upVideo')}", + audioUrl = "{:url('article/upAudio')}", searchUrl = "{:url('index/search')}", langUrl = "{:url('index/language')}", replyNum = "{:lang('replies')}"; diff --git a/view/taoler/index/public/header.html b/view/taoler/index/public/header.html index 0931a37..1f3bdab 100644 --- a/view/taoler/index/public/header.html +++ b/view/taoler/index/public/header.html @@ -4,15 +4,11 @@ layui