Recharge.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. namespace addons\recharge;
  3. use app\common\library\Menu;
  4. use think\Addons;
  5. use think\Request;
  6. /**
  7. * 余额充值插件
  8. */
  9. class Recharge extends Addons
  10. {
  11. /**
  12. * 插件安装方法
  13. * @return bool
  14. */
  15. public function install()
  16. {
  17. $menu = [
  18. [
  19. 'name' => 'user/moneylog',
  20. 'title' => '会员余额日志',
  21. 'icon' => 'fa fa-money',
  22. 'sublist' => [
  23. ['name' => 'user/moneylog/index', 'title' => '查看'],
  24. ['name' => 'user/moneylog/add', 'title' => '添加'],
  25. ['name' => 'user/moneylog/edit', 'title' => '修改'],
  26. ['name' => 'user/moneylog/del', 'title' => '删除'],
  27. ['name' => 'user/moneylog/multi', 'title' => '批量更新'],
  28. ]
  29. ],
  30. [
  31. 'name' => 'user/scorelog',
  32. 'title' => '会员积分日志',
  33. 'icon' => 'fa fa-circle-o',
  34. 'sublist' => [
  35. ['name' => 'user/scorelog/index', 'title' => '查看'],
  36. ['name' => 'user/scorelog/add', 'title' => '添加'],
  37. ['name' => 'user/scorelog/edit', 'title' => '修改'],
  38. ['name' => 'user/scorelog/del', 'title' => '删除'],
  39. ['name' => 'user/scorelog/multi', 'title' => '批量更新'],
  40. ]
  41. ]
  42. ];
  43. Menu::create($menu, 'user');
  44. return true;
  45. }
  46. /**
  47. * 插件卸载方法
  48. * @return bool
  49. */
  50. public function uninstall()
  51. {
  52. Menu::delete('user/moneylog');
  53. Menu::delete('user/scorelog');
  54. return true;
  55. }
  56. /**
  57. * 插件启用方法
  58. * @return bool
  59. */
  60. public function enable()
  61. {
  62. Menu::enable('user/moneylog');
  63. Menu::enable('user/scorelog');
  64. return true;
  65. }
  66. /**
  67. * 插件禁用方法
  68. * @return bool
  69. */
  70. public function disable()
  71. {
  72. Menu::disable('user/moneylog');
  73. Menu::disable('user/scorelog');
  74. return true;
  75. }
  76. /**
  77. * 会员中心边栏后
  78. * @return mixed
  79. * @throws \Exception
  80. */
  81. public function userSidenavAfter()
  82. {
  83. $request = Request::instance();
  84. $actionname = strtolower($request->action());
  85. $data = [
  86. 'actionname' => $actionname
  87. ];
  88. return $this->fetch('view/hook/user_sidenav_after', $data);
  89. }
  90. }