refactor: 附件
This commit is contained in:
@@ -4,6 +4,7 @@ declare (strict_types = 1);
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\index\model\AttachmentCategoryModel;
|
||||
use app\index\model\AttachmentModel;
|
||||
use think\facade\View;
|
||||
|
||||
/**
|
||||
@@ -11,13 +12,66 @@ use think\facade\View;
|
||||
*/
|
||||
class Attachment extends Common
|
||||
{
|
||||
// 分页列表
|
||||
/**
|
||||
* 分页列表
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// 获取分类
|
||||
$category = AttachmentCategoryModel::language($this->lang_id)->select();
|
||||
View::assign('category', $category);
|
||||
$param = request()->param([
|
||||
'id',
|
||||
'page/d' => 1,
|
||||
'size/d' => 12,
|
||||
]);
|
||||
|
||||
// 获取附件分类
|
||||
$categorys = AttachmentCategoryModel::field([
|
||||
'id',
|
||||
'name'
|
||||
])
|
||||
->language($this->lang_id)
|
||||
->parent(0)
|
||||
->isShow(true)
|
||||
->select();
|
||||
View::assign('categorys', $categorys);
|
||||
|
||||
// 获取附件
|
||||
$attachements = AttachmentModel::field([
|
||||
'id',
|
||||
'name',
|
||||
'desc',
|
||||
'image',
|
||||
'applicable_to',
|
||||
'support_platform',
|
||||
'attach',
|
||||
])
|
||||
->language($this->lang_id)
|
||||
->category($param['id']??null)
|
||||
->paginate([
|
||||
'list_rows' => $param['size'],
|
||||
'page' => $param['page'],
|
||||
]);
|
||||
View::assign('attachements', $attachements);
|
||||
View::assign('page', $attachements->render());
|
||||
|
||||
return View::fetch('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频
|
||||
*/
|
||||
public function video()
|
||||
{
|
||||
// 获取附件分类
|
||||
$categorys = AttachmentCategoryModel::field([
|
||||
'id',
|
||||
'name'
|
||||
])
|
||||
->language($this->lang_id)
|
||||
->parent(0)
|
||||
->isShow(true)
|
||||
->select();
|
||||
View::assign('categorys', $categorys);
|
||||
|
||||
return View::fetch('video');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user