refacotr: 视频
This commit is contained in:
@@ -5,6 +5,8 @@ namespace app\index\controller;
|
||||
|
||||
use app\index\model\AttachmentCategoryModel;
|
||||
use app\index\model\AttachmentModel;
|
||||
use app\index\model\VideoCategoryModel;
|
||||
use app\index\model\VideoModel;
|
||||
use think\facade\View;
|
||||
|
||||
/**
|
||||
@@ -63,16 +65,51 @@ class Attachment extends Common
|
||||
*/
|
||||
public function video()
|
||||
{
|
||||
$param = request()->param([
|
||||
'page/d' => 1,
|
||||
'size/d' => 12
|
||||
]);
|
||||
|
||||
// 获取附件分类
|
||||
$categorys = AttachmentCategoryModel::field([
|
||||
$attachment_categorys = AttachmentCategoryModel::field([
|
||||
'id',
|
||||
'name'
|
||||
])
|
||||
->language($this->lang_id)
|
||||
->parent(0)
|
||||
->isShow(true)
|
||||
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||
->select();
|
||||
View::assign('categorys', $categorys);
|
||||
View::assign('attachment_categorys', $attachment_categorys);
|
||||
|
||||
// 获取视频分类
|
||||
$video_categorys = VideoCategoryModel::field([
|
||||
'id',
|
||||
'name'
|
||||
])
|
||||
->language($this->lang_id)
|
||||
->isShow(true)
|
||||
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||
->select();
|
||||
View::assign('video_categorys', $video_categorys);
|
||||
|
||||
// 获取视频
|
||||
$videos = VideoModel::field([
|
||||
'id',
|
||||
'name',
|
||||
'desc',
|
||||
'image',
|
||||
'video',
|
||||
'link'
|
||||
])
|
||||
->language($this->lang_id)
|
||||
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||
->paginate([
|
||||
'list_rows' => $param['size'],
|
||||
'page' => $param['page'],
|
||||
]);
|
||||
View::assign('videos', $videos);
|
||||
View::assign('page', $videos->render());
|
||||
|
||||
return View::fetch('video');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user