<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Member\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Layout\AdminPage; use ModStart\Admin\Widget\DashboardItemA; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Util\ColorUtil; use ModStart\Core\Util\TimeUtil; use ModStart\Layout\Row; use ModStart\Widget\Box; use ModStart\Widget\Chart\Line; class MemberDashboardController extends Controller { public function index(AdminPage $WLCMC) { goto uvfaz; uvfaz: $WLCMC->pageTitle('用户统计'); goto pmOjR; sJ5KK: $WLCMC->append(Box::make(Line::make()->tableDailyCountLatest(array(array('title' => '总数', 'table' => 'member_user')), 30), '会员增长趋势')); goto DfMKV; pmOjR: $DoFzk = array(); goto gotsg; hmOrW: $DoFzk['lastWeekCount'] = ModelUtil::model('member_user')->where('created_at', '>=', date('Y-m-d 00:00:00', $j4tJ3))->where('created_at', '<=', date('Y-m-d 23:59:59', $j4tJ3 + TimeUtil::PERIOD_DAY * 7))->count(); goto INzoO; INzoO: $WLCMC->row(function (Row $B1vjt) use($DoFzk) { $B1vjt->column(4, DashboardItemA::makeIconNumberTitle('iconfont icon-user', ModelUtil::count('member_user'), '用户总数', modstart_admin_url('member'), ColorUtil::randomColor())); $B1vjt->column(4, DashboardItemA::makeIconNumberTitle('iconfont icon-user', $DoFzk['yesterdayCount'], '昨日增长', modstart_admin_url('member'), ColorUtil::randomColor())); $B1vjt->column(4, DashboardItemA::makeIconNumberTitle('iconfont icon-user', $DoFzk['lastWeekCount'], '上周增长', modstart_admin_url('member'), ColorUtil::randomColor())); }); goto sJ5KK; JD3OB: $j4tJ3 = time() - TimeUtil::PERIOD_DAY * 7 - TimeUtil::PERIOD_DAY * ($hiO6v - 1); goto hmOrW; gotsg: $DoFzk['yesterdayCount'] = ModelUtil::model('member_user')->where('created_at', '>=', TimeUtil::yesterdayStart())->where('created_at', '<=', TimeUtil::yesterdayEnd())->count(); goto ZzldG; DfMKV: return $WLCMC; goto X1iry; eIha2: if ($hiO6v == 0) { $hiO6v = 7; } goto JD3OB; ZzldG: $hiO6v = date('w'); goto eIha2; X1iry: } }