语言类型
This commit is contained in:
@@ -5,6 +5,7 @@ namespace app\controller;
|
|||||||
use app\model\CustomerTag;
|
use app\model\CustomerTag;
|
||||||
use app\model\TagGroup;
|
use app\model\TagGroup;
|
||||||
use app\util\Util;
|
use app\util\Util;
|
||||||
|
use config\constants\Constants;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
|
|
||||||
class TagGroupController
|
class TagGroupController
|
||||||
@@ -14,7 +15,7 @@ class TagGroupController
|
|||||||
public function list(Request $request)
|
public function list(Request $request)
|
||||||
{
|
{
|
||||||
$list = TagGroup::with('tags')->get();
|
$list = TagGroup::with('tags')->get();
|
||||||
$languageArr = config('translation.fallback_locale');
|
$languageArr = Constants::LANGUAGE;
|
||||||
$language = $request->user['language'];
|
$language = $request->user['language'];
|
||||||
foreach ($list as &$item) {
|
foreach ($list as &$item) {
|
||||||
$item['names'] = unserialize($item['names']);
|
$item['names'] = unserialize($item['names']);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use app\model\UserSn;
|
|||||||
use app\service\MailService;
|
use app\service\MailService;
|
||||||
use app\util\JwtUtil;
|
use app\util\JwtUtil;
|
||||||
use app\util\Util;
|
use app\util\Util;
|
||||||
|
use config\constants\Constants;
|
||||||
use support\Redis;
|
use support\Redis;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
|
|
||||||
@@ -283,7 +284,7 @@ class UserController
|
|||||||
if (Util::isEmpty($language)) {
|
if (Util::isEmpty($language)) {
|
||||||
return Util::fail([], 'language' . trans('not_null'));
|
return Util::fail([], 'language' . trans('not_null'));
|
||||||
}
|
}
|
||||||
if (!in_array($language, ['en', 'zh_CN','ru'])) {
|
if (!in_array($language, Constants::LANGUAGE)) {
|
||||||
return Util::fail([], trans('param_error'));
|
return Util::fail([], trans('param_error'));
|
||||||
}
|
}
|
||||||
$data = [
|
$data = [
|
||||||
|
|||||||
@@ -92,4 +92,6 @@ class Constants
|
|||||||
self::CUSTOMER_SEX_MAN => 'мужской',
|
self::CUSTOMER_SEX_MAN => 'мужской',
|
||||||
self::CUSTOMER_SEX_WOMAN => 'женский',
|
self::CUSTOMER_SEX_WOMAN => 'женский',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public const LANGUAGE = ['en', 'zh_CN','ru'];
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user