优化重算按钮的出现

master
chenzhi 4 years ago
parent 175b2f92f7
commit ae9d7f7574

@ -165,6 +165,12 @@ class FinancialSummaryController extends AdminController
}
public function menuAuth()
{
$isCan = D("CmdTasks")->isCanAddTask("FinancialSummary");
if(!$isCan){
return [];
}
$mentBtn = [
"updateStatement"=>"<a class='butn' id='updateStatement' style='background-color: green;'>重算金额</a>"
];

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

@ -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('添加任务失败,已有重算任务。请等待上个重算任务完成');
}

Loading…
Cancel
Save