批量更新
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"server/models"
|
||||
"server/pkg/jwtutil"
|
||||
"server/pkg/passwordutil"
|
||||
authsvc "server/services/auth"
|
||||
)
|
||||
|
||||
type PlatformLoginUser struct {
|
||||
@@ -133,7 +134,14 @@ func BackendLogin(tenantName, account, password string) (string, *PlatformLoginU
|
||||
|
||||
tenantID := int(tenant.ID)
|
||||
const userType = "backend"
|
||||
token, err := jwtutil.GenerateToken(int(tenantUser.Uid), account, tenantID, userType)
|
||||
|
||||
// 令牌中的 user_id 统一使用认证中心 identity_id(与统一登录签发的一致)。
|
||||
// 业务表的 uid 已全量迁移为同一套 ID,因此老登录入口无需停用也不会错位。
|
||||
userID := int(tenantUser.Uid)
|
||||
if identityID := authsvc.FindIdentityIDByAccount(tenant.ID, account); identityID > 0 {
|
||||
userID = int(identityID)
|
||||
}
|
||||
token, err := jwtutil.GenerateToken(userID, account, tenantID, userType)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user