修改 webman-admin /plugin/admin/config/exception.php
异常配置文件为异常插件接管
return [
'' => \Tinywan\ExceptionHandler\Handler::class,
];
修改 webman-admin /plugin/admin/config/route.php
路由不存在回调
Route::fallback(function (Request $request) {
return response($request->uri() . ' not found' , 404);
}, 'admin');
修改为一下配置
Route::fallback(function () {
throw new \Tinywan\ExceptionHandler\Exception\RouteNotFoundException();
}, 'admin');
测试获取账号信息接口 http://127.0.0.1:8787/app/admin/account/info
{
"code": 0,
"data": {
"id": 1,
"username": "admin",
"nickname": "超级管理员",
"avatar": "/app/admin/avatar.png",
"email": null,
"mobile": null,
"isSupperAdmin": true,
"token": "5a814e071702d9415c776f240d5645fc"
},
"msg": "ok"
}
尝试修改接口地址 http://127.0.0.1:8787/app/admin/account/info-2023
。
{
"code": 0,
"msg": "路由地址不存在",
"data": {
"request_url": "GET //127.0.0.1:8787/app/admin/account/info-2023",
"timestamp": "2023-03-12 14:14:48",
"client_ip": "172.18.0.1",
"request_param": []
}
}