39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
namespace app\common;
|
|
use think\facade\Cache;
|
|
use think\Db;
|
|
|
|
class SystemDeal
|
|
{
|
|
public function initConstant()
|
|
{
|
|
//初始化系统常量
|
|
$system_constant = Cache::get("SYSTEM_CONSTANT");
|
|
if (!$system_constant) {
|
|
$list = Db::name('constants')->column("param_value","param_name");
|
|
$system_constant = array();
|
|
foreach ($list as $k => $v) {
|
|
$system_constant[$k] = json_decode($v,true);
|
|
}
|
|
Cache::set('SYSTEM_CONSTANT', $system_constant,120);
|
|
}
|
|
config('SYSTEM_CONSTANT',$system_constant);
|
|
}
|
|
|
|
//初始化短信常量
|
|
/*public function initSmsConstant()
|
|
{
|
|
//初始化系统常量
|
|
$sms_constant = Cache::get("SMS_CONSTANT");
|
|
if (!$sms_constant) {
|
|
$list = Db::name('constants')->column("param_value","param_name");
|
|
$system_constant = array();
|
|
foreach ($list as $k => $v) {
|
|
$system_constant[$k] = json_decode($v,true);
|
|
}
|
|
Cache::set('SYSTEM_CONSTANT', $system_constant,120);
|
|
}
|
|
config('SYSTEM_CONSTANT',$system_constant);
|
|
}*/
|
|
}
|