mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 23:52:49 +08:00
改进Route类的路由匹配后的后置行为 允许单独执行输出 并废除 response_auto_output 配置参数
This commit is contained in:
@@ -31,8 +31,6 @@ return [
|
|||||||
'lang_switch_on' => false,
|
'lang_switch_on' => false,
|
||||||
// 默认全局过滤方法 用逗号分隔多个
|
// 默认全局过滤方法 用逗号分隔多个
|
||||||
'default_filter' => '',
|
'default_filter' => '',
|
||||||
// 自动Response输出
|
|
||||||
'response_auto_output' => true,
|
|
||||||
// 是否启用控制器类后缀
|
// 是否启用控制器类后缀
|
||||||
'use_controller_suffix' => false,
|
'use_controller_suffix' => false,
|
||||||
|
|
||||||
@@ -214,9 +212,9 @@ return [
|
|||||||
'slave_no' => '',
|
'slave_no' => '',
|
||||||
],
|
],
|
||||||
//分页配置
|
//分页配置
|
||||||
'paginate' => [
|
'paginate' => [
|
||||||
'type' => 'bootstrap',
|
'type' => 'bootstrap',
|
||||||
'var_page' => 'page'
|
'var_page' => 'page',
|
||||||
]
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -94,13 +94,16 @@ class App
|
|||||||
// 规则闭包
|
// 规则闭包
|
||||||
$data = self::invokeFunction($dispatch['function'], $dispatch['params']);
|
$data = self::invokeFunction($dispatch['function'], $dispatch['params']);
|
||||||
break;
|
break;
|
||||||
|
case 'finish':
|
||||||
|
// 已经完成 不再继续执行
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception('dispatch type not support', 10008);
|
throw new Exception('dispatch type not support', 10008);
|
||||||
}
|
}
|
||||||
// 监听app_end
|
// 监听app_end
|
||||||
APP_HOOK && Hook::listen('app_end', $data);
|
APP_HOOK && Hook::listen('app_end', $data);
|
||||||
// 输出数据到客户端
|
// 输出数据到客户端
|
||||||
if (Config::get('response_auto_output')) {
|
if (isset($data)) {
|
||||||
// 自动响应输出
|
// 自动响应输出
|
||||||
return Response::send($data, Response::type(), Config::get('response_return'));
|
return Response::send($data, Response::type(), Config::get('response_return'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -525,7 +525,10 @@ class Route
|
|||||||
// 匹配到路由规则
|
// 匹配到路由规则
|
||||||
// 检测是否定义路由
|
// 检测是否定义路由
|
||||||
if (!empty($option['after_behavior'])) {
|
if (!empty($option['after_behavior'])) {
|
||||||
Hook::exec($option['after_behavior'], $route);
|
$result = Hook::exec($option['after_behavior'], $route);
|
||||||
|
if (false === $result) {
|
||||||
|
return ['type' => 'finish'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($route instanceof \Closure) {
|
if ($route instanceof \Closure) {
|
||||||
// 执行闭包
|
// 执行闭包
|
||||||
|
|||||||
Reference in New Issue
Block a user