Commit Graph

10 Commits

Author SHA1 Message Date
root b1ca2c58b7 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>
2026-02-27 17:57:49 +08:00
root fdbe2e837a refactor: 删除 users 表中的冗余飞书字段
- 删除 feishu_user_id, feishu_open_id, tenant_key 字段
- JWT token 改用 feishu_app_id 代替 feishu_user_id
- 删除废弃的 FeishuService::sendApprovalMessage() 方法
- 更新 User 模型移除废弃字段和 scope 方法

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:33:58 +08:00
root 0489da5e40 refactor: 重构多飞书应用绑定架构和数据库清理
- 新增 user_feishu_apps 表支持用户绑定多个飞书应用
- users 表添加唯一约束(公司内邮箱/手机唯一)
- 迁移现有飞书数据到 user_feishu_apps 表
- 清理冗余表(users_bak, user_feishu_binding)
- 废弃 users 表中的 feishu_user_id/feishu_open_id/tenant_key 字段
- 更新 FeishuNotificationService 使用新的数据获取方式
- User 模型新增 getFeishuUserId() 等便捷方法

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 16:27:33 +08:00
root 2e5f570b40 feat: 完善鉴权和密码功能,添加飞书通知模块
- 完善Token过期/不存在时跳转登录重新认证
- 实现正常的账号密码登录验证(邮箱/手机号+密码)
- 用户初始化密码设为工号(sn)
- 添加修改密码功能(API+前端页面)
- 修复扫码登录后跳转问题(zustand persist格式)
- 创建飞书通知服务 FeishuNotificationService
- 设置页面添加修改密码入口

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 15:19:37 +08:00
root 6899bad529 refactor: 重构飞书授权代码,提取公共工具类
1. 创建 app/util/HttpClient.php
   - 公共 HTTP 请求类
   - httpGet() 和 httpPost() 方法
   - 支持自定义 headers 和 timeout
   - 统一错误处理和日志

2. 创建 app/util/FeishuUtil.php
   - 飞书授权工具类,可被其他业务模块复用
   - getAppAccessToken() - 获取应用访问令牌(带缓存)
   - getUserAccessToken() - 获取用户访问令牌
   - getUserInfo() - 获取用户信息
   - getCompleteUserInfo() - 一步获取完整用户信息
   - clearTokenCache() - 清除 token 缓存

3. 重构 app/service/FeishuService.php
   - 使用新的工具类
   - 移除重复的 HTTP 请求方法
   - 保持向后兼容

飞书授权流程:
1. app_access_token (应用级令牌)
2. user_access_token (用户级令牌,需要 app_access_token)
3. 用户信息 (需要 user_access_token)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 10:43:29 +08:00
root b1d58ece61 fix: 使用飞书官方 passport 授权端点
后端修改:
- 授权 URL 从 open-apis 改为 passport.feishu.cn
- 使用 passport 端点获取 user_access_token
- 添加 httpGet 方法

前端修改:
- 使用官方 tt.requestAuthCode() API(飞书内免登)
- 保留轮询方式实现扫码登录

参考文档: https://open.feishu.cn/document/sso/web-application-sso/qr-sdk-documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 10:20:48 +08:00
root 66b61eada4 refactor: 使用官方support\Db和support\Model
- 创建 support/Db.php 和 support/Model.php
- 在 bootstrap.php 中自动初始化数据库
- 移除 app/util/Db.php
- 更新所有模型和控制器使用官方类

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:15:17 +08:00
root 582f454a5a refactor: 重构后端目录结构和命名规范
- 将后端目录名从大写改为小写 (Controller->controller 等)
- 将命名空间从 App\ 改为 app\ (符合 webman 官方规范)
- 移除不必要的 bootstrap 目录
- 完善出差审批业务功能:
  - 添加删除草稿功能
  - 添加审批操作功能(同意/拒绝)
  - 完善审批详情页,显示审批人和审批记录
- 前端优化:
  - 调整列表页行高
  - 隐藏底部导航栏
  - 仪表盘只显示3个快捷入口

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 18:09:04 +08:00
root 09d4cb8054 fix: 修复页面间状态丢失问题并优化选择页面
- 修复选择审批人后再选择抄送人导致状态丢失的问题
- 使用独立的 sessionStorage key (selectedApprovers, selectedCc)
- 组件每次挂载时从 sessionStorage 恢复状态
- 只在提交/保存成功后清除 sessionStorage
- 优化人员选择页面布局和样式
- 更新 CLAUDE.md 文档记录问题和解决方案

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 15:22:12 +08:00
root 8629f4a4ce refactor: fix directory structure and namespaces for webman conventions
- Rename directories to lowercase: Controller→controller, Model→model, Service→service, Util→util, Bootstrap→bootstrap
- Update all namespaces from App\Xxx to app\xxx (webman convention)
- Update all import statements across the codebase
- Update route.php to use lowercase namespaces
- Remove unused CompanyFeishuApp model
- Comment out unimplemented controller routes

Following webman 2.x framework conventions:
- Models: app\model\{ClassName}
- Controllers: app\controller\{ClassName}
- Services: app\service\{ClassName}
- Utils: app\util\{ClassName}
- Middleware: app\middleware\{ClassName}

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 18:28:23 +08:00