From be65b78d73346e15c306af22e90186ad948327f9 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 1 Sep 2021 18:24:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A2=84=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StatementWarningController.class.php | 20 ++++++++++--------- .../StatementWarningSetController.class.php | 18 ++++++++++------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Application/Admin/Controller/StatementWarningController.class.php b/Application/Admin/Controller/StatementWarningController.class.php index 90804400d..b8ca73704 100644 --- a/Application/Admin/Controller/StatementWarningController.class.php +++ b/Application/Admin/Controller/StatementWarningController.class.php @@ -53,11 +53,12 @@ class StatementWarningController extends AdminController private function getLastUpdate() { - $preMonth = explode('-',date('Y-m',mktime(0,0,0,date('m',time()),1,date('Y',time()))-1)); + $time =strtotime(date('Y',time()).'-'.date('m',time())."-1"); + $nextMonth = explode('-', date('Y-m',strtotime('+32 day',$time)) ); $lastUpdate = $this->statementWarningModel->where([ - 'count_year'=>$preMonth[0], - 'count_month'=>$preMonth[1], + 'count_year'=>$nextMonth[0], + 'count_month'=>$nextMonth[1], "name"=>'wm_platm', "type"=>1 ])->field("create_time")->find(); @@ -308,8 +309,8 @@ class StatementWarningController extends AdminController { if(!isset($_REQUEST['time'])) $this->error("参数错误"); - $time =strtotime($_REQUEST['time']."-1"); - $time = date('Y-m',strtotime('+32 day',$time)); + $time =strtotime($_REQUEST['time']."-1")-1; + $time = date('Y-m',$time); $params = "php ".SUBSITE_INDEX." StatementWarningSet/setFreeMonth/count_date/{$time}"; $r = D("CmdTasks")->addTask("StatementWarningSet",$params); @@ -422,11 +423,12 @@ class StatementWarningController extends AdminController $poolname = 'up_statement'; } - $preMonth = explode('-',date('Y-m',mktime(0,0,0,$info['count_month'],1,$info['count_year'])-1)); - + $time =strtotime($info['count_year'].'-'.$info['count_month']."-1"); + $nextMonth = explode('-', date('Y-m',strtotime('+32 day',$time)) ); + $this->statementWarningModel->where([ - 'count_year'=>$preMonth[0], - 'count_month'=>$preMonth[1], + 'count_year'=>$nextMonth[0], + 'count_month'=>$nextMonth[1], 'name'=>$poolname, ])->setDec('money',$diffMoney); } diff --git a/Application/Admin/Controller/StatementWarningSetController.class.php b/Application/Admin/Controller/StatementWarningSetController.class.php index 4591b3c82..69f8502d6 100644 --- a/Application/Admin/Controller/StatementWarningSetController.class.php +++ b/Application/Admin/Controller/StatementWarningSetController.class.php @@ -68,15 +68,16 @@ class StatementWarningSetController extends Controller { $count_date = date('Y',time()).'-'.(date('m',time())); $this->configInit($count_date); - $preMonth = $this->getPreMonth(); + $nextMonth = $this->getNextMonth(); $hasdb = $this->statementWarningModel->where([ - 'count_year'=>$preMonth[0], - 'count_month'=>$preMonth[1], + 'count_year'=>$nextMonth[0], + 'count_month'=>$nextMonth[1], "name"=>'wm_platm', "type"=>1 ])->find(); if(!$hasdb){ //第一次生成,同时上一次结扎 + $preMonth = $this->getPreMonth(); $preCountMonth = $preMonth[0]."-".$preMonth[1]; $params = "php ".SUBSITE_INDEX." StatementWarningSet/setFreeMonth/count_date/{$preCountMonth}"; $time = time()+2*3600; @@ -366,12 +367,12 @@ class StatementWarningSetController extends Controller { private function addStatementWarning($type,$name,$money,$issave = true) { //汇总表差一个月 - $preMonth = $this->getPreMonth(); + $nextMonth = $this->getNextMonth(); $savedata = [ 'type'=>$type, 'name'=>$name, - 'count_year'=>$preMonth[0], - 'count_month'=>$preMonth[1] + 'count_year'=>$nextMonth[0], + 'count_month'=>$nextMonth[1] ]; $hasDb = $this->statementWarningModel->where($savedata)->find(); $savedata = array_merge(['money'=>$money,'create_time'=>time()],$savedata); @@ -440,7 +441,10 @@ class StatementWarningSetController extends Controller { return explode('-',date("Y-m",$this->beginThismonth-1)); } - + private function getNextMonth() + { + return explode('-',date("Y-m",$this->endThismonth+1)); + } From 2fb7c989c5c7ec9c88f2e45dca6929b1ba771c3e Mon Sep 17 00:00:00 2001 From: chenzhi Date: Wed, 1 Sep 2021 18:43:52 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/StatementWarningController.class.php | 1 - Application/Admin/View/StatementWarning/lists.html | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Application/Admin/Controller/StatementWarningController.class.php b/Application/Admin/Controller/StatementWarningController.class.php index b8ca73704..8790f5089 100644 --- a/Application/Admin/Controller/StatementWarningController.class.php +++ b/Application/Admin/Controller/StatementWarningController.class.php @@ -425,7 +425,6 @@ class StatementWarningController extends AdminController $time =strtotime($info['count_year'].'-'.$info['count_month']."-1"); $nextMonth = explode('-', date('Y-m',strtotime('+32 day',$time)) ); - $this->statementWarningModel->where([ 'count_year'=>$nextMonth[0], 'count_month'=>$nextMonth[1], diff --git a/Application/Admin/View/StatementWarning/lists.html b/Application/Admin/View/StatementWarning/lists.html index 581012d53..1aba87700 100644 --- a/Application/Admin/View/StatementWarning/lists.html +++ b/Application/Admin/View/StatementWarning/lists.html @@ -53,7 +53,7 @@