feat: tenant-scoped routing and portal navigation

This commit is contained in:
2026-01-08 21:30:46 +08:00
parent f3aa92078a
commit 3e095c57f3
52 changed files with 1111 additions and 670 deletions

View File

@@ -31,7 +31,7 @@ func (s *user) SendOTP(ctx context.Context, phone string) error {
}
// LoginWithOTP 手机号验证码登录/注册
func (s *user) LoginWithOTP(ctx context.Context, phone, otp string) (*auth_dto.LoginResponse, error) {
func (s *user) LoginWithOTP(ctx context.Context, tenantID int64, phone, otp string) (*auth_dto.LoginResponse, error) {
// 1. 校验验证码 (模拟:固定 123456)
if otp != "1234" {
return nil, errorx.ErrInvalidCredentials.WithMsg("验证码错误")
@@ -67,8 +67,8 @@ func (s *user) LoginWithOTP(ctx context.Context, phone, otp string) (*auth_dto.L
// 4. 生成 Token
token, err := s.jwt.CreateToken(s.jwt.CreateClaims(jwt.BaseClaims{
UserID: u.ID,
// TenantID: 0, // 初始登录无租户上下文
UserID: u.ID,
TenantID: tenantID,
}))
if err != nil {
return nil, errorx.ErrInternalError.WithMsg("生成令牌失败")