feat: 问答中心
This commit is contained in:
52
app/index/controller/Faq.php
Normal file
52
app/index/controller/Faq.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\index\model\FaqModel;
|
||||
use app\index\model\SysBannerItemModel;
|
||||
use think\facade\View;
|
||||
|
||||
/**
|
||||
* 问答中心控制器
|
||||
*/
|
||||
class Faq extends Common
|
||||
{
|
||||
/**
|
||||
* 问答列表
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$param = request()->param([
|
||||
'page/d' => 1,
|
||||
'size/d' => 12
|
||||
]);
|
||||
|
||||
// 获取banner焦点图
|
||||
$banner = SysBannerItemModel::hasWhere('banner', [
|
||||
'language_id' => $this->lang_id,
|
||||
'unique_label' => 'BANNER_67fa37f30e151'
|
||||
])
|
||||
->type('image')
|
||||
->visible(['id', 'title', 'image', 'link'])
|
||||
->find();
|
||||
View::assign('banner', $banner);
|
||||
|
||||
// 获取问答列表
|
||||
$faq = FaqModel::field([
|
||||
'id',
|
||||
'image',
|
||||
'question',
|
||||
'answer',
|
||||
])
|
||||
->language($this->lang_id)
|
||||
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||
->paginate([
|
||||
'list_rows' => $param['size'],
|
||||
'page' => $param['page'],
|
||||
]);
|
||||
View::assign('faq', $faq);
|
||||
|
||||
return View::fetch('index');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user