mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-09 16:12:49 +08:00
简化两处写法
This commit is contained in:
@@ -110,12 +110,10 @@ class App
|
|||||||
}
|
}
|
||||||
// 操作方法执行完成监听
|
// 操作方法执行完成监听
|
||||||
APP_HOOK && Hook::listen('action_end', $data);
|
APP_HOOK && Hook::listen('action_end', $data);
|
||||||
// 返回数据
|
// 单元测试模式下返回数据
|
||||||
if (IN_UNIT_TEST) {
|
if (IN_UNIT_TEST) { return $data; }
|
||||||
return $data;
|
// 输出数据
|
||||||
} else {
|
Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit'));
|
||||||
Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit'));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// 操作方法不是Public 抛出异常
|
// 操作方法不是Public 抛出异常
|
||||||
throw new \ReflectionException();
|
throw new \ReflectionException();
|
||||||
@@ -127,12 +125,10 @@ class App
|
|||||||
$data = $method->invokeArgs($instance, [$action, '']);
|
$data = $method->invokeArgs($instance, [$action, '']);
|
||||||
// 操作方法执行完成监听
|
// 操作方法执行完成监听
|
||||||
APP_HOOK && Hook::listen('action_end', $data);
|
APP_HOOK && Hook::listen('action_end', $data);
|
||||||
// 返回数据
|
// 单元测试模式下返回数据
|
||||||
if (IN_UNIT_TEST) {
|
if (IN_UNIT_TEST) { return $data; }
|
||||||
return $data;
|
// 输出数据
|
||||||
} else {
|
Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit'));
|
||||||
Response::returnData($data, Config::get('default_return_type'), Config::get('response_exit'));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('method [ ' . (new \ReflectionClass($instance))->getName() . '->' . $action . ' ] not exists ', 10002);
|
throw new Exception('method [ ' . (new \ReflectionClass($instance))->getName() . '->' . $action . ' ] not exists ', 10002);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user