where('coach_id',$this->auth->id)->autopage()->order('id desc')->select(); $list = list_domain_image($list,['video_file']); if(!empty($list)){ foreach($list as $key => &$val){ if(!empty($val['video_file'])){ $val['thumb_image'] = $val['video_file'].'?x-oss-process=video/snapshot,t_100,f_png,m_fast'; } $val['createtime'] = $this->datetime_lang($val['createtime']); } } $this->success(1,$list); } public function addone(){ $name = input('name',''); $video_file = input('video_file',''); $size = input('size',''); $second = input('second',0,'intval'); if(!$name || !$video_file){ $this->error('标题和视频必填'); } $data = [ 'name' => $name, 'video_file' => $video_file, 'createtime' => time(), 'coach_id' => $this->auth->id, //获取视频大小和秒数 'size' => $size, 'second' => $second, ]; $id = Db::name('video')->insertGetId($data); $this->success('发布成功',$id); } }