123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?php
- namespace app\admin\controller;
- use app\admin\model\RechargeModel;
- use app\api\controller\Order;
- use app\api\controller\User;
- use app\api\model\OrderModel;
- use app\api\model\QueueModel;
- use app\api\model\UsersModel;
- use app\common\controller\Backend;
- use think\Config;
- use think\Db;
- /**
- * 控制台
- *
- * @icon fa fa-dashboard
- * @remark 用于展示当前系统中的统计数据、统计报表及重要实时数据
- */
- class Dashboard extends Backend
- {
- /**
- * 查看
- */
- public function index()
- {
- $seventtime = \fast\Date::unixtime('day', -7);
- $paylist = $createlist = [];
- for ($i = 0; $i < 7; $i++) {
- $day = date("Y-m-d", $seventtime + ($i * 86400));
- $createlist[$day] = mt_rand(20, 200);
- $paylist[$day] = mt_rand(1, mt_rand(1, $createlist[$day]));
- }
- $hooks = config('addons.hooks');
- $uploadmode = isset($hooks['upload_config_init']) && $hooks['upload_config_init'] ? implode(',', $hooks['upload_config_init']) : 'local';
- $addonComposerCfg = ROOT_PATH . '/vendor/karsonzhang/fastadmin-addons/composer.json';
- Config::parse($addonComposerCfg, "json", "composer");
- $config = Config::get("composer");
- $addonVersion = isset($config['version']) ? $config['version'] : __('Unknown');
- // VIP开通次数
- $vipBuyNum = \app\admin\model\Viplog::where('pay_status', 1)->count();
- // 排队次数
- $queueNum = QueueModel::where('pay_status', 1)->count();
- // 排队总收入
- $queueIncome = QueueModel::where('pay_status', 1)->sum('amount');
- // 排队总支出
- $queueOut = QueueModel::where('pay_status', 1)->sum('income');
- // 话费充值次数
- $rechargeNum = RechargeModel::where('pay_status', 1)->count();
- // 话费充值收入
- $rechargeIncome = RechargeModel::where('pay_status', 1)->sum('final_fee');
- // 话费充值支出
- $rechargeOut = RechargeModel::where('pay_status', 1)->sum('price');
- // 待发货订单
- $dafaihuo = OrderModel::where('state', 2)->count();
- // 退款订单
- $tuikuan = OrderModel::where('state', 4)->count();
- // 商城总收入
- $zongmongey = OrderModel::where('state', 6)->sum('money');
- // 提现总支出
- $tixian = Db::name('cash_log')->where('state', 2)->sum('money');
- // 会员总数
- $totaluser = Db::name('users')->count();
- // 普通会员总数
- $pt = UsersModel::where('user_level',1)->count();
- // 店长总数
- $dianzhang = UsersModel::where('user_level',2)->count();
- // 经理总数
- $jingli = UsersModel::where('user_level',3)->count();
- // 总监总数
- $zongjian = UsersModel::where('user_level',4)->count();
- // 董事总数
- $dongshi = UsersModel::where('user_level',5)->count();
- // vip会员总数
- $vip = UsersModel::where('user_level',6)->count();
- $this->view->assign([
- 'totaluser' => $totaluser,
- 'totalviews' => $pt,
- 'totalorder' => $dianzhang,
- 'totalorderamount' => $jingli,
- 'todayuserlogin' => $zongjian,
- 'todayusersignup' => $dongshi,
- 'todayorder' => 2324,
- 'unsettleorder' => 132,
- 'sevendnu' => '80%',
- 'vip' => $vip,
- 'paylist' => $paylist,
- 'createlist' => $createlist,
- 'addonversion' => $addonVersion,
- 'uploadmode' => $uploadmode,
- 'vipBuyNum' => $vipBuyNum,
- 'queueIncome' => $queueIncome,
- 'queueOut' => $queueOut,
- 'rechargeIncome' => $rechargeIncome,
- 'rechargeNum' => $rechargeNum,
- 'rechargeOut' => $rechargeOut,
- 'daifahuo' => $dafaihuo,
- 'tuikuan' => $tuikuan,
- 'zongmoney' => $zongmongey,
- 'tixian' => $tixian,
- ]);
- return $this->view->fetch();
- }
- }
|