init
This commit is contained in:
36
app/common/behavior/SystemConfig.local.php
Executable file
36
app/common/behavior/SystemConfig.local.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\behavior;
|
||||
|
||||
use think\Config;
|
||||
use think\Cache;
|
||||
use think\Loader;
|
||||
use think\App;
|
||||
use think\Log;
|
||||
|
||||
/**
|
||||
* Description of SystemConfig
|
||||
* 系统配置初始化
|
||||
*/
|
||||
class SystemConfig {
|
||||
|
||||
/**
|
||||
* 系统配置读取并缓存
|
||||
*/
|
||||
public function run() {
|
||||
$config = Cache::get('common_config_data');
|
||||
$configuk = Cache::get('common_config_data_uk');
|
||||
if (empty($config)) {
|
||||
$config = Loader::model('Sysconfig')->configLists(['group' => ['in', [1, 2, 3, 4, 6]]]);
|
||||
Cache::tag('sysconfig')->set('common_config_data', $config);
|
||||
App::$debug && Log::record("[ 系统配置 ]:初始化成功");
|
||||
}
|
||||
if (empty($configuk)) {
|
||||
$config = Loader::model('SysconfigEn')->configLists(['group' => ['in', [1, 2, 3, 4, 6]]]);
|
||||
Cache::tag('sysconfiguk')->set('common_config_data_uk', $configuk);
|
||||
App::$debug && Log::record("[ 系统配置 ]:初始化成功");
|
||||
}
|
||||
Config::set($configuk);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user