Home.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace app\worker\controller;
  3. use think\facade\Session;
  4. use app\worker\BaseController;
  5. use app\common\model\User as UserModel;
  6. use app\common\model\Agent as AgentModel;
  7. use app\common\model\Broker as BrokerModel;
  8. use app\common\model\ReportEntry as ReportEntryModel;
  9. use app\common\model\Admin as AdminModel;
  10. use app\common\model\Menu as MenuModel;
  11. use app\common\model\Worker as WorkerModel;
  12. use app\common\model\Comjobs as ComjobsModel;
  13. use app\common\model\Demand as DemandModel;
  14. use app\common\model\Supply as SupplyModel;
  15. class Home extends BaseController
  16. {
  17. public function index()
  18. {
  19. return view('index', [
  20. 'access_worker' => session('access_worker')
  21. ]);
  22. }
  23. public function console()
  24. {
  25. $workerid = $this->access_worker['id'];
  26. $where = array();
  27. $where[] = ['workerid', '=', $workerid];
  28. $comjobstol['today'] = ComjobsModel::whereDay('createtime')->where($where)->count();
  29. $comjobstol['yesterday'] = ComjobsModel::whereDay('createtime', 'yesterday')->where($where)->count();
  30. $comjobstol['week'] = ComjobsModel::whereWeek('createtime')->where($where)->count();
  31. $comjobstol['month'] = ComjobsModel::whereMonth('createtime')->where($where)->count();
  32. $demandtol['today'] = DemandModel::whereDay('createtime')->where($where)->count();
  33. $demandtol['yesterday'] = DemandModel::whereDay('createtime', 'yesterday')->where($where)->count();
  34. $demandtol['week'] = DemandModel::whereWeek('createtime')->where($where)->count();
  35. $demandtol['month'] = DemandModel::whereMonth('createtime')->where($where)->count();
  36. $supplytol['today'] = SupplyModel::whereDay('createtime')->where($where)->count();
  37. $supplytol['yesterday'] = SupplyModel::whereDay('createtime', 'yesterday')->where($where)->count();
  38. $supplytol['week'] = SupplyModel::whereWeek('createtime')->where($where)->count();
  39. $supplytol['month'] = SupplyModel::whereMonth('createtime')->where($where)->count();
  40. return view('home/console',[
  41. 'domain' => request()->domain(),
  42. 'access_admin' => session('access_admin'),
  43. 'comjobstol' => $comjobstol,
  44. 'demandtol' => $demandtol,
  45. 'supplytol' => $supplytol
  46. ]);
  47. }
  48. }