Plugs.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkAdmin
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2022 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: https://thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // | 免费声明 ( https://thinkadmin.top/disclaimer )
  11. // +----------------------------------------------------------------------
  12. // | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
  13. // | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
  14. // +----------------------------------------------------------------------
  15. namespace app\admin\controller\api;
  16. use think\admin\Controller;
  17. use think\admin\service\AdminService;
  18. /**
  19. * 通用插件管理
  20. * Class Plugs
  21. * @package app\admin\controller\api
  22. */
  23. class Plugs extends Controller
  24. {
  25. /**
  26. * 图标选择器
  27. * @login true
  28. */
  29. public function icon()
  30. {
  31. $this->title = '图标选择器';
  32. $this->field = $this->app->request->get('field', 'icon');
  33. $this->fetch(realpath(__DIR__ . '/../../view/api/icon.html'));
  34. }
  35. /**
  36. * 优化数据库
  37. * @login true
  38. */
  39. public function optimize()
  40. {
  41. if (AdminService::instance()->isSuper()) {
  42. sysoplog('系统运维管理', '创建数据库优化任务');
  43. $this->_queue('优化数据库所有数据表', 'xadmin:database optimize');
  44. } else {
  45. $this->error('只有超级管理员才能操作!');
  46. }
  47. }
  48. }