1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?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);
- }
- }
|