Customcharts.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. namespace addons\customcharts;
  3. use app\common\library\Menu;
  4. use think\Addons;
  5. use think\Db;
  6. use app\common\library\Auth;
  7. use think\Config;
  8. use think\Loader;
  9. use think\Request;
  10. /**
  11. * 插件
  12. */
  13. class Customcharts extends Addons
  14. {
  15. /**
  16. * 插件安装方法
  17. * @return bool
  18. */
  19. public function install()
  20. {
  21. $menu = [
  22. [
  23. 'name' => 'customcharts',
  24. 'title' => 'DIY图表统计工具',
  25. 'icon' => 'fa fa-bar-chart',
  26. 'sublist' => [
  27. [
  28. 'name' => 'customcharts/totalnumber',
  29. 'title' => '数量统计管理',
  30. 'icon' => 'fa fa-circle-o',
  31. 'sublist' => [
  32. ['name' => 'customcharts/totalnumber/index', 'title' => '查看'],
  33. ['name' => 'customcharts/totalnumber/add', 'title' => '添加'],
  34. ['name' => 'customcharts/totalnumber/edit', 'title' => '编辑'],
  35. ['name' => 'customcharts/totalnumber/del', 'title' => '删除'],
  36. ]
  37. ],
  38. [
  39. 'name' => 'customcharts/chart',
  40. 'title' => '图表统计管理',
  41. 'icon' => 'fa fa-circle-o',
  42. 'sublist' => [
  43. ['name' => 'customcharts/chart/index', 'title' => '查看'],
  44. ['name' => 'customcharts/chart/add', 'title' => '添加'],
  45. ['name' => 'customcharts/chart/edit', 'title' => '编辑'],
  46. ['name' => 'customcharts/chart/del', 'title' => '删除'],
  47. ]
  48. ],
  49. [
  50. 'name' => 'customcharts/ranking',
  51. 'title' => '排行统计管理',
  52. 'icon' => 'fa fa-circle-o',
  53. 'sublist' => [
  54. ['name' => 'customcharts/ranking/index', 'title' => '查看'],
  55. ['name' => 'customcharts/ranking/add', 'title' => '添加'],
  56. ['name' => 'customcharts/ranking/edit', 'title' => '编辑'],
  57. ['name' => 'customcharts/ranking/del', 'title' => '删除'],
  58. ]
  59. ],
  60. [
  61. 'name' => 'customcharts/show',
  62. 'title' => '统计控制台',
  63. 'icon' => 'fa fa-circle-o',
  64. 'sublist' => [
  65. ['name' => 'customcharts/show/index', 'title' => '查看'],
  66. ]
  67. ]
  68. ]
  69. ]
  70. ];
  71. Menu::create($menu);
  72. }
  73. /**
  74. * 插件卸载方法
  75. * @return bool
  76. */
  77. public function uninstall()
  78. {
  79. Menu::delete('customcharts');
  80. return true;
  81. }
  82. /**
  83. * 插件启用方法
  84. */
  85. public function enable()
  86. {
  87. Menu::enable('customcharts');
  88. }
  89. /**
  90. * 插件禁用方法
  91. */
  92. public function disable()
  93. {
  94. Menu::disable('customcharts');
  95. }
  96. }