14 changed files with 5468 additions and 23 deletions
@ -0,0 +1,27 @@ |
|||
<?php |
|||
namespace app\admin\controller; |
|||
use app\admin\service\VideoService; |
|||
|
|||
class Video extends AdminBaseController |
|||
{ |
|||
// 获取视频点播列表 |
|||
public function videoOnDemandList() |
|||
{ |
|||
$returnData = (new VideoService())->videoOnDemandList($this->request->param()); |
|||
return json($returnData); |
|||
} |
|||
|
|||
// 添加点播信息 |
|||
public function addVideoOnDemand() |
|||
{ |
|||
$returnData = (new VideoService())->addVideoOnDemand($this->request->param()); |
|||
return json($returnData); |
|||
} |
|||
|
|||
// 编辑点播信息 |
|||
public function editVideoOnDemand() |
|||
{ |
|||
$returnData = (new VideoService())->editVideoOnDemand($this->request->param()); |
|||
return json($returnData); |
|||
} |
|||
} |
@ -0,0 +1,84 @@ |
|||
<?php |
|||
namespace app\admin\service; |
|||
use app\model\VideoOnDemandModel; |
|||
|
|||
class VideoService extends AdminBaseService |
|||
{ |
|||
// 获取点播列表 |
|||
public function videoOnDemandList($param) |
|||
{ |
|||
try { |
|||
if (empty($param['page']) || !is_numeric($param['page'])) { |
|||
return $this->toData('1', '参错错误'); |
|||
} |
|||
$where = []; |
|||
if (isset($param['title'])) { |
|||
$where['title'] = $param['title']; |
|||
} |
|||
$list = VideoOnDemandModel::where($where)->order('id', 'desc')->paginate([ |
|||
'list_rows' => 15, |
|||
'page' => $param['page'], |
|||
]); |
|||
return $this->toData('0', 'SUCCESS', [ |
|||
'list' => $list->items(), // 当前页的数据 |
|||
'page' => $list->currentPage(), // 当前页码 |
|||
'total' => $list->total(), // 总记录数 |
|||
'last_page' => $list->lastPage(), // 最后一页页码 |
|||
]); |
|||
} catch (\Exception $exception) { |
|||
return $this->toData('100500', 'The system is busy.', [$exception->getMessage(), $exception->getTrace()]); |
|||
} |
|||
} |
|||
|
|||
// 添加点播信息 |
|||
public function addVideoOnDemand($param) |
|||
{ |
|||
try { |
|||
if (empty($param['title']) || empty($param['cover_id']) || empty($param['video_id']) || empty($param['cover_url']) || empty($param['video_url'] || empty($param['state'])) ) { |
|||
return $this->toData('1', '参错错误'); |
|||
} |
|||
$insert = VideoOnDemandModel::create([ |
|||
'title' => $param['title'], |
|||
'desc' => $param['desc'] ?? "", |
|||
'cover_id' => $param['cover_id'], |
|||
'video_id' => $param['video_id'], |
|||
'cover_url' => $param['cover_url'], |
|||
'video_url' => $param['video_url'], |
|||
'sort' => $param['sort'] ?? 0, |
|||
'state' => $param['state'], |
|||
]); |
|||
return $this->toData('0', 'SUCCESS', ['insert_id' => $insert->id]); |
|||
} catch (\Exception $exception) { |
|||
return $this->toData('100500', 'The system is busy.', [$exception->getMessage(), $exception->getTrace()]); |
|||
} |
|||
} |
|||
|
|||
// 编辑点播信息 |
|||
public function editVideoOnDemand($param) |
|||
{ |
|||
try { |
|||
if (empty($param['id'])) { |
|||
return $this->toData('1', 'Missing param id'); |
|||
} |
|||
if (empty($param['title']) || empty($param['cover_id']) || empty($param['video_id']) || empty($param['cover_url']) || empty($param['video_url'] || empty($param['state'])) ) { |
|||
return $this->toData('1', '参错错误'); |
|||
} |
|||
$ckInfo = VideoOnDemandModel::where('id', $param['id'])->find(); |
|||
if (empty($ckInfo)) { |
|||
return $this->toData('1', '编辑的数据不存在'); |
|||
} |
|||
$ckInfo->title = $param['title']; |
|||
$ckInfo->desc = $param['desc']; |
|||
$ckInfo->cover_id = $param['cover_id']; |
|||
$ckInfo->video_id = $param['video_id']; |
|||
$ckInfo->cover_url = $param['cover_url']; |
|||
$ckInfo->video_url = $param['video_url']; |
|||
$ckInfo->sort = $param['sort']; |
|||
$ckInfo->state = $param['state']; |
|||
$ckInfo->save(); |
|||
return $this->toData('1', 'Successful'); |
|||
} catch (\Exception $exception) { |
|||
return $this->toData('100500', 'The system is busy.', [$exception->getMessage(), $exception->getTrace()]); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
<?php |
|||
namespace app\home\controller; |
|||
use app\home\service\VideoService; |
|||
use think\response\Json; |
|||
|
|||
class Video extends HomeBaseController |
|||
{ |
|||
public function videoOnDemandList(): Json |
|||
{ |
|||
$returnData = (new VideoService())->getVideoOnDemandList($this->request->post()); |
|||
return json($returnData); |
|||
} |
|||
} |
@ -0,0 +1,28 @@ |
|||
<?php |
|||
namespace app\home\service; |
|||
|
|||
use app\model\VideoOnDemandModel; |
|||
|
|||
class VideoService extends BaseHomeService |
|||
{ |
|||
public function getVideoOnDemandList($param): array |
|||
{ |
|||
try { |
|||
if (empty($param['page']) || !is_numeric($param['page'])) { |
|||
return $this->toData('1', '参错错误'); |
|||
} |
|||
$list = VideoOnDemandModel::where(['state'=>1])->order('sort', 'desc')->paginate([ |
|||
'list_rows' => 15, |
|||
'page' => $param['page'], |
|||
]); |
|||
return $this->toData('0', 'Successful', [ |
|||
'list' => $list->items(), // 当前页的数据 |
|||
'page' => $list->currentPage(), // 当前页码 |
|||
'total' => $list->total(), // 总记录数 |
|||
'last_page' => $list->lastPage(), // 最后一页页码 |
|||
]); |
|||
} catch (\Exception $exception) { |
|||
return $this->toData('100500', 'The system is busy.', []); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,6 @@ |
|||
<?php |
|||
namespace app\model; |
|||
class AwsS3Model extends BaseModel |
|||
{ |
|||
protected $name = 'aws_s3'; |
|||
} |
@ -0,0 +1,6 @@ |
|||
<?php |
|||
namespace app\model; |
|||
class VideoOnDemandModel extends BaseModel |
|||
{ |
|||
protected $name = 'video_on_demand'; |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,15 @@ |
|||
<?php |
|||
|
|||
return [ |
|||
// aws s3配置 |
|||
'aws_s3' => [ |
|||
'aws_key' => 'AKIATCKAMOTOLA7KUPEV', |
|||
'aws_secret' => '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', |
|||
'aws_region' => 'ap-northeast-1', |
|||
'aws_bucket' => 'bourse-vod', |
|||
], |
|||
// chat聊天服务器配置 |
|||
'chat_server' => [ |
|||
'bse_url' => 'https://chat.jdtest88.com', //测试环境-chat服务api域名 |
|||
], |
|||
]; |
Loading…
Reference in new issue