From fb85089b385a32a7ee5eb676c7f0fbbb55f2b022 Mon Sep 17 00:00:00 2001 From: hawind Date: Sat, 19 Jun 2021 16:06:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=A1=8C=E6=94=BF=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E6=B7=BB=E5=8A=A0=E5=90=8E=E6=97=A0=E6=B3=95=E9=80=89?= =?UTF-8?q?=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Gdoo/System/Hooks/RegionHook.php | 40 ++++++++++++++++++++++++++++ app/Gdoo/System/config.php | 3 +++ 2 files changed, 43 insertions(+) create mode 100644 app/Gdoo/System/Hooks/RegionHook.php diff --git a/app/Gdoo/System/Hooks/RegionHook.php b/app/Gdoo/System/Hooks/RegionHook.php new file mode 100644 index 00000000..518a5189 --- /dev/null +++ b/app/Gdoo/System/Hooks/RegionHook.php @@ -0,0 +1,40 @@ + 0) { + $parent = Db::table('region')->where('id', $master['parent_id'])->first(); + $master['layer'] = $parent['layer'] + 1; + } + + $params['master'] = $master; + return $params; + } + + public function onAfterStore($params) { + return $params; + } + + public function onBeforeDelete($params) { + return $params; + } + +} diff --git a/app/Gdoo/System/config.php b/app/Gdoo/System/config.php index 041f9519..91d942c2 100644 --- a/app/Gdoo/System/config.php +++ b/app/Gdoo/System/config.php @@ -10,6 +10,9 @@ return [ 'url' => 'system/region/dialog', ], ], + "listens" => [ + 'region' => 'Gdoo\System\Hooks\RegionHook', + ], "controllers" => [ "setting" => [ "name" => "基础设置",