Poster.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. namespace addons\poster;
  3. use app\common\library\Menu;
  4. use think\Addons;
  5. use think\Request;
  6. /**
  7. * 海报管理插件
  8. */
  9. class Poster extends Addons
  10. {
  11. /**
  12. * 插件安装方法
  13. * @return bool
  14. */
  15. public function install()
  16. {
  17. $menu = [
  18. [
  19. 'name' => 'poster',
  20. 'title' => '海报生成插件',
  21. 'icon' => 'fa fa-qrcode',
  22. 'remark' => '设计生成海报,支持会员昵称、头像、自定义图片、自定义二维码。',
  23. 'sublist' => [
  24. ['name' => 'poster/index', 'title' => '查看'],
  25. ['name' => 'poster/add', 'title' => '添加'],
  26. ['name' => 'poster/edit', 'title' => '修改'],
  27. ['name' => 'poster/del', 'title' => '删除'],
  28. ['name' => 'poster/multi', 'title' => '批量更新'],
  29. ['name' => 'poster/posterrecord', 'title' => '查看记录'],
  30. ['name' => 'poster/clear', 'title' => '清除海报'],
  31. ]
  32. ]
  33. ];
  34. Menu::create($menu);
  35. return true;
  36. }
  37. /**
  38. * 插件卸载方法
  39. * @return bool
  40. */
  41. public function uninstall()
  42. {
  43. Menu::delete('poster');
  44. return true;
  45. }
  46. /**
  47. * 插件启用方法
  48. */
  49. public function enable()
  50. {
  51. Menu::enable('poster');
  52. }
  53. /**
  54. * 插件禁用方法
  55. */
  56. public function disable()
  57. {
  58. Menu::disable('poster');
  59. }
  60. /**
  61. * 会员中心边栏后
  62. * @return mixed
  63. * @throws \Exception
  64. */
  65. public function userSidenavAfter()
  66. {
  67. $request = Request::instance();
  68. $controllername = strtolower($request->controller());
  69. $actionname = strtolower($request->action());
  70. $data = [
  71. 'actionname' => $actionname,
  72. 'controllername' => $controllername
  73. ];
  74. return $this->fetch('view/hook/user_sidenav_after', $data);
  75. }
  76. }