mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 14:31:04 +00:00
添加多语言数据版本接口
This commit is contained in:
parent
eb95473788
commit
c9454d344a
@ -645,4 +645,16 @@ class PublicController
|
||||
{
|
||||
return app('json')->success(['version' => get_crmeb_version()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取多语言缓存
|
||||
* @return \think\Response
|
||||
* @author 吴汐
|
||||
* @email 442384644@qq.com
|
||||
* @date 2023/03/06
|
||||
*/
|
||||
public function getLangVersion()
|
||||
{
|
||||
return app('json')->success(app()->make(LangCodeServices::class)->getLangVersion());
|
||||
}
|
||||
}
|
||||
|
||||
@ -388,6 +388,8 @@ Route::group(function () {
|
||||
Route::get('get_lang_json', 'v1.PublicController/getLangJson')->name('getLangJson');
|
||||
//获取当前后台设置的默认语言类型
|
||||
Route::get('get_default_lang_type', 'v1.PublicController/getDefaultLangType')->name('getLangJson');
|
||||
//获取当前后台设置的默认语言类型
|
||||
Route::get('lang_version', 'v1.PublicController/getLangVersion')->name('getLangVersion');
|
||||
|
||||
/** 定时任务接口 */
|
||||
//定时任务调用接口
|
||||
|
||||
@ -138,6 +138,7 @@ class LangCodeServices extends BaseServices
|
||||
$langStr = 'api_lang_' . str_replace('-', '_', $value);
|
||||
CacheService::delete($langStr);
|
||||
}
|
||||
$this->cacheDriver()->clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -169,4 +170,20 @@ class LangCodeServices extends BaseServices
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取多语言缓存
|
||||
* @return mixed
|
||||
* @author 吴汐
|
||||
* @email 442384644@qq.com
|
||||
* @date 2023/03/06
|
||||
*/
|
||||
public function getLangVersion()
|
||||
{
|
||||
return $this->cacheDriver()->remember('lang_version', function () {
|
||||
return [
|
||||
'version' => uniqid()
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,7 @@ class LangTypeServices extends BaseServices
|
||||
$langCountryList = app()->make(LangCountryServices::class)->selectList([])->toArray();
|
||||
$options = [];
|
||||
foreach ($langCountryList as $item) {
|
||||
$options[] = ['value' => $item['code'], 'label' => $item['name'].' [ '.$item['code'].' ]'];
|
||||
$options[] = ['value' => $item['code'], 'label' => $item['name'] . ' [ ' . $item['code'] . ' ]'];
|
||||
}
|
||||
$field[] = Form::select('file_name', '语言标识', $info['file_name'] ?? '')->setOptions(Form::setOptions($options))->filterable(1);
|
||||
$field[] = Form::radio('is_default', '是否默认', $info['is_default'] ?? 0)->options([['label' => '开启', 'value' => 1], ['label' => '关闭', 'value' => 0]]);
|
||||
@ -100,6 +100,7 @@ class LangTypeServices extends BaseServices
|
||||
{
|
||||
$fileName = $this->dao->value(['is_default' => 1], 'file_name');
|
||||
$this->cacheDriver()->set('range_name', $fileName);
|
||||
app()->make(LangCodeServices::class)->cacheDriver()->clear();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user