From db40381bb1a208f3ad62848f69c0ebd0ee6817c0 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Thu, 21 Nov 2019 16:35:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E5=99=A8=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=8C=BA=E9=97=B4=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/TimingController.class.php | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-) 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');