72 lines
2.0 KiB
PHP
72 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller\Home\HomeVideo;
|
|
|
|
use app\BaseController;
|
|
use app\common\model\Home\HomeVideo\HomeVideo as ModelHomeVideo;
|
|
use app\Request;
|
|
use think\Validate;
|
|
use think\exception\ValidateException;
|
|
use think\facade\Filesystem;
|
|
use app\common\arw\adjfut\src\Excel;
|
|
use app\common\arw\adjfut\src\UploadFile;
|
|
use think\facade\Db;
|
|
use app\common\exception\Tool;
|
|
use think\facade\Env;
|
|
|
|
|
|
class HomeVideo extends BaseController
|
|
{
|
|
/**
|
|
* 获取首页视频列表
|
|
*/
|
|
public function getHomeVideo(Request $request): array
|
|
{
|
|
$params = $request->param();
|
|
$con = [];
|
|
|
|
$this->validate($params, ['locale' => 'require']);
|
|
$con = Tool::getOptionalQuery(['i18n_lang_type_guid', '='],['c.i18n_lang_type_code', '=', 'locale']);
|
|
|
|
$query = ModelHomeVideo::where($con)
|
|
->alias('a')
|
|
->leftjoin('i18n_lang_type c', 'a.i18n_lang_type_guid = c.i18n_lang_type_guid')
|
|
->field([
|
|
'a.home_video_id',
|
|
'a.home_video_guid',
|
|
'a.i18n_lang_type_guid',
|
|
'a.home_video_cover',
|
|
'c.i18n_lang_type_code',
|
|
'a.home_video_url'
|
|
])
|
|
->order('home_video_create_time', 'desc')
|
|
->select();
|
|
|
|
return msg(0, "获取首页视频列表成功!", [
|
|
'data' => $query,
|
|
'count' => count($query)
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 获取首页视频详情
|
|
*/
|
|
public function getHomeVideoInfo(Request $request): array
|
|
{
|
|
$params = $request->param();
|
|
|
|
$this->validate($params, ['home_video_guid' => 'require']);
|
|
|
|
$find = ModelHomeVideo::field([
|
|
'home_video_id',
|
|
'home_video_guid',
|
|
'i18n_lang_type_guid',
|
|
'home_video_url'
|
|
])
|
|
->where('home_video_guid', $params['home_video_guid'])
|
|
->find();
|
|
|
|
return msg(0, '获取首页视频详情成功!', ['data' => $find]);
|
|
}
|
|
}
|