diff --git a/Application/Admin/Controller/FinancialSummaryController.class.php b/Application/Admin/Controller/FinancialSummaryController.class.php index 4dd97fdc8..a286b1638 100644 --- a/Application/Admin/Controller/FinancialSummaryController.class.php +++ b/Application/Admin/Controller/FinancialSummaryController.class.php @@ -165,6 +165,12 @@ class FinancialSummaryController extends AdminController } public function menuAuth() { + + $isCan = D("CmdTasks")->isCanAddTask("FinancialSummary"); + if(!$isCan){ + return []; + } + $mentBtn = [ "updateStatement"=>"重算金额" ]; diff --git a/Application/Admin/Model/CmdTasksModel.class.php b/Application/Admin/Model/CmdTasksModel.class.php index c923c197b..b3f15a73e 100644 --- a/Application/Admin/Model/CmdTasksModel.class.php +++ b/Application/Admin/Model/CmdTasksModel.class.php @@ -43,10 +43,8 @@ class CmdTasksModel extends Model{ //插入任务 public function addTask($type,$params,$need_path=true) { - $task = $this->field("end_time")->where(['status'=>["in","0,1"],'type'=>$type])->order("id desc")->find(); - if(!empty($task)){ - return false; - } + if(!$this->isCanAddTask($type)) return false; + if($need_path){ if(IS_WIN){ $p = explode(':',ROOTTTTT); @@ -64,4 +62,13 @@ class CmdTasksModel extends Model{ ]; return $this->add($save); } + //验证任务 + public function isCanAddTask($type) + { + $task = $this->field("end_time")->where(['status'=>["in","0,1"],'type'=>$type])->order("id desc")->find(); + if(!empty($task)){ + return false; + } + return true; + } } \ No newline at end of file diff --git a/Application/Admin/View/FinancialSummary/index.html b/Application/Admin/View/FinancialSummary/index.html index 7f0fb4525..a1a4968aa 100644 --- a/Application/Admin/View/FinancialSummary/index.html +++ b/Application/Admin/View/FinancialSummary/index.html @@ -285,14 +285,16 @@ window.location.href = url; }); $("#updateStatement").on("click",function(){ - layer.confirm("新增结算需要花费2分钟左右时间,并且只上个月统计信息,无需结算请取消,上次重算时间【{$lastRecount}】",{title:false}, function(index){ + layer.confirm("重算需要花费2分钟左右时间,并且只统计上个月信息,无需重算请取消,上次重算时间【{$lastRecount}】",{title:false}, function(index){ $.ajax({ type: 'post', url: "{:U('updateStatement')}", data:{}, success: function(data) { if(data.success){ - layer.alert('添加重算任务成功,请2分钟后刷新查看'); + layer.alert('添加重算任务成功,请2分钟后刷新查看',function(){ + window.location.reload(); + }); }else{ layer.alert('添加任务失败,已有重算任务。请等待上个重算任务完成'); }