IndexController.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Laravel框架 [ Laravel ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 Laravel研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: wesmiler <12345678@qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Http\Controllers;
  12. use App\Models\UserModel;
  13. use App\Models\AdminRomModel;
  14. use App\Services\AdminService;
  15. use App\Services\MenuService;
  16. use App\Services\RedisService;
  17. use App\Services\UserService;
  18. /**
  19. * 系统主页控制器
  20. * @author wesmiler
  21. * @since 2020/11/10
  22. * Class IndexController
  23. * @package App\Http\Controllers
  24. */
  25. class IndexController extends Backend
  26. {
  27. /**
  28. * 构造函数
  29. * @author wesmiler
  30. * @since 2020/11/10
  31. * IndexController constructor.
  32. */
  33. public function __construct()
  34. {
  35. parent::__construct();
  36. }
  37. /**
  38. * 后台主页
  39. * @author wesmiler
  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 wesmiler
  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 wesmiler
  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 wesmiler
  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. RedisService::keyDel("caches:config:*");
  90. RedisService::keyDel("caches:index:*");
  91. RedisService::keyDel("caches:articles:*");
  92. RedisService::keyDel("caches:qrcodes:*");
  93. return message(MESSAGE_OK, true);
  94. }
  95. }