优化管理员和用户表格,安装目录权限检测,广告背景选择器,升级key状态判定

This commit is contained in:
taoser 2021-06-10 13:39:51 +08:00
parent ace6ee5e21
commit d58a6fd8b7
15 changed files with 156 additions and 114 deletions

View File

@ -5,6 +5,7 @@ namespace app;
class Request extends \think\Request
{
//过滤空格
protected $filter = ['trim','htmlspecialchars','strip_tags'];
//protected $filter = ['trim','htmlspecialchars','strip_tags'];
protected $filter = ['trim'];
}

View File

@ -33,11 +33,8 @@ class Set extends AdminController
//网站设置
public function website()
{
if(Request::isAjax()){
$data = Request::param();
unset($data['file']);
//$system = System::find(1);
//$result = $system->allowField(['webname','webtitle','domain','keywords','descript','copyright','blackname'])->save($data);
if(Request::isPost()){
$data = Request::only(['webname','template','cache','upsize','uptype','blackname','webtitle','keywords','descript','copyright']);
$result = Db::name('system')->cache('system')->where('id', 1)->update($data);
if($result){
return json(['code'=>0,'msg'=>'更新成功']);

View File

@ -38,9 +38,9 @@ class Slider extends AdminController
$data['slid_over'] = strtotime($data['slid_over']);
$result = Db::name('slider')->save($data);
if($result){
$res = ['code'=>1,'msg'=>'添加成功'];
$res = ['code'=>0,'msg'=>'添加成功'];
}else{
$res = ['code'=>0,'msg'=>'添加失败'];
$res = ['code'=>-1,'msg'=>'添加失败'];
}
return json($res);
}
@ -66,9 +66,9 @@ class Slider extends AdminController
$data['slid_over'] = strtotime($data['slid_over']);
$result = Db::name('slider')->where('id',$id)->save($data);
if($result){
$res = ['code'=>1,'msg'=>'编辑成功'];
$res = ['code'=>0,'msg'=>'编辑成功'];
}else{
$res = ['code'=>0,'msg'=>'编辑失败'];
$res = ['code'=>-1,'msg'=>'编辑失败'];
}
return json($res);
}
@ -118,9 +118,9 @@ class Slider extends AdminController
$slider = SliderModel::find($id);
$res = $slider->delete();
if($res){
return json(['code'=>1,'msg'=>'删除成功']);
return json(['code'=>0,'msg'=>'删除成功']);
} else {
return json(['code'=>0,'msg'=>'删除失败']);
return json(['code'=>-1,'msg'=>'删除失败']);
}
}
}

View File

