From 076d3a4655a4e31a5b9ee3b17fc96a8b6f0e8bbe Mon Sep 17 00:00:00 2001 From: nguyenanhung Date: Sat, 25 Jun 2022 14:22:41 +0700 Subject: [PATCH] Update Base --- hungng/HungNG_CI_Base_Controllers.php | 30 +++++++++++++++++++++++++++ hungng/HungNG_CI_Base_Module.php | 30 +++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/hungng/HungNG_CI_Base_Controllers.php b/hungng/HungNG_CI_Base_Controllers.php index 479f7c3..0f129df 100644 --- a/hungng/HungNG_CI_Base_Controllers.php +++ b/hungng/HungNG_CI_Base_Controllers.php @@ -72,6 +72,36 @@ public function __construct() parent::__construct(); } + /** + * Function defaultJsonResponseInfo + * + * @author : 713uk13m + * @copyright: 713uk13m + * @time : 25/06/2022 20:41 + */ + protected function defaultJsonResponseInfo() + { + $response = [ + 'code' => StatusCodes::HTTP_OK, + 'message' => StatusCodes::$statusTexts[StatusCodes::HTTP_OK], + 'info' => [ + 'name' => 'Nguyen An Hung', + 'email' => 'dev@nguyenanhung.com', + 'web' => 'https://nguyenanhung.com', + 'blog' => 'https://blog.nguyenanhung.com', + 'facebook' => 'https://facebook.com/nguyenanhung', + 'github' => 'https://github.com/nguyenanhung', + ], + 'request_data' => [ + 'ip' => getIPAddress(), + 'user_agent' => $this->input->user_agent(true), + 'request_method' => $this->input->method(true) + ] + ]; + $this->output->set_status_header()->set_content_type('application/json', 'utf-8')->set_output(json_encode($response, JSON_PRETTY_PRINT))->_display(); + exit; + } + /** * Function renderOutput * diff --git a/hungng/HungNG_CI_Base_Module.php b/hungng/HungNG_CI_Base_Module.php index 5c4c424..c1cfb4f 100644 --- a/hungng/HungNG_CI_Base_Module.php +++ b/hungng/HungNG_CI_Base_Module.php @@ -72,6 +72,36 @@ public function __construct() parent::__construct(); } + /** + * Function defaultJsonResponseInfo + * + * @author : 713uk13m + * @copyright: 713uk13m + * @time : 25/06/2022 20:41 + */ + protected function defaultJsonResponseInfo() + { + $response = [ + 'code' => StatusCodes::HTTP_OK, + 'message' => StatusCodes::$statusTexts[StatusCodes::HTTP_OK], + 'info' => [ + 'name' => 'Nguyen An Hung', + 'email' => 'dev@nguyenanhung.com', + 'web' => 'https://nguyenanhung.com', + 'blog' => 'https://blog.nguyenanhung.com', + 'facebook' => 'https://facebook.com/nguyenanhung', + 'github' => 'https://github.com/nguyenanhung', + ], + 'request_data' => [ + 'ip' => getIPAddress(), + 'user_agent' => $this->input->user_agent(true), + 'request_method' => $this->input->method(true) + ] + ]; + $this->output->set_status_header()->set_content_type('application/json', 'utf-8')->set_output(json_encode($response, JSON_PRETTY_PRINT))->_display(); + exit; + } + /** * Function renderOutput *