js代码

    1. $('.delete').click(function () {
    2. var that = $(this);
    3. if(confirm('您确定要删除')){
    4. var user_id = $(this).attr('user_id')
    5. $.post("/index.php/miniapp/automatic.content/deleteInfo", {'user_id': user_id}, function (data) {
    6. if(data.code == 200){
    7. that.parents('tr').remove();
    8. }else{
    9. alert(data.msg)
    10. }
    11. });
    12. }
    13. })

    控制器代码:

    1. /*
    2. * 删除审核内容
    3. * 微信:fangkangfk
    4. * time:2018.9.12
    5. * author:咔咔
    6. * */
    7. // 删除发布内容
    8. public function deleteInfo(){
    9. $userId = $this->request->param('user_id');
    10. $infometion = InfometionModel::where([
    11. 'user_id'=>$userId
    12. ])->delete();
    13. $project = ProjectModel::where([
    14. 'user_id'=>$userId
    15. ])->delete();
    16. $project = TemeModel::where([
    17. 'user_id'=>$userId
    18. ])->delete();
    19. $data['examine'] = 3;
    20. $status = AutomaticModel::where([
    21. 'id'=>$userId
    22. ])->update($data);
    23. if($infometion && $project && $project){
    24. $send = ['code'=>200,'msg'=>'删除成功'];
    25. }else{
    26. $send = ['code'=>400,'msg'=>'删除失败'];
    27. }
    28. return json($send);
    29. }