Wechat.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?php
  2. namespace addons\wechat;
  3. use app\common\library\Menu;
  4. use think\Addons;
  5. /**
  6. * 微信插件
  7. */
  8. class Wechat extends Addons
  9. {
  10. /**
  11. * 插件安装方法
  12. * @return bool
  13. */
  14. public function install()
  15. {
  16. $menu = [
  17. [
  18. 'name' => 'wechat',
  19. 'title' => '微信管理',
  20. 'icon' => 'fa fa-wechat',
  21. 'sublist' => [
  22. [
  23. 'name' => 'wechat/autoreply',
  24. 'title' => '自动回复管理',
  25. 'icon' => 'fa fa-reply-all',
  26. 'sublist' => [
  27. ['name' => 'wechat/autoreply/index', 'title' => '查看'],
  28. ['name' => 'wechat/autoreply/add', 'title' => '添加'],
  29. ['name' => 'wechat/autoreply/edit', 'title' => '修改'],
  30. ['name' => 'wechat/autoreply/del', 'title' => '删除'],
  31. ['name' => 'wechat/autoreply/multi', 'title' => '批量更新'],
  32. ]
  33. ],
  34. [
  35. 'name' => 'wechat/config',
  36. 'title' => '配置管理',
  37. 'icon' => 'fa fa-cog',
  38. 'sublist' => [
  39. ['name' => 'wechat/config/index', 'title' => '查看'],
  40. ['name' => 'wechat/config/add', 'title' => '添加'],
  41. ['name' => 'wechat/config/edit', 'title' => '修改'],
  42. ['name' => 'wechat/config/del', 'title' => '删除'],
  43. ['name' => 'wechat/config/multi', 'title' => '批量更新'],
  44. ]
  45. ],
  46. [
  47. 'name' => 'wechat/menu',
  48. 'title' => '菜单管理',
  49. 'icon' => 'fa fa-list',
  50. 'sublist' => [
  51. ['name' => 'wechat/menu/index', 'title' => '查看'],
  52. ['name' => 'wechat/menu/add', 'title' => '添加'],
  53. ['name' => 'wechat/menu/edit', 'title' => '修改'],
  54. ['name' => 'wechat/menu/del', 'title' => '删除'],
  55. ['name' => 'wechat/menu/remote', 'title' => '加载远程菜单'],
  56. ['name' => 'wechat/menu/sync', 'title' => '同步'],
  57. ['name' => 'wechat/menu/multi', 'title' => '批量更新'],
  58. ]
  59. ],
  60. [
  61. 'name' => 'wechat/response',
  62. 'title' => '资源管理',
  63. 'icon' => 'fa fa-list-alt',
  64. 'sublist' => [
  65. ['name' => 'wechat/response/index', 'title' => '查看'],
  66. ['name' => 'wechat/response/add', 'title' => '添加'],
  67. ['name' => 'wechat/response/edit', 'title' => '修改'],
  68. ['name' => 'wechat/response/del', 'title' => '删除'],
  69. ['name' => 'wechat/response/select', 'title' => '选择'],
  70. ['name' => 'wechat/response/multi', 'title' => '批量更新'],
  71. ]
  72. ],
  73. [
  74. 'name' => 'wechat/plan',
  75. 'title' => '微信模版列表管理',
  76. 'icon' => 'fa fa-list',
  77. 'sublist' => [
  78. ['name' => 'wechat/plan/index', 'title' => '查看'],
  79. ['name' => 'wechat/plan/add', 'title' => '添加'],
  80. ['name' => 'wechat/plan/edit', 'title' => '修改'],
  81. ['name' => 'wechat/plan/del', 'title' => '删除'],
  82. ['name' => 'wechat/plan/multi', 'title' => '批量更新'],
  83. ]
  84. ],
  85. [
  86. 'name' => 'wechat/planRecord',
  87. 'title' => '微信签约记录',
  88. 'icon' => 'fa fa-list',
  89. 'sublist' => [
  90. ['name' => 'wechat/plan_record/index', 'title' => '查看'],
  91. ['name' => 'wechat/plan_record/add', 'title' => '添加'],
  92. ['name' => 'wechat/plan_record/edit', 'title' => '修改'],
  93. ['name' => 'wechat/plan_record/del', 'title' => '删除'],
  94. ['name' => 'wechat/plan_record/multi', 'title' => '批量更新'],
  95. ]
  96. ]
  97. ]
  98. ]
  99. ];
  100. Menu::create($menu);
  101. return true;
  102. }
  103. /**
  104. * 插件卸载方法
  105. * @return bool
  106. */
  107. public function uninstall()
  108. {
  109. Menu::delete('wechat');
  110. return true;
  111. }
  112. /**
  113. * 插件启用方法
  114. */
  115. public function enable()
  116. {
  117. Menu::enable('wechat');
  118. }
  119. /**
  120. * 插件禁用方法
  121. */
  122. public function disable()
  123. {
  124. Menu::disable('wechat');
  125. }
  126. }