title = '图标选择器'; $this->field = input('field', 'icon'); $this->fetch(realpath(__DIR__ . '/../../view/api/icon.html')); } /** * 网站压缩发布 * @login true */ public function push() { try { if (AdminService::instance()->isSuper()) { $this->error('只有超级管理员才能操作!'); } $this->app->console->call('optimize:route'); $this->app->console->call('optimize:schema'); $this->success('网站缓存加速成功!'); } catch (HttpResponseException $exception) { throw $exception; } catch (\Exception $e) { $this->error($e->getMessage()); } } /** * 清理运行缓存 * @login true */ public function clear() { try { if (AdminService::instance()->isSuper()) { $this->error('只有超级管理员才能操作!'); } $data = SystemService::instance()->getRuntime(); $this->app->console->call('clear'); SystemService::instance()->setRuntime($data['app_map'], $data['app_run']); $this->success('清理网站缓存成功!'); } catch (HttpResponseException $exception) { throw $exception; } catch (\Exception $e) { $this->error($e->getMessage()); } } /** * 当前运行模式 * @login true */ public function debug() { if (input('state')) { if (AdminService::instance()->isSuper()) { $this->error('只有超级管理员才能操作!'); } SystemService::instance()->productMode(true); $this->success('已切换为生产模式!'); } else { SystemService::instance()->productMode(false); $this->success('已切换为开发模式!'); } } /** * 优化数据库 * @login true */ public function optimize() { if (AdminService::instance()->isSuper()) { $this->error('只有超级管理员才能操作!'); } $this->_queue('优化数据库所有数据表', 'xadmin:dbOptimize', 0, [], 0, 0); } }