Пример #1
0
 public function actionDel()
 {
     $del = new NewsModel();
     $del->id = [':id' => $_POST['id']];
     $del->del();
     header("Location: /index.php");
 }
 function del()
 {
     $id = $_GET['id'];
     $arr = explode(",", $id);
     $newsOb = new NewsModel();
     foreach ($arr as $vid) {
         $re = $newsOb->del($vid);
     }
     if ($re) {
         $this->assign("jumpUrl", $_SERVER['HTTP_REFERER']);
         $this->assign("waitSeconds", "3");
         $this->success();
     } else {
         $this->assign("jumpUrl", $_SERVER['HTTP_REFERER']);
         $this->assign("waitSeconds", "3");
         $this->error();
     }
 }
 /**
  * 删除数据
  *
  * @param $id
  * @throws \Exception
  * @author yangyifan <*****@*****.**>
  */
 public function getDelete($id)
 {
     NewsModel::del($id) > 0 ? $this->response(200, trans('response.delete_success'), [], false, url('admin/news/index')) : $this->response(400, trans('response.delete_error'), [], false);
 }