mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-08 19:12:48 +08:00
优化sysconfig助手函数;
This commit is contained in:
@@ -34,7 +34,6 @@ if (!function_exists('password')) {
|
|||||||
$value = sha1('blog_') . md5($value) . md5('_encrypt') . sha1($value);
|
$value = sha1('blog_') . md5($value) . md5('_encrypt') . sha1($value);
|
||||||
return sha1($value);
|
return sha1($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('xdebug')) {
|
if (!function_exists('xdebug')) {
|
||||||
@@ -58,12 +57,12 @@ if (!function_exists('xdebug')) {
|
|||||||
|
|
||||||
$str = '';
|
$str = '';
|
||||||
|
|
||||||
if(is_string($data)){
|
if (is_string($data)) {
|
||||||
$str = $data;
|
$str = $data;
|
||||||
}else{
|
} else {
|
||||||
if(is_array($data) || is_object($data)){
|
if (is_array($data) || is_object($data)) {
|
||||||
$str = print_r($data, true);
|
$str = print_r($data, true);
|
||||||
}else{
|
} else {
|
||||||
$str = var_export($data, true);
|
$str = var_export($data, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,20 +78,22 @@ if (!function_exists('sysconfig')) {
|
|||||||
/**
|
/**
|
||||||
* 获取系统配置信息
|
* 获取系统配置信息
|
||||||
* @param $group
|
* @param $group
|
||||||
* @param null $name
|
* @param null|bool|string $name
|
||||||
* @return array|mixed
|
* @return array|mixed
|
||||||
*/
|
*/
|
||||||
function sysconfig($group, $name = null)
|
function sysconfig($group, $name = null, $default = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($name === true) {
|
if ($name === true) {
|
||||||
$value = Cache::get('sysconfig_' . $group);
|
$value = Cache::get('sysconfig_' . $group);
|
||||||
|
|
||||||
if (empty($value)) {
|
if (empty($value)) {
|
||||||
$value = \app\admin\model\SystemConfig::where('name', $group)->value('value');
|
$value = \app\admin\model\SystemConfig::where('name', $group)->column('value', 'name');
|
||||||
Cache::tag('sysconfig')->set('sysconfig_' . $group, $value);
|
Cache::tag('sysconfig')->set('sysconfig_' . $group, $value);
|
||||||
}
|
}
|
||||||
|
if (is_null($value)) {
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,6 +109,9 @@ if (!function_exists('sysconfig')) {
|
|||||||
Cache::tag('sysconfig')->set("sysconfig_{$group}", $value, 3600);
|
Cache::tag('sysconfig')->set("sysconfig_{$group}", $value, 3600);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (is_null($value)) {
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,7 +132,6 @@ if (!function_exists('array_format_key')) {
|
|||||||
}
|
}
|
||||||
return $newArray;
|
return $newArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function_exists('auth')) {
|
if (!function_exists('auth')) {
|
||||||
@@ -147,7 +150,6 @@ if (!function_exists('auth')) {
|
|||||||
$check = $authService->checkNode($node);
|
$check = $authService->checkNode($node);
|
||||||
return $check;
|
return $check;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -176,4 +178,4 @@ function json_message($data = [], $code = 0, $msg = '')
|
|||||||
'msg' => $msg,
|
'msg' => $msg,
|
||||||
'data' => $data
|
'data' => $data
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user