增加数据库优化控制

This commit is contained in:
Anyon 2020-04-10 11:01:45 +08:00
parent 0810c4c7e0
commit 57fa6ffd27
3 changed files with 15 additions and 2 deletions

View File

@ -42,7 +42,7 @@ class Plugs extends Controller
* 网站压缩发布
* @login true
*/
public function optimize()
public function online()
{
try {
if (AdminService::instance()->getUserName() !== 'admin') {
@ -95,4 +95,16 @@ class Plugs extends Controller
}
}
/**
* 优化数据库
* @login true
*/
public function optimize()
{
if (AdminService::instance()->getUserName() !== 'admin') {
$this->error('只有超级管理员才能操作!');
}
$this->_queue('优化数据库所有数据表', 'xadmin:dbOptimize', 0, [], 0, 0);
}
}

View File

@ -10,6 +10,7 @@
<input type="checkbox" lay-skin="switch" lay-text="生产模式|开发模式" lay-filter="ThinkAdminDebug" checked>
<!--{/if}-->
</div>
<a class="layui-btn layui-btn-sm layui-btn-primary" data-queue="{:url('admin/api.plugs/optimize')}">优化数据表</a>
<script>form.render()</script>
{/if}

View File

@ -51,7 +51,7 @@
<dd lay-unselect><a data-modal="{:url('admin/index/info',['id'=>session('user.id')])}"><i class="layui-icon layui-icon-set-fill margin-right-5"></i> 基本资料</a></dd>
<dd lay-unselect><a data-modal="{:url('admin/index/pass',['id'=>session('user.id')])}"><i class="layui-icon layui-icon-component margin-right-5"></i> 安全设置</a></dd>
{if session('user.username') eq 'admin'}
<dd lay-unselect><a data-load="{:url('admin/api.plugs/optimize')}"><i class="layui-icon layui-icon-template-1 margin-right-5"></i> 缓存加速</a></dd>
<dd lay-unselect><a data-load="{:url('admin/api.plugs/online')}"><i class="layui-icon layui-icon-template-1 margin-right-5"></i> 缓存加速</a></dd>
<dd lay-unselect><a data-load="{:url('admin/api.plugs/clear')}"><i class="layui-icon layui-icon-fonts-clear margin-right-5"></i> 清理缓存</a></dd>
{/if}
<dd lay-unselect><a data-load="{:url('admin/login/out')}" data-confirm="确定要退出登录吗?"><i class="layui-icon layui-icon-release margin-right-5"></i> 退出登录</a></dd>