简化两处写法

This commit is contained in:
huangdijia
2015-12-22 15:18:25 +08:00
parent f6acdd1578
commit d28dbf644e

View File

@@ -110,12 +110,10 @@ class App
}
// 操作方法执行完成监听
APP_HOOK && Hook::listen('action_end', $data);
// 返回数据
if (IN_UNIT_TEST) {
return $data;
} else {
Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit'));
}
// 单元测试模式下返回数据
if (IN_UNIT_TEST) { return $data; }
// 输出数据
Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit'));
} else {
// 操作方法不是Public 抛出异常
throw new \ReflectionException();
@@ -127,12 +125,10 @@ class App
$data = $method->invokeArgs($instance, [$action, '']);
// 操作方法执行完成监听
APP_HOOK && Hook::listen('action_end', $data);
// 返回数据
if (IN_UNIT_TEST) {
return $data;
} else {
Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit'));
}
// 单元测试模式下返回数据
if (IN_UNIT_TEST) { return $data; }
// 输出数据
Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit'));
} else {
throw new Exception('method [ ' . (new \ReflectionClass($instance))->getName() . '->' . $action . ' ] not exists ', 10002);
}