优化首页显示,修复管理员无法登录,上传文件类型字段,升级缓存清理

This commit is contained in:
taoser 2021-07-22 10:39:09 +08:00
parent 63f3bd01b5
commit 645e6ad120
12 changed files with 83 additions and 57 deletions

View File

@ -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'=>'清除缓存失败']);

View File

@ -68,7 +68,31 @@ class Index extends AdminController
$comms = count($comm);
$forums = count($forum);
View::assign(['versions'=>$versions,'comms'=>$comms,'forums'=>$forums]);
//用户注册数据
$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,'monthTime'=>$monthTime,'monthUserCount'=>Cache::get('monthUserCount')]);
return View::fetch();
}

View File

@ -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;

View File

@ -442,5 +442,7 @@
indexReplys = "{:url('Index/replys')}"; //回复
var indexNews = "{:url('Index/news')}", //动态
indexReply = "{:url('Index/reply')}"; //反馈
var monthTime = "{$monthTime}",
monthUserCount = "{$monthUserCount}";
</script>
{/block}

View File

@ -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);
</script>

View File

@ -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()

View File

@ -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 '最后登陆时间',

View File

@ -7,7 +7,7 @@ return [
//应用名,此项不可更改
'appname' => 'TaoLer',
//版本配置
'version' => '1.7.17',
'version' => '1.7.18',
//加盐
'salt' => 'taoler',
//数据库备份目录

View File

@ -48,7 +48,37 @@ 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}<br>新增用户:{c}"
},
xAxis : [{ //X轴
type : 'category',
data : monthTimes
}],
yAxis : [{ //Y轴
type : 'value'
}],
series : [{ //内容
type: 'line',
data: monthUserCounts
}]
},
//今日流量趋势
{
title: {
@ -118,32 +148,6 @@ layui.define(function(exports){
{value:1700, name:'其它浏览器'}
]
}]
},
//新增的用户量
{
title: {
text: '最近一周新增的用户量',
x: 'center',
textStyle: {
fontSize: 14
}
},
tooltip : { //提示框
trigger: 'axis',
formatter: "{b}<br>新增用户:{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')

View File

@ -46,7 +46,7 @@
</div>
<div class="layui-col-md4">
<!--温馨通道-->
<div class="fly-panel">
<div class="fly-panel layui-hide-xs">
<h3 class="fly-panel-title">{:lang('links list')}</h3>
{include file="public/index-static" /}
</div>
@ -66,7 +66,7 @@
</div>
</div>
<!--回帖榜-->
<div class="fly-panel fly-rank fly-rank-reply" id="LAY_replyRank">
<div class="fly-panel fly-rank fly-rank-reply layui-hide-xs" id="LAY_replyRank">
<h3 class="fly-panel-title">{:lang('reviewers list')}</h3>
<dl>
<i class="layui-icon fly-loading">&#xe63d;</i>

View File

@ -1,6 +1,7 @@
<div class="fly-footer html5plus-hide">
<p> Copyright &copy; {:date('Y')}{$sysInfo.copyright|raw}v{:config('taoler.version')} {$sysInfo.showlist}</p>
<p> Copyright &copy; {:date('Y')}{$sysInfo.copyright|raw}v{:config('taoler.version')}</p>
<p>
{$sysInfo.showlist|raw}
{volist name="footlinks" id="vo"}
<a href="{$vo.slid_href}" target="_blank">{$vo.slid_name}</a>
{/volist}

View File

@ -2,7 +2,7 @@
<div class="layui-carousel fly-topline" id="FLY_topline" >
<div carousel-item="">
{volist name="slider" id="vo"}
<div time-limit="2019-04-18 0:0:0" >
<div time-limit="" >
<a href="{$vo.slid_href}" target="_blank" rel="nofollow"> <img src="{$vo.slid_img}" alt="{$vo.slid_name}" /> </a>
</div>
{/volist}