Index.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | A3Mall
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: xzncit <158373108@qq.com>
  8. // +----------------------------------------------------------------------
  9. namespace app\admin\controller\platform;
  10. use app\admin\controller\Auth;
  11. use think\facade\View;
  12. use think\facade\Request;
  13. use mall\response\Response;
  14. use app\admin\service\platform\Dashboard as DashboardService;
  15. class Index extends Auth {
  16. /**
  17. * 首页
  18. * @return string
  19. * @throws \think\db\exception\DataNotFoundException
  20. * @throws \think\db\exception\DbException
  21. * @throws \think\db\exception\ModelNotFoundException
  22. */
  23. public function index(){
  24. return View::fetch("",DashboardService::getData());
  25. }
  26. /**
  27. * 系统信息
  28. * @return string
  29. */
  30. public function info(){
  31. return View::fetch("info",DashboardService::getSystemInfo());
  32. }
  33. /**
  34. * 清理缓存
  35. * @return array|string|\think\response\Json
  36. */
  37. public function cache(){
  38. if(Request::isAjax()){
  39. try{
  40. $type = Request::get("type","","trim,strip_tags");
  41. if(empty($type)){
  42. return DashboardService::getCacheList();
  43. }
  44. DashboardService::clearCache($type);
  45. return Response::returnArray("清理缓存成功!",1);
  46. }catch (\Exception $ex){
  47. return Response::returnArray($ex->getMessage(),0);
  48. }
  49. }
  50. return View::fetch();
  51. }
  52. }