优化预警

master
chenzhi 3 years ago
parent a26cb8ccca
commit be65b78d73

@ -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);
}

@ -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));
}

Loading…
Cancel
Save