Files
orico-official-website/app/index/controller/Attachment.php
2025-04-15 17:43:10 +08:00

78 lines
1.8 KiB
PHP

<?php
declare (strict_types = 1);
namespace app\index\controller;
use app\index\model\AttachmentCategoryModel;
use app\index\model\AttachmentModel;
use think\facade\View;
/**
* 附件控制器
*/
class Attachment extends Common
{
/**
* 分页列表
*/
public function index()
{
$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');
}
}