定时器接口时间区间修正

master
zhengyongxing 5 years ago
parent 401edecd61
commit db40381bb1

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

Loading…
Cancel
Save