From 01db0f99560ff4444a7c18fff1b979995558d97b Mon Sep 17 00:00:00 2001 From: augushong Date: Mon, 18 Sep 2023 18:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E8=87=AA=E5=8A=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=9E=B6=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 2 ++ app/common/app/functions.php | 1 + app/{ => common/app}/listen.php | 0 app/common/app/middleware.php | 5 +++++ app/common/app/service.php | 5 +++++ app/event.php | 2 +- app/middleware.php | 12 ++++++++++-- app/provider.php | 6 +++++- app/service.php | 13 ++++++++++--- config/update.php | 14 ++++++++++++++ 10 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 app/common/app/functions.php rename app/{ => common/app}/listen.php (100%) create mode 100644 app/common/app/middleware.php create mode 100644 app/common/app/service.php create mode 100644 config/update.php diff --git a/app/common.php b/app/common.php index 563ad31..f932179 100644 --- a/app/common.php +++ b/app/common.php @@ -10,6 +10,8 @@ use think\facade\Event; use think\facade\Filesystem; use think\route\Url; +include_once __DIR__ . '/app/common/app/functions.php'; + if (!function_exists('__url')) { /** * 构建URL地址 diff --git a/app/common/app/functions.php b/app/common/app/functions.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/app/common/app/functions.php @@ -0,0 +1 @@ + \think\middleware\SessionInit::class, ]; + +$middleware_common = include_once __DIR__ . '/app/common/app/middleware.php'; + +$middleware = array_merge($middleware_default, $middleware_common); + +return ksort($middleware); diff --git a/app/provider.php b/app/provider.php index 2d2febf..bfde3e0 100644 --- a/app/provider.php +++ b/app/provider.php @@ -6,8 +6,12 @@ use app\common\provider\ExceptionHandle; use app\common\provider\Request; use app\common\provider\View; -return [ +$provider_default = [ 'think\Request' => Request::class, 'think\exception\Handle' => ExceptionHandle::class, 'think\View' => View::class, ]; + +$provider_common = include_once __DIR__ . '/app/common/app/provider.php'; + +return array_merge($provider_default, $provider_common); diff --git a/app/service.php b/app/service.php index d6df24b..790b881 100644 --- a/app/service.php +++ b/app/service.php @@ -1,7 +1,14 @@ 'think\\captcha\\CaptchaService', 1 => 'think\\app\\Service', -]; \ No newline at end of file +]; + +$service_common = include_once __DIR__ . '/app/common/app/service.php'; + +$service = array_merge($service_default, $service_common); + +return ksort($service); diff --git a/config/update.php b/config/update.php new file mode 100644 index 0000000..8a1b5ed --- /dev/null +++ b/config/update.php @@ -0,0 +1,14 @@ +