Command.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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/command', 'title' => '生成并执行命令'],
  26. ['name' => 'command/execute', 'title' => '再次执行命令'],
  27. ['name' => 'command/del', 'title' => '删除'],
  28. ['name' => 'command/multi', 'title' => '批量更新'],
  29. ]
  30. ]
  31. ];
  32. Menu::create($menu);
  33. return true;
  34. }
  35. /**
  36. * 插件卸载方法
  37. * @return bool
  38. */
  39. public function uninstall()
  40. {
  41. Menu::delete('command');
  42. return true;
  43. }
  44. /**
  45. * 插件启用方法
  46. * @return bool
  47. */
  48. public function enable()
  49. {
  50. Menu::enable('command');
  51. return true;
  52. }
  53. /**
  54. * 插件禁用方法
  55. * @return bool
  56. */
  57. public function disable()
  58. {
  59. Menu::disable('command');
  60. return true;
  61. }
  62. }