修复个人中心问题
This commit is contained in:
@@ -4,8 +4,26 @@ import (
|
||||
"strings"
|
||||
|
||||
"server/models"
|
||||
authsvc "server/services/auth"
|
||||
)
|
||||
|
||||
// ResolveTenantUID 把「令牌中的 user_id(认证中心 identity_id)」换算成
|
||||
// 老表 yz_system_tenant_user.uid。
|
||||
//
|
||||
// 背景:uid 全量迁移脚本(scripts/uidmigrate)刻意跳过 yz_system_tenant_user
|
||||
// (见其 skipTables),业务表列迁成 identity_id,而老表 uid 仍是老值。
|
||||
// 因此凡是用 identity_id 去查老表的场景都必须先经过这里换算;
|
||||
// 两者已经对齐的环境(或传入的本来就是老 uid)原值返回。
|
||||
func ResolveTenantUID(tid, userID uint64) uint64 {
|
||||
if tid == 0 || userID == 0 {
|
||||
return 0
|
||||
}
|
||||
if legacy := authsvc.FindLegacyUID(tid, userID); legacy > 0 {
|
||||
return legacy
|
||||
}
|
||||
return userID
|
||||
}
|
||||
|
||||
// BindTenantUser 绑定用户到租户(若已存在则更新状态/默认值)
|
||||
func BindTenantUser(tid, uid uint64, account, name, phone, email *string, sex *uint8, birth *string, password *string, isDefault, status int8, remark *string) (uint64, error) {
|
||||
var existed models.SystemTenantUser
|
||||
|
||||
Reference in New Issue
Block a user