where('jointime', 'between time', [$starttime, $endtime]) ->field('jointime, status, COUNT(*) AS nums, DATE_FORMAT(FROM_UNIXTIME(jointime), "%Y-%m-%d") AS join_date') ->group('join_date') ->select(); for ($time = $starttime; $time <= $endtime;) { $column[] = date("Y-m-d", $time); $time += 86400; } $userlist = array_fill_keys($column, 0); foreach ($joinlist as $k => $v) { $userlist[$v['join_date']] = $v['nums']; } $this->view->assign([ 'totaluser' => User::count(), 'usedBoxOrderCount' => Order::where('status','used')->count(), 'totalgoods' => Goods::count(), 'totalbox' => Box::count(), 'todayusersignup' => User::whereTime('jointime', 'today')->count(), 'todayuserlogin' => User::whereTime('logintime', 'today')->count(), 'sevendau' => User::whereTime('jointime|logintime|prevtime', '-7 days')->count(), 'thirtydau' => User::whereTime('jointime|logintime|prevtime', '-30 days')->count(), 'threednu' => User::whereTime('jointime', '-3 days')->count(), 'sevendnu' => User::whereTime('jointime', '-7 days')->count(), 'money_box_unpay' => Order::where('status','unpay')->sum('rmb_amount'), 'money_box_paid' => Order::where('status','unused')->whereOr('status','used')->sum('rmb_amount'), 'money_recharge_unpay' => Rechargeorder::where('status','unpay')->sum('rmb_amount'), 'money_recharge_paid' => Rechargeorder::where('status','paid')->sum('rmb_amount'), 'attachmentnums' => Attachment::count(), 'attachmentsize' => Attachment::sum('filesize'), 'picturenums' => Attachment::where('mimetype', 'like', 'image/%')->count(), 'picturesize' => Attachment::where('mimetype', 'like', 'image/%')->sum('filesize'), 'today_uv' => db("uv")->whereTime("createtime", "today")->count(), 'total_uv' => db("uv")->count(), ]); $this->assignconfig('column', array_keys($userlist)); $this->assignconfig('userdata', array_values($userlist)); return $this->view->fetch(); } }