优化后台判断与Library配合

This commit is contained in:
邹景立 2022-11-21 12:42:23 +08:00
parent 90228f0ff6
commit 6cbb687862
3 changed files with 7 additions and 10 deletions

View File

@ -94,7 +94,7 @@ class Auth extends Controller
{
$map = $this->_vali(['auth.require#id' => '权限ID不能为空']);
if (input('action') === 'get') {
if ($this->app->isDebug()) AdminService::clearCache();
if ($this->app->isDebug()) AdminService::clear();
$nodes = SystemNode::mk()->where($map)->column('node');
$this->success('获取权限节点成功!', AdminService::getTree($nodes));
} elseif (input('action') === 'save') {

View File

@ -99,14 +99,13 @@ class Menu extends Controller
protected function _form_filter(array &$vo)
{
if ($this->request->isGet()) {
$debug = $this->app->isDebug();
/* 清理权限节点 */
if ($isDebug = $this->app->isDebug()) {
AdminService::clearCache();
}
$debug && AdminService::clear();
/* 读取系统功能节点 */
$this->auths = [];
$this->nodes = MenuService::getList($isDebug);
foreach (NodeService::getMethods($isDebug) as $node => $item) {
$this->nodes = MenuService::getList($debug);
foreach (NodeService::getMethods($debug) as $node => $item) {
if ($item['isauth'] && substr_count($node, '/') >= 2) {
$this->auths[] = ['node' => $node, 'title' => $item['title']];
}

View File

@ -37,8 +37,7 @@ class System extends Controller
public function push()
{
if (AdminService::isSuper()) try {
AdminService::clearCache() && RuntimeService::push();
sysoplog('系统运维管理', '刷新创建路由缓存');
RuntimeService::push() && sysoplog('系统运维管理', '刷新发布运行缓存');
$this->success('网站缓存加速成功!', 'javascript:location.reload()');
} catch (HttpResponseException $exception) {
throw $exception;
@ -57,8 +56,7 @@ class System extends Controller
public function clear()
{
if (AdminService::isSuper()) try {
AdminService::clearCache() && RuntimeService::clear();
sysoplog('系统运维管理', '清理网站日志缓存');
RuntimeService::clear() && sysoplog('系统运维管理', '清理网站日志缓存');
$this->success('清空日志缓存成功!', 'javascript:location.reload()');
} catch (HttpResponseException $exception) {
throw $exception;