From dafe51233b60956a695525a9aae092e70b0f905d Mon Sep 17 00:00:00 2001 From: Devil Date: Sun, 11 Jul 2021 14:43:24 +0800 Subject: [PATCH] =?UTF-8?q?=20=E5=B8=83=E5=B1=80=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E7=8B=AC=E7=AB=8B=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/LayoutService.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/application/service/LayoutService.php b/application/service/LayoutService.php index 2d1158f33..f438c282b 100644 --- a/application/service/LayoutService.php +++ b/application/service/LayoutService.php @@ -10,7 +10,7 @@ // +---------------------------------------------------------------------- namespace app\service; -use app\service\ConfigService; +use think\Db; use app\layout\service\BaseLayout; /** @@ -46,14 +46,20 @@ class LayoutService return DataReturn('布局key值有', -1); } - // 保存数据 + // 配置信息 $config = empty($params['config']) ? '' : BaseLayout::ConfigSaveHandle($params['config']); - $ret = ConfigService::ConfigSave([self::$layout_key[$key]=>$config]); - if($ret['code'] == 0) + + // 数据保存 + $type = self::$layout_key[$key]; + $data = [ + $type => $config, + 'upd_time' => time(), + ]; + if(Db::name('Layout')->where(['type'=>$type, 'is_enable'=>1])->update($data)) { - $ret['msg'] = '操作成功'; + return DataReturn('更新成功', 0); } - return $ret; + return DataReturn('更新失败', -1); } /** @@ -69,7 +75,8 @@ class LayoutService { if(array_key_exists($key, self::$layout_key)) { - return BaseLayout::ConfigAdminHandle(MyC(self::$layout_key[$key])); + $config = Db::name('Layout')->where(['type'=>self::$layout_key[$key], 'is_enable'=>1])->value('config'); + return BaseLayout::ConfigAdminHandle($config); } return ''; } @@ -87,7 +94,8 @@ class LayoutService { if(array_key_exists($key, self::$layout_key)) { - return BaseLayout::ConfigHandle(MyC(self::$layout_key[$key])); + $config = Db::name('Layout')->where(['type'=>self::$layout_key[$key], 'is_enable'=>1])->value('config'); + return BaseLayout::ConfigHandle($config); } return ''; }