From ae9d7f7574a0a61801b6b6dc6bff803a5edfe0df Mon Sep 17 00:00:00 2001 From: chenzhi Date: Fri, 28 Aug 2020 11:58:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=87=8D=E7=AE=97=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E7=9A=84=E5=87=BA=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FinancialSummaryController.class.php | 6 ++++++ Application/Admin/Model/CmdTasksModel.class.php | 15 +++++++++++---- .../Admin/View/FinancialSummary/index.html | 6 ++++-- 3 files changed, 21 insertions(+), 6 deletions(-) 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('添加任务失败,已有重算任务。请等待上个重算任务完成'); }