|
@@ -0,0 +1,47 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\api\controller\coach;
|
|
|
+
|
|
|
+use app\common\controller\Apic;
|
|
|
+use think\Db;
|
|
|
+/**
|
|
|
+ * 视频
|
|
|
+ */
|
|
|
+class Video extends Apic
|
|
|
+{
|
|
|
+ // 无需登录的接口,*表示全部
|
|
|
+ protected $noNeedLogin = [];
|
|
|
+ // 无需鉴权的接口,*表示全部
|
|
|
+ protected $noNeedRight = ['*'];
|
|
|
+
|
|
|
+ public function lists(){
|
|
|
+
|
|
|
+ $list = Db::name('video')->where('coach_id',$this->auth->id)->autopage()->order('id desc')->select();
|
|
|
+ $list = list_domain_image($list,['video_file']);
|
|
|
+
|
|
|
+ $this->success(1,$list);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function addone(){
|
|
|
+ $name = input('name','');
|
|
|
+ $video_file = input('video_file','');
|
|
|
+
|
|
|
+ if(!$name || !$video_file){
|
|
|
+ $this->error('标题和视频必填');
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = [
|
|
|
+ 'name' => $name,
|
|
|
+ 'video_file' => $video_file,
|
|
|
+ 'createtime' => time(),
|
|
|
+ 'coach_id' => $this->auth->id,
|
|
|
+ //获取视频大小和秒数
|
|
|
+ ];
|
|
|
+
|
|
|
+ $id = Db::name('video')->insertGetId($data);
|
|
|
+
|
|
|
+ $this->success('发布成功',$id);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|