generated from php/site_api
55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller\Faq;
|
|
|
|
use app\BaseController;
|
|
use app\common\model\Faq\Faq as ModelFaq;
|
|
use app\Request;
|
|
use think\Validate;
|
|
use think\exception\ValidateException;
|
|
use think\facade\Filesystem;
|
|
use app\common\arw\adjfut\src\Excel;
|
|
use app\common\arw\adjfut\src\UploadFile;
|
|
use think\facade\Db;
|
|
use app\common\exception\Tool;
|
|
use think\facade\Env;
|
|
|
|
|
|
class Faq extends BaseController
|
|
{
|
|
/**
|
|
* 获取常见问题列表
|
|
*/
|
|
public function getFaqList(Request $request): array
|
|
{
|
|
$params = $request->param();
|
|
|
|
$this->validate($params, ['locale' => 'require']);
|
|
|
|
$con = Tool::getOptionalQuery(
|
|
['faq_questions', 'LIKE'],
|
|
['c.i18n_lang_type_code', '=', 'locale']
|
|
);
|
|
|
|
$query = ModelFaq::where($con)
|
|
->field([
|
|
'c.i18n_lang_type_code',
|
|
'a.i18n_lang_type_guid',
|
|
'faq_id',
|
|
'faq_guid',
|
|
'faq_questions',
|
|
'faq_answer',
|
|
'faq_sort'
|
|
])
|
|
->alias('a')
|
|
->leftjoin('i18n_lang_type c', 'a.i18n_lang_type_guid = c.i18n_lang_type_guid') //i18n
|
|
->order('faq_sort', 'asc')
|
|
->select();
|
|
|
|
return msg(0, "获取常见问题列表成功!", [
|
|
'data' => $query,
|
|
'count' => count($query)
|
|
]);
|
|
}
|
|
}
|