Dashboard.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\model\User;
  4. use app\common\controller\Backend;
  5. use think\Db;
  6. /**
  7. * 控制台
  8. *
  9. * @icon fa fa-dashboard
  10. * @remark 用于展示当前系统中的统计数据、统计报表及重要实时数据
  11. */
  12. class Dashboard extends Backend
  13. {
  14. /**
  15. * 查看
  16. */
  17. public function index()
  18. {
  19. $this->view->assign([
  20. //总人数
  21. 'totaluser' => User::count(),
  22. //vip人数
  23. 'vipuser' => Db::name('user_wallet')->where('vip_endtime','>',time())->count(),
  24. //今日vip充值
  25. 'today_vip_recharge' => Db::name('pay_order')->where('table_name','vip_recharge')->where('order_status',1)->whereTime('notifytime','today')->sum('order_amount'),
  26. //本月vip充值
  27. 'month_vip_recharge' => Db::name('pay_order')->where('table_name','vip_recharge')->where('order_status',1)->whereTime('notifytime','month')->sum('order_amount'),
  28. //今日金币充值
  29. 'today_gold_recharge' => Db::name('pay_order')->where('table_name','gold_recharge')->where('order_status',1)->whereTime('notifytime','today')->sum('order_amount'),
  30. //本月金币充值
  31. 'month_gold_recharge' => Db::name('pay_order')->where('table_name','gold_recharge')->where('order_status',1)->whereTime('notifytime','month')->sum('order_amount'),
  32. //今日礼物总额
  33. 'today_gift' => Db::name('gift_user_typing')->whereTime('createtime','today')->sum('total_price'),
  34. //本月礼物总额
  35. 'month_gift' => Db::name('gift_user_typing')->whereTime('createtime','month')->sum('total_price'),
  36. ]);
  37. return $this->view->fetch();
  38. }
  39. }