generated from php/site_api
47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller\I18n\I18nLang;
|
|
|
|
use app\BaseController;
|
|
use app\common\model\I18n\I18nLang\I18nLang as ModelI18nLang;
|
|
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 I18nLang extends BaseController
|
|
{
|
|
/**
|
|
* 获取多语言设置详情
|
|
*/
|
|
public function getLangListByLocale(Request $request): array
|
|
{
|
|
$params = $request->param();
|
|
|
|
$this->validate($params, ['code' => 'require']);
|
|
|
|
$query = ModelI18nLang::alias('a')
|
|
->leftjoin('i18n_lang_type b', 'a.i18n_lang_type_guid = b.i18n_lang_type_guid')
|
|
->field([
|
|
'a.i18n_lang_key',
|
|
'a.i18n_lang_name'
|
|
])
|
|
->where('b.i18n_lang_type_code', $params['code']);
|
|
|
|
|
|
$data = $query->select()->toArray();
|
|
$res = [];
|
|
foreach ($data as $key => $item) {
|
|
$res[$item['i18n_lang_key']] = $item['i18n_lang_name'];
|
|
}
|
|
|
|
return msg(0, '获取多语言设置详情成功!', ['data' => $res]);
|
|
}
|
|
}
|