From 04282ea72149fedfcaca5393dfca307b2b9692d7 Mon Sep 17 00:00:00 2001 From: augushong Date: Wed, 16 Feb 2022 11:15:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0sysconfig=E7=9A=84=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E6=9F=A5name=E7=9A=84=E7=94=A8=E6=B3=95;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/common.php b/app/common.php index b9d9e9f..e9cb38f 100644 --- a/app/common.php +++ b/app/common.php @@ -84,6 +84,18 @@ if (!function_exists('sysconfig')) { */ function sysconfig($group, $name = null) { + + if ($name === true) { + $value = Cache::get('sysconfig_' . $group); + + if (empty($value)) { + $value = \app\admin\model\SystemConfig::where('name', $group)->value('value'); + Cache::tag('sysconfig')->set('sysconfig_' . $group, $value); + } + + return $value; + } + $where = ['group' => $group]; $value = empty($name) ? Cache::get("sysconfig_{$group}") : Cache::get("sysconfig_{$group}_{$name}"); if (empty($value)) {