定时任务删除

master
chenzhi 3 years ago
parent 089390376c
commit 83822e7952

@ -1504,8 +1504,16 @@ class ToolController extends ThinkController {
$this->assign('_page', $page);
}
$this->display();
}
public function cmdTasksDel()
{
$id = $_REQUEST['id'];
$res = M("cmd_tasks","tab_")->where("id = {$id}")->delete();
if($res !== false){
$this->ajaxReturn(array("success"=>"ok","code"=>0));
}else{
$this->ajaxReturn(array("error"=>"database error","code"=>2000));
}
}

@ -128,6 +128,7 @@
<th>预定时间</th>
<th>开始时间</th>
<th>结束时间</th>
<th>操作</th>
</tr>
</thead>
@ -140,7 +141,7 @@
<tr data-id="<?=$data['id']?>">
<td>{$data.id}</td>
<td>{$data.type}</td>
<td >{$data.params}</td>
<td>{$data.params}</td>
<td>{$data.admin_username}</td>
<td>{$data.status_str}</td>
<td style="width: 100px;height: 30px;">{$data.result}</td>
@ -148,6 +149,7 @@
<td>{$data.schedule_time}</td>
<td>{$data.start_time}</td>
<td>{$data.end_time}</td>
<td><a class="confirm cmd_del" data-id="{$data.id}" style="color: red;">删除</a></td>
</tr>
</volist>
</empty>
@ -203,7 +205,42 @@
if(event.keyCode===13){
$("#search").click();
}
})
});
$(".cmd_del").click(function () {
var id = $(this).data("id");
layer.confirm('【警告】撤销后将不可回退,如需继续请点击确认', {
btn: ['确认','取消'],
title:false
}, function(){
var url = "{:U('cmdTasksDel')}"
layer.load(2);
$.ajax({
url: url,
type: "get",
dataType: "json",
data:{
id:id
},
success: function (data) {
if(data.code == 0){
layer.closeAll('loading');
layer.msg("<font style='color:#fff'>删除成功</font>");
setTimeout(function(){
window.location.reload();
},350);
}else{
alert("删除失败,请联系管理员")
}
}
})
}, function(){
});
});
});

Loading…
Cancel
Save