From 99d281b8e179fb5837e458661963cc240b890d2f Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Wed, 31 Mar 2021 20:12:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E6=89=93=E6=AC=BE=E7=B3=BB?= =?UTF-8?q?=E7=BB=9Fbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/TimingController.class.php | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 7d33a23d4..d167bf035 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -1576,6 +1576,7 @@ class TimingController extends AdminController { } list($becomeTimeList,$becomeTimeCount) = $this->getAffairList(date('Y-m',strtotime(date('Y',$time).'-'.(date('m',$time)-1).'-01'))); +// dump([$becomeTimeList,$becomeTimeCount]);die(); $time1 = date('Y-m',strtotime(date('Y',$time).'-'.(date('m',$time)-1).'-01')); $time2 = date('Y-m',strtotime(date('Y',$time).'-'.(date('m',$time)-2).'-01')); @@ -1735,11 +1736,25 @@ class TimingController extends AdminController { function diffDate($date1,$date2) { - $datetime1 = new \DateTime($date1); - $datetime2 = new \DateTime($date2); - $interval = $datetime1->diff($datetime2); - $time = $interval->format('%m'); - return $time; + if(strtotime($date1)>strtotime($date2)){ + $tmp=$date2; + $date2=$date1; + $date1=$tmp; + } + list($Y1,$m1,$d1)=explode('-',$date1); + list($Y2,$m2,$d2)=explode('-',$date2); + $y=$Y2-$Y1; + $m=$m2-$m1; + $d=$d2-$d1; + if($d<0){ + $d+=(int)date('t',strtotime("-1 month $date2")); + $m--; + } + if($m<0){ + $m+=12; + $y--; + } + return $m+1; } //