diff --git a/app/admin/controller/Admin.php b/app/admin/controller/Admin.php index c940ebc..a3348d5 100644 --- a/app/admin/controller/Admin.php +++ b/app/admin/controller/Admin.php @@ -207,16 +207,8 @@ class Admin extends AdminController //清除缓存Cache public function clearCache(){ - //$atemp = app()->getRootPath().'runtime/admin/temp/'; - //$itemp = app()->getRootPath().'runtime/index/temp/'; - //$cache = app()->getRootPath().'runtime/cache/'; - - $atemp = str_replace('\\',"/",app()->getRootPath().'runtime/admin/temp/'); - $itemp = str_replace('\\',"/",app()->getRootPath().'runtime/index/temp/'); - $cache = str_replace('\\',"/",app()->getRootPath().'runtime/cache/'); - Files::delDirAndFile($atemp); - Files::delDirAndFile($itemp); - if(is_dir($cache) && Files::delDirAndFile($cache)){ + $res = $this->clearSysCache(); + if($res){ return json(['code'=>0,'msg'=>'清除缓存成功']); } else { return json(['code'=>-1,'msg'=>'清除缓存失败']); diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index 0d83ed1..06db28f 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -67,8 +67,32 @@ class Index extends AdminController $forum = Db::name('article')->field('id')->where(['delete_time'=>0,'status'=>0])->select(); $comms = count($comm); $forums = count($forum); + + //用户注册数据 + $monthTime = Cache::get('monthTime'); + if(!$monthTime){ + $time = Db::name('user')->where('delete_time',0)->whereMonth('create_time')->order('create_time','asc')->column('create_time'); + $monthTime = [];//当月有注册的日期 + foreach($time as $v){// + $data = date('m-d',$v); + if(!in_array($data,$monthTime)){ + $monthTime[] = $data; + }; + } + $userDayCount = [];//每天注册用户数 + foreach($monthTime as $d){ + $userArr = Db::name('user')->whereDay('create_time',date("Y").'-'.$d)->select(); + $userDayCount[] = count($userArr); + } + + $monthTime = implode(',',$monthTime); //数组转字符串 + $monthUserCount = implode(',',$userDayCount); + Cache::set('monthTime',$monthTime,3600); + Cache::set('monthUserCount',$monthUserCount,3600); + } + - View::assign(['versions'=>$versions,'comms'=>$comms,'forums'=>$forums]); + View::assign(['versions'=>$versions,'comms'=>$comms,'forums'=>$forums,'monthTime'=>$monthTime,'monthUserCount'=>Cache::get('monthUserCount')]); return View::fetch(); } diff --git a/app/admin/controller/Upgrade.php b/app/admin/controller/Upgrade.php index 022ab94..8c93bcd 100644 --- a/app/admin/controller/Upgrade.php +++ b/app/admin/controller/Upgrade.php @@ -186,6 +186,9 @@ class Upgrade extends AdminController return json(['code'=>-1,'msg'=>$upDate['msg']]); } + //清理缓存 + $this->clearSysCache(); + //更新版本 //Db::name('system')->update(['sys_version_num'=>$version_num,'id'=>1]); $setConf = new SetConf; diff --git a/app/admin/view/index/home.html b/app/admin/view/index/home.html index 9c17da9..c82d457 100644 --- a/app/admin/view/index/home.html +++ b/app/admin/view/index/home.html @@ -438,9 +438,11 @@ }); }); - var indexForums = "{:url('Index/forums')}", //帖子 + var indexForums = "{:url('Index/forums')}", //帖子 indexReplys = "{:url('Index/replys')}"; //回复 var indexNews = "{:url('Index/news')}", //动态 indexReply = "{:url('Index/reply')}"; //反馈 + var monthTime = "{$monthTime}", + monthUserCount = "{$monthUserCount}"; {/block} \ No newline at end of file diff --git a/app/admin/view/public/base.html b/app/admin/view/public/base.html index 3c2c68d..c7d7d0c 100644 --- a/app/admin/view/public/base.html +++ b/app/admin/view/public/base.html @@ -18,7 +18,7 @@ var AdminLogin = "{:url('Login/index')}", AdminLogout = "{:url('Admin/logout')}", adminClearCache = "{:url('Admin/clearCache')}"; -var sysCy = "{$syscy}"; +var sysCy = "{$clevel}"; //var c = "{:config('app.domain_bind.www')}"; //console.log(c); diff --git a/app/common/controller/AdminController.php b/app/common/controller/AdminController.php index aa75693..a16b972 100644 --- a/app/common/controller/AdminController.php +++ b/app/common/controller/AdminController.php @@ -69,16 +69,16 @@ class AdminController extends \app\BaseController } //清除缓存Cache - public function clearData() + public function clearSysCache() { - $dir = app()->getRootPath().'runtime/admin/temp'; - $cache = app()->getRootPath().'runtime/cache'; - if(is_dir($cache)){ - Files::delDirs($cache); - } - if(Files::delDirs($dir) ){ - return json(['code'=>0,'msg'=>'清除成功']); - } + //清理缓存 + $atemp = str_replace('\\',"/",app()->getRootPath().'runtime/admin/temp/'); + $itemp = str_replace('\\',"/",app()->getRootPath().'runtime/index/temp/'); + $cache = str_replace('\\',"/",app()->getRootPath().'runtime/cache/'); + Files::delDirAndFile($atemp); + Files::delDirAndFile($itemp); + Files::delDirAndFile($cache); + return true; } //显示网站设置 @@ -105,7 +105,7 @@ class AdminController extends \app\BaseController $domain = $this->getHttpUrl($sys['domain']); $syscy = $sys['clevel'] ? Lang::get('Authorized') : Lang::get('Free version'); $runTime = $this->getRunTime(); - View::assign(['domain'=>$domain,'insurl'=>$sys['domain'],'syscy'=>$syscy,'runTime'=>$runTime]); + View::assign(['domain'=>$domain,'insurl'=>$sys['domain'],'syscy'=>$syscy,'clevel'=>$sys['clevel'],'runTime'=>$runTime]); } protected function getRunTime() diff --git a/app/install/data/taoler.sql b/app/install/data/taoler.sql index f933755..f322d7c 100644 --- a/app/install/data/taoler.sql +++ b/app/install/data/taoler.sql @@ -467,7 +467,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(255) NOT NULL DEFAULT '0' COMMENT '上传文件类型', `copyright` varchar(80) NOT NULL DEFAULT '' COMMENT '版权', `keywords` tinytext NOT NULL COMMENT '网站关键字', `descript` tinytext NOT NULL COMMENT '网站描述', @@ -512,7 +512,7 @@ CREATE TABLE `tao_user` ( `auth` enum('1','0') NOT NULL DEFAULT '0' COMMENT '管理员权限0普通1超级', `point` int(11) NOT NULL DEFAULT '0' COMMENT '积分', `area_id` int(11) DEFAULT NULL COMMENT '用户所属区域ID', - `status` enum('0','1','-1') NOT NULL DEFAULT '1' COMMENT '1启用0待审-1禁用', + `status` enum('1','0','-1') NOT NULL DEFAULT '1' COMMENT '1启用0待审-1禁用', `vip` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'vip', `last_login_ip` varchar(70) NOT NULL DEFAULT '0' COMMENT '最后登陆ip', `last_login_time` int(11) NOT NULL DEFAULT '0' COMMENT '最后登陆时间', diff --git a/config/taoler.php b/config/taoler.php index 72a65db..6b2c491 100644 --- a/config/taoler.php +++ b/config/taoler.php @@ -7,7 +7,7 @@ return [ //应用名,此项不可更改 'appname' => 'TaoLer', //版本配置 - 'version' => '1.7.17', + 'version' => '1.7.18', //加盐 'salt' => 'taoler', //数据库备份目录 diff --git a/public/static/admin/modules/console.js b/public/static/admin/modules/console.js index 0be40fb..e6a219e 100644 --- a/public/static/admin/modules/console.js +++ b/public/static/admin/modules/console.js @@ -48,8 +48,38 @@ layui.define(function(exports){ ,carousel = layui.carousel ,echarts = layui.echarts; + //字符串转化为数组 + var monthTimes = monthTime.split(','); + var monthUserCounts = monthUserCount.split(','); + var echartsApp = [], options = [ - //今日流量趋势 + //新增的用户量 + { + title: { + text: '最近一周新增的用户量', + x: 'center', + textStyle: { + fontSize: 14 + } + }, + tooltip : { //提示框 + trigger: 'axis', + formatter: "{b}
新增用户:{c}" + }, + xAxis : [{ //X轴 + type : 'category', + data : monthTimes + }], + yAxis : [{ //Y轴 + type : 'value' + }], + series : [{ //内容 + type: 'line', + data: monthUserCounts + }] + }, + + //今日流量趋势 { title: { text: '今日流量趋势', @@ -118,32 +148,6 @@ layui.define(function(exports){ {value:1700, name:'其它浏览器'} ] }] - }, - - //新增的用户量 - { - title: { - text: '最近一周新增的用户量', - x: 'center', - textStyle: { - fontSize: 14 - } - }, - tooltip : { //提示框 - trigger: 'axis', - formatter: "{b}
新增用户:{c}" - }, - xAxis : [{ //X轴 - type : 'category', - data : ['11-07', '11-08', '11-09', '11-10', '11-11', '11-12', '11-13'] - }], - yAxis : [{ //Y轴 - type : 'value' - }], - series : [{ //内容 - type: 'line', - data:[200, 300, 400, 610, 150, 270, 380], - }] } ] ,elemDataView = $('#LAY-index-dataview').children('div') diff --git a/view/taoler/index/index/index.html b/view/taoler/index/index/index.html index 471fdcb..6d92618 100644 --- a/view/taoler/index/index/index.html +++ b/view/taoler/index/index/index.html @@ -46,7 +46,7 @@
-
+

{:lang('links list')}

{include file="public/index-static" /}
@@ -66,7 +66,7 @@
-
+

{:lang('reviewers list')}

diff --git a/view/taoler/index/public/footer.html b/view/taoler/index/public/footer.html index 2f62aeb..a0f85fb 100644 --- a/view/taoler/index/public/footer.html +++ b/view/taoler/index/public/footer.html @@ -1,6 +1,7 @@