feat: 飞书登录支持多租户和用户工号管理

后端改动:
- FeishuService: 从飞书用户信息获取 tenant_key 和手机号
- FeishuService: 新增 user_sn 表工号分配机制
- FeishuService: 优先使用 enterprise_email,支持手机号
- AuthController: 飞书免登支持 company 参数

前端改动:
- FeishuAutoLogin: 支持多租户 company 参数
- login/index: 支持 redirect 参数和已登录检测
- QRCodeLogin: 支持多租户参数传递
- router: 新增路由守卫和参数处理
- api.ts: 优化飞书登录 API 调用

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-02-27 17:57:49 +08:00
parent b1895be50d
commit b1ca2c58b7
8 changed files with 241 additions and 41 deletions
+6 -3
View File
@@ -60,7 +60,10 @@ export default function FeishuAutoLogin() {
tryFeishuAutoLogin()
function tryFeishuAutoLogin() {
const appId = 'cli_a8033d607cba500d'
// 从 URL 获取 company 参数
const urlParams = new URLSearchParams(window.location.search)
const companyParam = urlParams.get('company')
console.log('🔍 URL 中的 company 参数:', companyParam)
// 打印 tt 对象的所有方法
if (window.tt) {
@@ -75,8 +78,8 @@ export default function FeishuAutoLogin() {
// 方式1: tt.requestAuthCode
if (window.tt && typeof window.tt.requestAuthCode === 'function') {
console.log('使用 tt.requestAuthCode')
// 不传 appId,让飞书自动选择(后端会根据 company 参数处理)
window.tt.requestAuthCode({
appId,
success: (res: any) => {
console.log('✅ 获取到授权码:', res.code?.substring(0, 20))
handleLogin(res.code)
@@ -117,7 +120,7 @@ export default function FeishuAutoLogin() {
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
auth_code: authCode,
tenant_key: '14e7bc0fe5985740',
company: urlParams.get('company') || undefined,
}),
})