1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- namespace app\admin\controller;
- use app\admin\logic\VideoLogic;
- use app\BaseController;
- use think\exception\ValidateException;
- use think\facade\Config;
- use think\facade\Validate;
- //视频
- class Video extends BaseController
- {
- //获取视频列表
- public function videoList()
- {
- $param = $this->request->only([
- 'page' => 1,
- 'size' => 10,
- 'status' => '',
- 'video_sn' => '',
- 'video_name' => '',
- 'video_url' => '',
- ], 'post');
- return VideoLogic::videoList($param);
- }
- //添加视频
- public function videoAdd()
- {
- $param = $this->request->only([
- 'video_name',
- 'video_url',
- 'video_img',
- 'weight' => '',
- 'remark' => '',
- ], 'post');
- $val = Validate::rule(Config::get('validate_rules.videoAdd'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return VideoLogic::videoAdd($param);
- }
- //读取视频详情
- public function videoRead()
- {
- $id = $this->request->post('id/d', 0);
- return VideoLogic::videoRead($id);
- }
- //编辑视频
- public function videoEdit()
- {
- $param = $this->request->only([
- 'id',
- 'video_name',
- 'video_url',
- 'video_img',
- 'weight' => '',
- 'remark' => '',
- ], 'post');
- $val = Validate::rule(Config::get('validate_rules.videoEdit'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return VideoLogic::videoEdit($param);
- }
- //视频启禁用
- public function videoChange()
- {
- $param = $this->request->only(['id', 'status',], 'post');
- $val = Validate::rule(Config::get('validate_rules.status'));
- if (!$val->check($param)) throw new ValidateException($val->getError());
- return VideoLogic::videoChange($param);
- }
- //删除视频
- public function videoDelete()
- {
- halt($this->request->uid,$this->request->uname,$this->request->roleid);
- $id = $this->request->post('id/d', 0);
- return VideoLogic::videoDelete($id);
- }
- }
|