fix: 返回完全空白的响应页面

正常飞书APP内扫码流程:
1. 用户扫码确认授权
2. 飞书APP直接返回主界面(不会打开任何页面)
3. 电脑端通过轮询检测登录成功并自动跳转

redirect_uri 是OAuth协议要求的配置,但飞书APP内扫码时不会真正访问此URL。
只有在浏览器扫码时才会真正跳转,此时返回空白页面。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-02-26 11:10:51 +08:00
parent ad6984d22a
commit 457b1d75f0
+3 -18
View File
@@ -261,24 +261,9 @@ class AuthController extends BaseController
$session->user_id = $user->id;
$session->save();
// 返回空页面,自动关闭(飞书APP内会自动返回)
return new \Webman\Http\Response(200, ['Content-Type' => 'text/html; charset=utf-8'], '<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
// 尝试关闭窗口(飞书APP内会自动返回)
window.close();
// 备用:如果无法关闭,显示简单提示
setTimeout(function() {
document.body.innerHTML = "<div style=\'display:flex;align-items:center;justify-content:center;min-height:100vh;margin:0;font-family:sans-serif;text-align:center;color:#666;\'><p>登录成功<br>您可以关闭此页面</p></div>";
}, 100);
</script>
</head>
<body>
</body>
</html>');
// 返回极简空白页面(飞书APP内扫码通常不会真正访问此URL)
// 飞书会在APP内直接处理回调,返回到之前的界面
return new \Webman\Http\Response(200, ['Content-Type' => 'text/html; charset=utf-8'], '');
} catch (\Exception $e) {
return $this->error($e->getMessage());
}