IndexController.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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\Models\UserModel;
  13. use App\Models\AdminRomModel;
  14. use App\Services\Common\AdminService;
  15. use App\Services\Common\MenuService;
  16. use App\Services\Common\UserService;
  17. use App\Services\RedisService;
  18. /**
  19. * 系统主页控制器
  20. * @author laravel开发员
  21. * @since 2020/11/10
  22. * Class IndexController
  23. * @package App\Http\Controllers
  24. */
  25. class IndexController extends Backend
  26. {
  27. /**
  28. * 构造函数
  29. * @author laravel开发员
  30. * @since 2020/11/10
  31. * IndexController constructor.
  32. */
  33. public function __construct()
  34. {
  35. parent::__construct();
  36. }
  37. /**
  38. * 后台主页
  39. * @author laravel开发员
  40. * @since 2020/11/10
  41. */
  42. public function getMenuList()
  43. {
  44. $menuService = new MenuService();
  45. $menuList = $menuService->getPermissionList($this->userId);
  46. return $menuList;
  47. }
  48. /**
  49. * 获取个人信息
  50. * @return array
  51. * @since 2020/11/10
  52. * @author laravel开发员
  53. */
  54. public function getUserInfo()
  55. {
  56. $userService = new UserService();
  57. $result = $userService->getUserInfo($this->userId);
  58. return $result;
  59. }
  60. /**
  61. * 更新个人资料
  62. * @return mixed
  63. * @since 2020/11/11
  64. * @author laravel开发员
  65. */
  66. public function updateUserInfo()
  67. {
  68. $userService = new UserService();
  69. $result = $userService->updateUserInfo($this->userId);
  70. return $result;
  71. }
  72. /**
  73. * 更新密码
  74. * @return mixed
  75. * @since 2020/11/11
  76. * @author laravel开发员
  77. */
  78. public function updatePwd()
  79. {
  80. $userService = new UserService();
  81. $result = $userService->updatePwd($this->userId);
  82. return $result;
  83. }
  84. /**
  85. * 清除缓存
  86. * @return array
  87. */
  88. public function clearCache()
  89. {
  90. RedisService::keyDel("caches:articles:*");
  91. RedisService::keyDel("caches:wallet:*");
  92. RedisService::keyDel("caches:live:*");
  93. RedisService::keyDel("caches:goods:*");
  94. RedisService::keyDel("caches:orders:*");
  95. RedisService::keyDel("caches:videos:*");
  96. RedisService::keyDel("caches:message:*");
  97. RedisService::keyDel("caches:chats:*");
  98. RedisService::keyDel("caches:articles:*");
  99. RedisService::keyDel("caches:member:*");
  100. RedisService::keyDel("caches:acceptor*");
  101. RedisService::keyDel("caches:index*");
  102. RedisService::keyDel("caches:config*");
  103. RedisService::keyDel("caches:m_collect*");
  104. RedisService::keyDel("caches:task:scene*");
  105. return message(MESSAGE_OK, true);
  106. }
  107. }