init: 项目初始代码
This commit is contained in:
60
app/api/controller/v1/Faq.php
Normal file
60
app/api/controller/v1/Faq.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user