From b9e3ba65c2eb49601de50c962e6d484bcb8d2a42 Mon Sep 17 00:00:00 2001 From: "453530270@qq.com" Date: Sun, 6 Oct 2024 21:16:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9E=84=E9=80=A0=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/ApiController.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/api/controller/ApiController.php b/app/api/controller/ApiController.php index 748d54d..c7deafa 100644 --- a/app/api/controller/ApiController.php +++ b/app/api/controller/ApiController.php @@ -11,11 +11,27 @@ use think\Request; * @package app\api\controller */ abstract class ApiController { - /** + /** * Request实例 * @var Request */ protected $request; + /** + * 构造方法 + * BaseController constructor. + * @param App $app + */ + public function __construct(App $app) + { + $this->request = $this->app->request; + // 控制器初始化 + $this->initialize(); + } + + // 初始化 + protected function initialize() + { + } /** * 返回封装后的 API 数据到客户端 * @param int|null $status