正在显示
1 个修改的文件
包含
40 行增加
和
0 行删除
@@ -323,6 +323,46 @@ class Video extends Backend | @@ -323,6 +323,46 @@ class Video extends Backend | ||
323 | return $this->view->fetch(); | 323 | return $this->view->fetch(); |
324 | } | 324 | } |
325 | 325 | ||
326 | + /** | ||
327 | + * 删除 | ||
328 | + */ | ||
329 | + public function del($ids = "") | ||
330 | + { | ||
331 | + if ($ids) { | ||
332 | + $pk = $this->model->getPk(); | ||
333 | + $adminIds = $this->getDataLimitAdminIds(); | ||
334 | + | ||
335 | + Db::name('car')->where('video_id',$ids)->delete(); | ||
336 | + if (is_array($adminIds)) { | ||
337 | + $this->model->where($this->dataLimitField, 'in', $adminIds); | ||
338 | + } | ||
339 | + $list = $this->model->where($pk, 'in', $ids)->select(); | ||
340 | + | ||
341 | + $count = 0; | ||
342 | + Db::startTrans(); | ||
343 | + try { | ||
344 | + foreach ($list as $k => $v) { | ||
345 | + $count += $v->delete(); | ||
346 | + } | ||
347 | + Db::commit(); | ||
348 | + } catch (PDOException $e) { | ||
349 | + Db::rollback(); | ||
350 | + $this->error($e->getMessage()); | ||
351 | + } catch (Exception $e) { | ||
352 | + Db::rollback(); | ||
353 | + $this->error($e->getMessage()); | ||
354 | + } | ||
355 | + if ($count) { | ||
356 | + $this->success(); | ||
357 | + } else { | ||
358 | + $this->error(__('No rows were deleted')); | ||
359 | + } | ||
360 | + } | ||
361 | + $this->error(__('Parameter %s can not be empty', 'ids')); | ||
362 | + } | ||
363 | + | ||
364 | + | ||
365 | + | ||
326 | public function type(){ | 366 | public function type(){ |
327 | $res = Db::name('type')->field('id,area_name')->select(); | 367 | $res = Db::name('type')->field('id,area_name')->select(); |
328 | $arr = []; | 368 | $arr = []; |
-
请 注册 或 登录 后发表评论