Command.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace addons\command;
  3. use app\common\library\Menu;
  4. use think\Addons;
  5. /**
  6. * 在线命令插件
  7. */
  8. class Command extends Addons
  9. {
  10. /**
  11. * 插件安装方法
  12. * @return bool
  13. */
  14. public function install()
  15. {
  16. $menu = [
  17. [
  18. 'name' => 'command',
  19. 'title' => '在线命令管理',
  20. 'icon' => 'fa fa-terminal',
  21. 'sublist' => [
  22. ['name' => 'command/index', 'title' => '查看'],
  23. ['name' => 'command/add', 'title' => '添加'],
  24. ['name' => 'command/detail', 'title' => '详情'],
  25. ['name' => 'command/execute', 'title' => '运行'],
  26. ['name' => 'command/del', 'title' => '删除'],
  27. ['name' => 'command/multi', 'title' => '批量更新'],
  28. ]
  29. ]
  30. ];
  31. Menu::create($menu);
  32. return true;
  33. }
  34. /**
  35. * 插件卸载方法
  36. * @return bool
  37. */
  38. public function uninstall()
  39. {
  40. Menu::delete('command');
  41. return true;
  42. }
  43. /**
  44. * 插件启用方法
  45. * @return bool
  46. */
  47. public function enable()
  48. {
  49. Menu::enable('command');
  50. return true;
  51. }
  52. /**
  53. * 插件禁用方法
  54. * @return bool
  55. */
  56. public function disable()
  57. {
  58. Menu::disable('command');
  59. return true;
  60. }
  61. }