Skip to content

Commit 3209c11

Browse files
author
zhaoxiang
committed
fixed 修复因为普通模式请求异常
1 parent 8380caa commit 3209c11

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/middleware/ApiAuth.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ public function handle($request, \Closure $next) {
2525
$header = config('apiadmin.CROSS_DOMAIN');
2626

2727
$pathParam = [];
28-
$pathArr = explode('/', $request->pathinfo());
28+
$pathParamStr = str_replace($request->rule()->getRule() . '/', '', $request->pathinfo());
29+
$pathArr = explode('/', $pathParamStr);
2930
$pathArrLen = count($pathArr);
3031
for ($index = 0; $index < $pathArrLen; $index += 2) {
3132
if ($index + 1 < $pathArrLen) {
3233
$pathParam[$pathArr[$index]] = $pathArr[$index + 1];
3334
}
3435
}
35-
$apiHash = $pathParam['api'];
36+
$apiHash = str_replace('api/', '', $request->rule()->getRule());
3637

3738
if ($apiHash) {
3839
$cached = Cache::has('ApiInfo:' . $apiHash);

0 commit comments

Comments
 (0)