mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 07:32:48 +08:00
规范Response中result/success/error方法使用,与view使用方法保持一致,同时完美兼容单元测试
使用方法:
if(false){
return Response::error('error msg');
}else{
return Response::success('success msg');
}
This commit is contained in:
@@ -124,7 +124,7 @@ class App
|
|||||||
// 操作方法执行完成监听
|
// 操作方法执行完成监听
|
||||||
APP_HOOK && Hook::listen('action_end', $data);
|
APP_HOOK && Hook::listen('action_end', $data);
|
||||||
// 输出数据
|
// 输出数据
|
||||||
return Response::send($data, '', Config::get('response_return'));
|
return Response::send($data, Config::get('default_return_type'), Config::get('response_return'));
|
||||||
} 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