123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace app\admin\controller;
- use app\admin\model\User;
- use app\common\controller\Backend;
- use think\Db;
- /**
- * 控制台
- *
- * @icon fa fa-dashboard
- * @remark 用于展示当前系统中的统计数据、统计报表及重要实时数据
- */
- class Dashboard extends Backend
- {
- /**
- * 查看
- */
- public function index()
- {
- $this->view->assign([
- //总人数
- 'totaluser' => User::count(),
- //vip人数
- 'vipuser' => Db::name('user_wallet')->where('vip_endtime','>',time())->count(),
- //今日vip充值
- 'today_vip_recharge' => Db::name('pay_order')->where('table_name','vip_recharge')->where('order_status',1)->whereTime('notifytime','today')->sum('order_amount'),
- //本月vip充值
- 'month_vip_recharge' => Db::name('pay_order')->where('table_name','vip_recharge')->where('order_status',1)->whereTime('notifytime','month')->sum('order_amount'),
- //今日金币充值
- 'today_gold_recharge' => Db::name('pay_order')->where('table_name','gold_recharge')->where('order_status',1)->whereTime('notifytime','today')->sum('order_amount'),
- //本月金币充值
- 'month_gold_recharge' => Db::name('pay_order')->where('table_name','gold_recharge')->where('order_status',1)->whereTime('notifytime','month')->sum('order_amount'),
- //今日礼物总额
- 'today_gift' => Db::name('gift_user_typing')->whereTime('createtime','today')->sum('total_price'),
- //本月礼物总额
- 'month_gift' => Db::name('gift_user_typing')->whereTime('createtime','month')->sum('total_price'),
- ]);
- return $this->view->fetch();
- }
- }
|