定时器接口时间区间修正

master
zhengyongxing 5 years ago
parent 401edecd61
commit db40381bb1

@ -21,16 +21,26 @@ class TimingController extends AdminController {
public function caculateDeviceInfo() { public function caculateDeviceInfo() {
$start = 1569686400; $start = strtotime(date("Ymd",time()))-86400;
$end = time(); $end = $start+1;
if (I('time')) { // if (I('time')) {
$start = strtotime(I('time')); // $start = strtotime(I('time'));
$end = $start+1; // $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')); $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'); ini_set('memory_limit','1024M');
@ -106,16 +116,21 @@ class TimingController extends AdminController {
public function caculateTodayDevice() { public function caculateTodayDevice() {
$start = 1569686400; $start = strtotime(date("Ymd",time()));
$end = time(); $end = $start+1;
if (I('time')) { if (I('start')&&I('end')) {
$start = strtotime(I('time')); $start = strtotime(I('start'));
$end = $start+1; $end = strtotime(I('end'))+1;
} } else if (I('start')&&!I('end')) {
if (I('start')) {
$start = strtotime(I('start')); $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'); ini_set('memory_limit','1024M');

Loading…
Cancel
Save