作者 王智

baoxiu22

... ... @@ -33,22 +33,26 @@ class Dashboard extends Backend
Config::parse($addonComposerCfg, "json", "composer");
$config = Config::get("composer");
$addonVersion = isset($config['version']) ? $config['version'] : __('Unknown');
//月 起止时间戳
$start_time = mktime(0, 0, 0, date('m'), 1, date('Y'));
$end_time = mktime(23, 59, 59, date('m'), date('t'), date('Y'));
$map['createtime'] = ['between', [$start_time, $end_time]];
//报修总量
$BaoxiuArr = Db::name('baoxiudan')->select();
$BaoxiuWancheng = Db::name('baoxiudan')->where('type', 2)->select();
$BaoxiuWeiWancheng = Db::name('baoxiudan')->where('type', 1)->select();
$BaoxiuArr = Db::name('baoxiudan')->where($map)->select();
$BaoxiuWancheng = Db::name('baoxiudan')->where('type', 2)->where($map)->select();
$BaoxiuWeiWancheng = Db::name('baoxiudan')->where('type', 1)->where($map)->select();
$Round = round(count($BaoxiuWancheng) / count($BaoxiuArr) * 100, 2);
$WRound = round(count($BaoxiuWeiWancheng) / count($BaoxiuArr) * 100, 2);
//监控系统
$jiankong = Db::name('baoxiudan')->where('system', 1)->select();
$jiankong = Db::name('baoxiudan')->where('system', 1)->where($map)->select();
//通信系统
$tongxin = Db::name('baoxiudan')->where('system', 2)->select();
$tongxin = Db::name('baoxiudan')->where('system', 2)->where($map)->select();
//供配电系统
$peidian = Db::name('baoxiudan')->where('system', 3)->select();
$peidian = Db::name('baoxiudan')->where('system', 3)->where($map)->select();
//计重设备
$jizhong = Db::name('baoxiudan')->where('system', 4)->select();
$jizhong = Db::name('baoxiudan')->where('system', 4)->where($map)->select();
//收费系统
$shoufei = Db::name('baoxiudan')->where('system', 5)->select();
$shoufei = Db::name('baoxiudan')->where('system', 5)->where($map)->select();
$this->view->assign([
'baoxiunum' => count($BaoxiuArr),
'baoxiu' => $Round . '%',
... ...