@ -58,15 +58,15 @@ class Upgrade extends AdminController
//设置key
public function key()
{
$data = Request::param();
if($data['key']== ''){
$data = Request::only(['key']);
if(empty($data['key'])){
return json(['code'=>0,'msg'=>'请填写正确的key']);
}
$res = Db::name('system')->update(['key'=>$data['key'],'id'=>1]);
if($res){
$res = ['code'=>1,'msg'=>'保存成功'];
$res = ['code'=>0,'msg'=>'保存成功'];
} else {
$res = ['code'=>0,'msg'=>'保存失败'];
$res = ['code'=>-1,'msg'=>'保存失败'];
}
return json($res);
}
@ -77,15 +77,15 @@ class Upgrade extends AdminController
$key = Db::name('system')->field('key,upcheck_url,upgrade_url')->find(1);
if(Request::isAjax()){
$data = Request::param();
if($data['key']== ''){
return json(['code'=>0,'msg'=>'请正确填写申请到的key']);
$data = Request::only(['key','upcheck_url','upgrade_url']);
if(empty($data['key'])){
return json(['code'=>-1,'msg'=>'请正确填写申请到的key']);
}
$res = Db::name('system')->update(['key'=>$data['key'],'upcheck_url'=>$data['upcheck_url'],'upgrade_url'=>$data['upgrade_url'],'id'=>1]);
if($res){
$res = ['code'=>1,'msg'=>'修改成功'];
$res = ['code'=>0,'msg'=>'修改成功'];
} else {
$res = ['code'=>0,'msg'=>'修改失败'];
$res = ['code'=>-1,'msg'=>'修改失败'];
}
return json($res);
}
@ -109,7 +109,6 @@ class Upgrade extends AdminController
}
if($version_code == 0){
$res = json(['code'=>$versions->code,'msg'=>$versions->msg]);
}
return $res;

View File

@ -174,10 +174,8 @@
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'set', 'element', 'upload'], function(){
}).use(['index', 'set', 'upload'], function(){
var $ = layui.$
,element = layui.element
,table = layui.table
,form = layui.form
,upload = layui.upload;

View File

@ -2,7 +2,7 @@
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-slider" id="layuiadmin-form-slider" style="padding: 20px 30px 0 0;">
<div class="layui-form" lay-filter="layuiadmin-form-slider" id="layuiadmin-form-slider" style="padding: 20px 20px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">位置</label>
@ -25,9 +25,12 @@
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">广告块底色</label>
<label class="layui-form-label">背景</label>
<div class="layui-input-inline">
<input type="text" name="slid_color" lay-verify="" placeholder="位置3,4,5可选底色" autocomplete="off" class="layui-input">
<input type="text" name="slid_color" lay-verify="" placeholder="选位置3,4,5请选背景色" autocomplete="off" class="layui-input" id="color-select">
</div>
<div class="layui-inline" style="left: -11px;">
<div id="coloer-form"></div>
</div>
</div>
<div class="layui-form-item">
@ -53,7 +56,7 @@
<div class="layui-input-inline">
<input type="text" name="slid_img" lay-verify="" placeholder="位置1,2需上传图片" autocomplete="off" class="layui-input" >
</div>
<button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-slid-img">上传图片</button>
<button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-slid-img">选图</button>
</div>
<div class="layui-form-item layui-hide">
@ -68,13 +71,21 @@
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'upload','laydate','table'], function(){
}).use(['index', 'form', 'upload','laydate','colorpicker'], function(){
var $ = layui.$
,table = layui.table
,form = layui.form
,laydate = layui.laydate
,upload = layui.upload ;
var colorpicker = layui.colorpicker;
//颜色表单赋值
colorpicker.render({
elem: '#coloer-form'
,color: '#1c97f5'
,done: function(color){
$('#color-select').val(color);
}
});
//开始时间
laydate.render({

View File

@ -24,9 +24,12 @@
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">广告块底色</label>
<label class="layui-form-label">背景</label>
<div class="layui-input-inline">
<input type="text" name="slid_color" lay-verify="" placeholder="位置3,4,5可选底色" autocomplete="off" class="layui-input" value="{$slider.slid_color}">
<input type="text" name="slid_color" lay-verify="" placeholder="选位置3,4,5请选背景色" autocomplete="off" class="layui-input" value="{$slider.slid_color}" id="color-select">
</div>
<div class="layui-inline" style="left: -11px;">
<div id="coloer-form"></div>
</div>
</div>
<div class="layui-form-item">
@ -52,7 +55,7 @@
<div class="layui-input-inline">
<input type="text" name="slid_img" lay-verify="" placeholder="置1,2需上传图片上传图片" autocomplete="off" class="layui-input" value="{$slider.slid_img}">
</div>
<button style="float: left;" type="button" class="layui-btn" dataid="{$slider.id}" id="layuiadmin-upload-slid-img">上传图片</button>
<button style="float: left;" type="button" class="layui-btn" dataid="{$slider.id}" id="layuiadmin-upload-slid-img">选图</button>
</div>
<div class="layui-form-item layui-hide">
@ -67,13 +70,21 @@
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'upload','laydate','table'], function(){
}).use(['index', 'form', 'upload','laydate','colorpicker'], function(){
var $ = layui.$
,table = layui.table
,form = layui.form
,laydate = layui.laydate
,upload = layui.upload ;
var colorpicker = layui.colorpicker;
//颜色表单赋值
colorpicker.render({
elem: '#coloer-form'
,color: '#1c97f5'
,done: function(color){
$('#color-select').val(color);
}
});
//开始时间
laydate.render({

View File

@ -70,17 +70,11 @@
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'set']);
</script>
<script>
layui.use(['layer','table','form','upload','laydate'], function(){
}).use(['index','layer','table','form'], function(){
var $ = layui.jquery
,layer = layui.layer
,table = layui.table
,form = layui.form
,laydate = layui.laydate
,upload = layui.upload;
,form = layui.form;
//添加幻灯
$('#slid-add').on('click', function(){
layer.open({
@ -88,7 +82,7 @@ layui.use(['layer','table','form','upload','laydate'], function(){
title: '添加广告',
content: 'add.html',
maxmin: true,
area : ['500px' , '450px'],
area : ['460px' , '490px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
@ -107,7 +101,7 @@ layui.use(['layer','table','form','upload','laydate'], function(){
data:{"slid_type":field.slid_type,"slid_name":field.slid_name,"slid_color":field.slid_color,"slid_start":field.slid_start,"slid_over":field.slid_over,"slid_href":field.slid_href,"slid_img":field.slid_img},
daType:"json",
success:function (data){
if (data.code == 1) {
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
@ -138,7 +132,7 @@ layui.use(['layer','table','form','upload','laydate'], function(){
title: '编辑幻灯',
content: 'edit.html?id='+ id,
maxmin: true,
area : ['500px' , '450px'],
area : ['460px' , '490px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
@ -157,7 +151,7 @@ layui.use(['layer','table','form','upload','laydate'], function(){
data:{"id":id,"slid_type":field.slid_type,"slid_name":field.slid_name,"slid_color":field.slid_color,"slid_start":field.slid_start,"slid_over":field.slid_over,"slid_href":field.slid_href,"slid_img":field.slid_img},
daType:"json",
success:function (data){
if (data.code == 1) {
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
@ -192,7 +186,7 @@ layui.use(['layer','table','form','upload','laydate'], function(){
data:{"id":id},
daType:"json",
success:function (data){
if (data.code == 1) {
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000

View File

@ -17,7 +17,7 @@
</div>
<div class="layui-input-inline layui-input-company"><button style="float: left;" type="button" class="layui-btn layui-btn-sm" id="upgrade-key">保存</button></div>
<div class="layui-form-mid layui-word-aux" >无Key不能升级</div>
<div class="layui-form-mid layui-word-aux " ><a href="http://www.aieok.com/Api/key.html" target="_blank">去官网申请Key</a></div>
<div class="layui-form-mid layui-word-aux " ><a href="http://bbs.aieok.com/Api/key.html" target="_blank">去官网申请Key</a></div>
</div>
{else /}
<div class="layui-form-item">
@ -79,10 +79,7 @@
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'set']);
</script>
<script>
layui.use(['layer','form','upload'], function(){
}).use(['index','layer','form','upload'], function(){
var $ = layui.jquery
,layer = layui.layer
,form = layui.form
@ -201,29 +198,29 @@
//设置key
$('#upgrade-key').on('click',function(){
var key = $('input[name=key]').val();
console.log(key);
$.ajax({
type:"post",
url:"{:url('admin/upgrade/key')}",
data:{"key":key},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
},function(){
location.reload();
});
} else {
layer.open({
title:'保存失败',
content:data.msg,
icon:5,
anim:6
});
}
type:"post",
url:"{:url('admin/upgrade/key')}",
data:{"key":key},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
},function(){
location.reload();
});
} else {
layer.open({
title:'保存失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
return false;
});
@ -236,7 +233,7 @@
title: '修改key',
content: 'keyedit.html',
maxmin: true,
area : ['420px' , '380px'],
area : ['420px' , '400px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]

View File

@ -24,7 +24,7 @@
<div class="layui-form-item">
<label class="layui-form-label">申请key?</label>
<div class="layui-input-inline">
<div class="layui-form-mid layui-word-aux " ><a href="http://www.aieok.com" target="_blank">更换网址,请去官网重新申请key</a></div>
<div class="layui-form-mid layui-word-aux " ><a href="http://bbs.aieok.com" target="_blank">更换网址,请去官网重新申请key</a></div>
<div class="layui-form-mid layui-word-aux " ><span>未通知api接口变更,请不要私自更改api否则无法升级</span></div>
</div>
</div>

View File

@ -54,6 +54,48 @@
<?php else: ?> ×
<?php endif ?>
</td>
</tr>
<tr>
<td>./config</td>
<td>可写</td>
<td>
<?php if (is_writable('../config')): ?> 可写
<?php else: ?> 不可写
<?php endif ?>
</td>
<td class="<?php if(is_writable('../config'))echo 'yes'; ?>">
<?php if (is_writable('../config')): ?>
<?php else: ?> ×
<?php endif ?>
</td>
</tr>
<tr>
<td>./app</td>
<td>可写</td>
<td>
<?php if (is_writable('../app')): ?> 可写
<?php else: ?> 不可写
<?php endif ?>
</td>
<td class="<?php if(is_writable('../app'))echo 'yes'; ?>">
<?php if (is_writable('../app')): ?>
<?php else: ?> ×
<?php endif ?>
</td>
</tr>
<tr>
<td>./view</td>
<td>可写</td>
<td>
<?php if (is_writable('../view')): ?> 可写
<?php else: ?> 不可写
<?php endif ?>
</td>
<td class="<?php if(is_writable('../view'))echo 'yes'; ?>">
<?php if (is_writable('../view')): ?>
<?php else: ?> ×
<?php endif ?>
</td>
</tr>
<tr>
<td>./install</td>
@ -94,7 +136,7 @@
</div>
<script>
function testClick() {
if ($('.yes').length != 5) {
if ($('.yes').length != 8) {
alert('您的配置或权限不符合要求');
} else {
location.href = '{:url('index/create')}';

View File

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

View File

@ -20,7 +20,7 @@ layui.define(['laytpl', 'layer', 'element', 'util'], function(exports){
,tableName: 'layuiAdmin' //本地存储表名
,MOD_NAME: 'admin' //模块事件名
,debug: true //是否开启调试模式。如开启,接口异常时会抛出异常 URL 等信息
,debug: false //是否开启调试模式。如开启,接口异常时会抛出异常 URL 等信息
//自定义请求字段
,request: {

View File

@ -24,14 +24,14 @@ layui.define(['table', 'form'], function(exports){
,{field: 'nick', title: '昵称',minWidth: 100}
,{field: 'avatar', title: '头像', width: 80, templet: '#imgTpl'}
//,{field: 'phone', title: '手机',width: 80}
,{field: 'email', title: '邮箱'}
,{field: 'email', title: '邮箱', width: 120}
,{field: 'sex', width: 60, title: '性别',templet: '#sex'}
,{field: 'ip', title: '登录IP'}
,{field: 'city', title: '城市'}
,{field: 'logintime', title: '最后登录',minWidth: 150, sort: true}
,{field: 'jointime', title: '注册时间',minWidth: 120, sort: true}
,{field: 'check', title: '状态', templet: '#buttonCheck', minWidth: 80, align: 'center'}
,{field: 'auth', title: '超级管理员', templet: '#buttonAuth', width: 60, align: 'center'}
,{field: 'ip', title: '登录IP', width: 100}
,{field: 'city', title: '城市', width: 80}
,{field: 'logintime', title: '最后登录',width: 150, sort: true}
,{field: 'jointime', title: '注册时间',width: 110, sort: true}
,{field: 'check', title: '状态', templet: '#buttonCheck', width: 95, align: 'center'}
,{field: 'auth', title: '超级管理员', templet: '#buttonAuth', width: 80, align: 'center'}
,{title: '操作', width: 150, align:'center', toolbar: '#table-useradmin-webuser'}
]]
,page: true
@ -142,15 +142,15 @@ layui.define(['table', 'form'], function(exports){
elem: '#LAY-user-back-manage'
,url: adminIndex //模拟接口
,cols: [[
{type: 'checkbox', fixed: 'left'}
,{field: 'id', width: 80, title: 'ID', sort: true}
,{field: 'loginname', title: '登录名'}
,{field: 'telphone', title: '手机'}
,{field: 'email', title: '邮箱'}
,{field: 'check', title:'审核状态', templet: '#buttonTpl', minWidth: 80, align: 'center'}
,{field: 'ip', title: 'IP'}
,{field: 'logintime', title: '最后登陆'}
,{title: '操作', width: 150, align: 'center', fixed: 'right', toolbar: '#table-useradmin-admin'}
{type: 'checkbox'}
,{field: 'id', width: 60, title: 'ID', sort: true}
,{field: 'loginname', title: '登录名', width: 100}
,{field: 'telphone', title: '手机', width: 120}
,{field: 'email', title: '邮箱', minWidth: 150}
,{field: 'check', title:'审核状态', templet: '#buttonTpl', width: 100, align: 'center'}
,{field: 'ip', title: 'IP', width: 100}
,{field: 'logintime', title: '最后登陆', width: 150}
,{title: '操作', width: 150, align: 'center', toolbar: '#table-useradmin-admin'}
]]
,text: '对不起,加载出现异常!'
});
@ -253,13 +253,12 @@ layui.define(['table', 'form'], function(exports){
elem: '#LAY-user-back-role'
,url: authGroupList //role接口
,cols: [[
{type: 'checkbox', fixed: 'left'}
,{field: 'id', width: 80, title: 'ID', sort: true}
,{field: 'rolename', title: '角色名'}
,{field: 'limits', title: '拥有权限'}
,{field: 'descr', title: '具体描述'}
,{field: 'check', title: '角色审核', toolbar: '#buttonCheck'}
,{title: '操作', width: 150, align: 'center', fixed: 'right', toolbar: '#table-useradmin-admin'}
{field: 'id', width: 60, title: 'ID', sort: true}
,{field: 'rolename', title: '角色名', width: 120}
,{field: 'limits', title: '拥有权限', minWidth: 150}
,{field: 'descr', title: '具体描述', width: 120}
,{field: 'check', title: '角色审核', toolbar: '#buttonCheck', width: 95}
,{title: '操作', width: 150, align: 'center', toolbar: '#table-useradmin-admin'}
]]
,text: '对不起,加载出现异常!'
});
@ -373,12 +372,11 @@ layui.define(['table', 'form'], function(exports){
elem: '#LAY-user-back-group'
,url: authAccessIndex //用户组access接口
,cols: [[
{type: 'checkbox', fixed: 'left'}
,{field: 'id', width: 80, title: 'ID', sort: true}
{field: 'id', width: 60, title: 'ID', sort: true}
,{field: 'username', title: '管理员'}
,{field: 'title', title: '权限'}
,{field: 'check', title: '状态', toolbar: '#buttonCheck'}
,{title: '操作', width: 150, align: 'center', fixed: 'right', toolbar: '#table-useradmin-admin'}
,{field: 'check', title: '状态', toolbar: '#buttonCheck', width: 95}
,{title: '操作', width: 150, align: 'center', toolbar: '#table-useradmin-admin'}
]]
,text: '对不起,加载出现异常!'
});

View File

@ -83,12 +83,6 @@
{/volist}
</dl>
<!--自定义-->
<div class="fly-panel">
<div class="fly-panel-title">{:lang('official products')}</div>
<div class="fly-panel-main">
<a href="http://www.aieok.com" target="_blank" class="fly-zanzhu" style="background-color: #5FB878;">TaoLer 1.0 - 旗舰之作</a>
</div>
</div>
<div class="fly-panel" style="padding: 20px 0; text-align: center;">
{volist name="ad_comm" id="vo"}
<a href="{$vo.slid_href}" target="_blank"><img src="{$vo.slid_img}" style="max-width: 100%;"></a>