18
This commit is contained in:
+17
-5
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
use Bilulanlv\ThinkCache\facade\ThinkCache;
|
||||
use support\Env;
|
||||
if (!function_exists('admin_path')) {
|
||||
function admin_path(){
|
||||
@@ -23,10 +22,10 @@ if (!function_exists('cache')) {
|
||||
|
||||
if ('' === $value) {
|
||||
// 获取缓存
|
||||
return str_starts_with($name, '?') ? ThinkCache::has(substr($name, 1)) : ThinkCache::get($name);
|
||||
return str_starts_with($name, '?') ? \support\think\Cache::has(substr($name, 1)) : \support\think\Cache::get($name);
|
||||
} elseif (is_null($value)) {
|
||||
// 删除缓存
|
||||
return ThinkCache::delete($name);
|
||||
return \support\think\Cache::delete($name);
|
||||
}
|
||||
|
||||
// 缓存数据
|
||||
@@ -37,9 +36,9 @@ if (!function_exists('cache')) {
|
||||
}
|
||||
|
||||
if (is_null($tag)) {
|
||||
return ThinkCache::set($name, $value, $expire);
|
||||
return \support\think\Cache::set($name, $value, $expire);
|
||||
} else {
|
||||
return ThinkCache::tag($tag)->set($name, $value, $expire);
|
||||
return \support\think\Cache::tag($tag)->set($name, $value, $expire);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,6 +79,19 @@ if (!function_exists('get')) {
|
||||
if (!function_exists('__')) {
|
||||
function __(string $name = '', array $parameters = [], ?string $domain = null, ?string $locale = null)
|
||||
{
|
||||
// $locale = $locale ?: locale();
|
||||
// if(!$domain){
|
||||
// $request = Request();
|
||||
// $request->app.','.$request->plugin.','.get_controller_name();
|
||||
// $fn = '/resource/translations/'.$locale.'/'.($request->app ? $request->app .'/' : '').strtolower(get_controller_name());
|
||||
|
||||
// if($request->plugin){
|
||||
// $fn = base_path('plugin').'/'.$request->plugin.$fn;
|
||||
// }else{
|
||||
// $fn = base_path($fn);
|
||||
// }
|
||||
// $domain = $fn;
|
||||
// }
|
||||
return trans($name, $parameters, $domain, $locale);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user