作者 郭盛
1 个管道 的构建 通过 耗费 1 秒

修改删除视频素材

@@ -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 = [];