diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 473541f30..5cd2b799a 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -21,16 +21,26 @@ class TimingController extends AdminController { public function caculateDeviceInfo() { - $start = 1569686400; - $end = time(); + $start = strtotime(date("Ymd",time()))-86400; + $end = $start+1; - if (I('time')) { - $start = strtotime(I('time')); - $end = $start+1; - } +// if (I('time')) { +// $start = strtotime(I('time')); +// $end = $start+1; +// } - if (I('start')) { + if (I('start')&&I('end')) { + $start = strtotime(I('start')); + $end = strtotime(I('end'))+1; + } else if (I('start')&&!I('end')) { $start = strtotime(I('start')); + $end = strtotime(I('start'))+1; + } else if (!I('start')&&I('end')) { + $start = strtotime(I('end')); + $end = strtotime(I('end'))+1; + } + if ($start>$end) { + echo '开始时间不能大于结束时间'; } ini_set('memory_limit','1024M'); @@ -106,16 +116,21 @@ class TimingController extends AdminController { public function caculateTodayDevice() { - $start = 1569686400; - $end = time(); + $start = strtotime(date("Ymd",time())); + $end = $start+1; - if (I('time')) { - $start = strtotime(I('time')); - $end = $start+1; - } - - if (I('start')) { + if (I('start')&&I('end')) { + $start = strtotime(I('start')); + $end = strtotime(I('end'))+1; + } else if (I('start')&&!I('end')) { $start = strtotime(I('start')); + $end = strtotime(I('start'))+1; + } else if (!I('start')&&I('end')) { + $start = strtotime(I('end')); + $end = strtotime(I('end'))+1; + } + if ($start>$end) { + echo '开始时间不能大于结束时间'; } ini_set('memory_limit','1024M');