* [apiv2] Fix display of apiv1
This commit is contained in:
@@ -119,6 +119,20 @@ class control extends baseControl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向浏览器输出内容。
|
||||
* Print the content of the view.
|
||||
*
|
||||
* @param string $moduleName module name
|
||||
* @param string $methodName method name
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function display($moduleName = '', $methodName = '')
|
||||
{
|
||||
$this->render($moduleName, $methodName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向浏览器输出内容。
|
||||
* Print the content of the view.
|
||||
@@ -130,6 +144,21 @@ class control extends baseControl
|
||||
*/
|
||||
public function render($moduleName = '', $methodName = '')
|
||||
{
|
||||
if($this->app->apiVersion != 'v2')
|
||||
{
|
||||
$this->parseJSON($moduleName, $methodName);
|
||||
|
||||
$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']);
|
||||
|
||||
ob_start();
|
||||
echo $this->output;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(empty($moduleName)) $moduleName = $this->moduleName;
|
||||
if(empty($methodName)) $methodName = $this->methodName;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user