js代码
$('.delete').click(function () {
var that = $(this);
if(confirm('您确定要删除')){
var user_id = $(this).attr('user_id')
$.post("/index.php/miniapp/automatic.content/deleteInfo", {'user_id': user_id}, function (data) {
if(data.code == 200){
that.parents('tr').remove();
}else{
alert(data.msg)
}
});
}
})
控制器代码:
/*
* 删除审核内容
* 微信:fangkangfk
* time:2018.9.12
* author:咔咔
* */
// 删除发布内容
public function deleteInfo(){
$userId = $this->request->param('user_id');
$infometion = InfometionModel::where([
'user_id'=>$userId
])->delete();
$project = ProjectModel::where([
'user_id'=>$userId
])->delete();
$project = TemeModel::where([
'user_id'=>$userId
])->delete();
$data['examine'] = 3;
$status = AutomaticModel::where([
'id'=>$userId
])->update($data);
if($infometion && $project && $project){
$send = ['code'=>200,'msg'=>'删除成功'];
}else{
$send = ['code'=>400,'msg'=>'删除失败'];
}
return json($send);
}