IndexController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Http\Controllers\Admin;
  12. use App\Services\Common\MenuService;
  13. use App\Services\Common\UserService;
  14. use App\Services\RedisService;
  15. /**
  16. * 系统主页控制器
  17. * @author laravel开发员
  18. * @since 2020/11/10
  19. * Class IndexController
  20. * @package App\Http\Controllers
  21. */
  22. class IndexController extends Backend
  23. {
  24. /**
  25. * 构造函数
  26. * @author laravel开发员
  27. * @since 2020/11/10
  28. * IndexController constructor.
  29. */
  30. public function __construct()
  31. {
  32. parent::__construct();
  33. }
  34. /**
  35. * 后台主页
  36. * @author laravel开发员
  37. * @since 2020/11/10
  38. */
  39. public function getMenuList()
  40. {
  41. $menuService = new MenuService();
  42. $menuList = $menuService->getPermissionList($this->userId);
  43. return $menuList;
  44. }
  45. /**
  46. * 获取个人信息
  47. * @return array
  48. * @since 2020/11/10
  49. * @author laravel开发员
  50. */
  51. public function getUserInfo()
  52. {
  53. $userService = new UserService();
  54. $result = $userService->getUserInfo($this->userId);
  55. return $result;
  56. }
  57. /**
  58. * 更新个人资料
  59. * @return mixed
  60. * @since 2020/11/11
  61. * @author laravel开发员
  62. */
  63. public function updateUserInfo()
  64. {
  65. $userService = new UserService();
  66. $result = $userService->updateUserInfo($this->userId);
  67. return $result;
  68. }
  69. /**
  70. * 更新密码
  71. * @return mixed
  72. * @since 2020/11/11
  73. * @author laravel开发员
  74. */
  75. public function updatePwd()
  76. {
  77. $userService = new UserService();
  78. $result = $userService->updatePwd($this->userId);
  79. return $result;
  80. }
  81. /**
  82. * 清除缓存
  83. * @return array
  84. */
  85. public function clearCache()
  86. {
  87. RedisService::keyDel("caches:admin*");
  88. RedisService::keyDel("caches:balance*");
  89. RedisService::keyDel("caches:index*");
  90. RedisService::keyDel("caches:advert*");
  91. RedisService::keyDel("caches:article*");
  92. RedisService::keyDel("caches:member*");
  93. RedisService::keyDel("caches:team*");
  94. RedisService::keyDel("caches:conf*");
  95. RedisService::keyDel("caches:order*");
  96. RedisService::keyDel("caches:pledge*");
  97. RedisService::keyDel("caches:sbtPrice*");
  98. RedisService::keyDel("caches:wallet*");
  99. RedisService::keyDel("caches:withdraw*");
  100. RedisService::keyDel("caches:account*");
  101. RedisService::keyDel("laravel_cache:model*");
  102. return message(MESSAGE_OK, true);
  103. }
  104. }