61 lines
1.8 KiB
PHP
61 lines
1.8 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
namespace app\api\controller\v1;
|
|
|
|
use app\api\model\Faq as FaqModel;
|
|
use app\api\validate\Faq as FaqValidate;
|
|
|
|
/**
|
|
* 常见问题类
|
|
* Class Faq
|
|
* @package app\api\controller
|
|
*/
|
|
class Faq extends Base
|
|
{
|
|
public function initialize()
|
|
{
|
|
parent::initialize();
|
|
$this->model = new FaqModel();
|
|
$this->validate = new FaqValidate();
|
|
}
|
|
/**
|
|
* 列表
|
|
*/
|
|
public function index():\think\Response\Json
|
|
{
|
|
$inputData = $this->request->param();
|
|
$inputData['platform_id'] = $this->platformId;
|
|
|
|
if (isset($inputData['language_id']) && $inputData['language_id'] != 0 && $inputData['language_id'] != '') {
|
|
$this->focus['site_id'] = $inputData['site_id'] = $inputData['language_id'];
|
|
unset($inputData['language_id']);
|
|
}
|
|
|
|
if (isset($inputData['faq_type_id']) && $inputData['faq_type_id'] != '' && $inputData['faq_type_id'] != 0) {
|
|
$this->focus['faq_type_id'] = $inputData['faq_type_id'];
|
|
}
|
|
|
|
|
|
if (isset($inputData['answer']) && $inputData['answer'] != '') {
|
|
$this->simple['answer'] = $inputData['answer'];
|
|
$this->simple['question'] = $inputData['answer'];
|
|
}
|
|
|
|
$this->order['create_time'] = 'desc';
|
|
|
|
if (!$this->commonValidate(__FUNCTION__,$inputData)) {
|
|
return $this->msg(-1,$this->validate->getError());
|
|
}
|
|
|
|
if (!empty($this->focus)) {
|
|
if (!$this->commonValidate(__FUNCTION__,$this->focus)) {
|
|
return $this->msg(-1,$this->validate->getError());
|
|
}
|
|
}
|
|
|
|
$result = $this->model->getAllList($inputData,$this->simple,$this->focus,$this->order,$this->field);
|
|
return $this->msg(200,'获取列表成功',$result);
|
|
}
|
|
|
|
}
|