Skip to content

Commit

Permalink
Update Base
Browse files Browse the repository at this point in the history
  • Loading branch information
hungnguyenhp committed Jun 25, 2022
1 parent e3869e9 commit 076d3a4
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
30 changes: 30 additions & 0 deletions hungng/HungNG_CI_Base_Controllers.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,36 @@ public function __construct()
parent::__construct();
}

/**
* Function defaultJsonResponseInfo
*
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @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' => '[email protected]',
'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
*
Expand Down
30 changes: 30 additions & 0 deletions hungng/HungNG_CI_Base_Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,36 @@ public function __construct()
parent::__construct();
}

/**
* Function defaultJsonResponseInfo
*
* @author : 713uk13m <[email protected]>
* @copyright: 713uk13m <[email protected]>
* @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' => '[email protected]',
'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
*
Expand Down

0 comments on commit 076d3a4

Please sign in to comment.