init: 项目初始代码
This commit is contained in:
66
app/api/controller/v1/Video.php
Normal file
66
app/api/controller/v1/Video.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\api\controller\v1;
|
||||
|
||||
use app\api\model\Video as VideoModel;
|
||||
use app\api\validate\Video as VideoValidate;
|
||||
|
||||
/**
|
||||
* 产品视频管理
|
||||
*/
|
||||
class Video extends Base
|
||||
{
|
||||
//管理员模型
|
||||
protected $model = null;
|
||||
//后台管理员控制器
|
||||
protected $validate = null;
|
||||
|
||||
public function initialize()
|
||||
{
|
||||
parent::initialize();
|
||||
$this->validate = new VideoValidate();
|
||||
$this->model = new VideoModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public function index():\think\Response\Json
|
||||
{
|
||||
$inputData = $this->request->param();
|
||||
$inputData['platform_id'] = $this->platformId;
|
||||
if (isset($inputData['language_id']) && $inputData['language_id'] != 0 && $inputData['language_id'] != '') {
|
||||
$this->focus['site_id'] = $inputData['site_id'] = $inputData['language_id'];
|
||||
unset($inputData['language_id']);
|
||||
}
|
||||
if (!$this->commonValidate(__FUNCTION__,$inputData)) {
|
||||
return $this->msg(-1,$this->validate->getError());
|
||||
}
|
||||
$this->simple['name'] = $inputData['name'] ?? '';
|
||||
$result = $this->model->getIndexList($this->page,$this->size,$this->field, $this->simple, $this->focus,$this->order);
|
||||
return $this->msg(200,'获取列表成功',$result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 启用禁用
|
||||
*/
|
||||
public function changeStatus():\think\Response\Json
|
||||
{
|
||||
$inputData = $this->request->param();
|
||||
if (isset($inputData['language_id']) && $inputData['language_id'] != 0 && $inputData['language_id'] != '') {
|
||||
$this->focus['site_id'] = $inputData['site_id'] = $inputData['language_id'];
|
||||
unset($inputData['language_id']);
|
||||
}
|
||||
if (!$this->commonValidate(__FUNCTION__,$inputData)) {
|
||||
return $this->msg(-1,$this->validate->getError());
|
||||
}
|
||||
$result = $this->model->changeStatus($inputData);
|
||||
if ($result) {
|
||||
return $this->msg(200,"操作成功");
|
||||
} else {
|
||||
return $this->msg(504,"操作失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user