feat: new xboard

This commit is contained in:
xboard
2025-01-21 14:57:54 +08:00
parent de18cfe596
commit 0f43fff242
373 changed files with 17923 additions and 20264 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Http\Middleware;
use App\Exceptions\ApiException;
use App\Services\AuthService;
use Auth;
use Closure;
use Illuminate\Support\Facades\Cache;
@@ -18,14 +19,9 @@ class User
*/
public function handle($request, Closure $next)
{
$authorization = $request->input('auth_data') ?? $request->header('authorization');
if (!$authorization) throw new ApiException( '未登录或登陆已过期', 403);
$user = AuthService::decryptAuthData($authorization);
if (!$user) throw new ApiException('未登录或登陆已过期', 403);
$request->merge([
'user' => $user
]);
if (!Auth::guard('sanctum')->check()) {
throw new ApiException('未登录或登陆已过期', 403);
}
return $next($request);
}
}