Dashboard.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace app\admin\controller;
  3. use app\common\controller\Backend;
  4. use think\Db;
  5. /**
  6. * 控制台
  7. *
  8. * @icon fa fa-dashboard
  9. * @remark 用于展示当前系统中的统计数据、统计报表及重要实时数据
  10. */
  11. class Dashboard extends Backend
  12. {
  13. /**
  14. * 查看
  15. */
  16. public function index()
  17. {
  18. //商户数
  19. $user_count = Db::name('user')->count();
  20. //师傅数
  21. $worker_count = Db::name('worker')->where('deletetime',NULL)->count();
  22. //公司数
  23. $company_count = Db::name('company')->where('deletetime',NULL)->count();
  24. //维保订单数
  25. $maintain_count = Db::name('maintain')->count();
  26. //检测下发数
  27. $jiance_count = Db::name('jiance')->count();
  28. $this->view->assign([
  29. 'user_count' => $user_count,
  30. 'worker_count' => $worker_count,
  31. 'company_count' => $company_count,
  32. 'maintain_count' => $maintain_count,
  33. 'jiance_count' => $jiance_count,
  34. ]);
  35. return $this->view->fetch();
  36. }
  37. }