From f6af8a5b156741b27c9cdb0839aaee465d119da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E9=87=91=E5=8B=87?= Date: Fri, 17 Oct 2025 09:54:19 +0800 Subject: [PATCH] * [apiv2] Compatible apiv1 --- framework/api/control.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/framework/api/control.class.php b/framework/api/control.class.php index 2e841bfae7..cfa1c326f8 100644 --- a/framework/api/control.class.php +++ b/framework/api/control.class.php @@ -86,7 +86,17 @@ class control extends baseControl $output = $this->view ? json_encode($this->view) : null; - if($this->app->responseExtractor != '*') + if($this->app->apiVersion == 'v1') + { + $output = array(); + + $output['status'] = is_object($this->view) ? 'success' : 'fail'; + $output['data'] = json_encode($this->view) ? json_encode($this->view) : ''; + $output['md5'] = md5($output['data']); + + $this->output = json_encode($output); + } + elseif($this->app->responseExtractor != '*') { $this->app->loadClass('jsonextractor'); $extractor = new jsonextractor();