fix: 设备组详情补充 auth_type/device_type 字段,统一用户名显示
Build docker and publish / build (20.15.1) (push) Successful in 8m15s
Build docker and publish / build (20.15.1) (push) Successful in 8m15s
- FamilyMemberItem 新增 auth_type、device_type 字段 - FamilySummary 新增 owner_auth_type 字段 - findUserIdentifiers 返回 identifierInfo(含 auth_type) - 新增 parseDeviceType() 从 UserAgent 解析设备类型 Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
@@ -63,18 +63,22 @@ func (l *GetFamilyDetailLogic) GetFamilyDetail(req *types.GetFamilyDetailRequest
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DatabaseQueryError), "query family member identifiers failed")
|
||||
}
|
||||
|
||||
// 查出所有成员的设备,构建 userId → deviceNo 映射
|
||||
// 查出所有成员的设备,构建 userId → deviceNo 映射 + deviceType 映射
|
||||
deviceNoMap := make(map[int64]string)
|
||||
deviceTypeMap := make(map[int64]string)
|
||||
devices, _, _ := l.svcCtx.UserModel.QueryDeviceListByUserIds(l.ctx, userIDs)
|
||||
for _, d := range devices {
|
||||
if _, exists := deviceNoMap[d.UserId]; !exists {
|
||||
deviceNoMap[d.UserId] = tool.DeviceIdToHash(d.Id)
|
||||
deviceTypeMap[d.UserId] = parseDeviceType(d.UserAgent)
|
||||
}
|
||||
}
|
||||
|
||||
memberItems := make([]types.FamilyMemberItem, 0, len(members))
|
||||
for _, member := range members {
|
||||
identifier := identifierMap[member.UserId]
|
||||
info := identifierMap[member.UserId]
|
||||
identifier := info.Identifier
|
||||
authType := info.AuthType
|
||||
if identifier == "" {
|
||||
identifier = strconv.FormatInt(member.UserId, 10)
|
||||
}
|
||||
@@ -82,7 +86,9 @@ func (l *GetFamilyDetailLogic) GetFamilyDetail(req *types.GetFamilyDetailRequest
|
||||
memberItem := types.FamilyMemberItem{
|
||||
UserId: member.UserId,
|
||||
Identifier: identifier,
|
||||
DeviceNo : deviceNoMap[member.UserId],
|
||||
AuthType: authType,
|
||||
DeviceNo: deviceNoMap[member.UserId],
|
||||
DeviceType: deviceTypeMap[member.UserId],
|
||||
Role: member.Role,
|
||||
RoleName: mapFamilyRoleName(member.Role),
|
||||
Status: member.Status,
|
||||
@@ -96,7 +102,9 @@ func (l *GetFamilyDetailLogic) GetFamilyDetail(req *types.GetFamilyDetailRequest
|
||||
memberItems = append(memberItems, memberItem)
|
||||
}
|
||||
|
||||
ownerIdentifier := identifierMap[family.OwnerUserId]
|
||||
ownerInfo := identifierMap[family.OwnerUserId]
|
||||
ownerIdentifier := ownerInfo.Identifier
|
||||
ownerAuthType := ownerInfo.AuthType
|
||||
if ownerIdentifier == "" {
|
||||
ownerIdentifier = strconv.FormatInt(family.OwnerUserId, 10)
|
||||
}
|
||||
@@ -106,6 +114,7 @@ func (l *GetFamilyDetailLogic) GetFamilyDetail(req *types.GetFamilyDetailRequest
|
||||
FamilyId: family.Id,
|
||||
OwnerUserId: family.OwnerUserId,
|
||||
OwnerIdentifier: ownerIdentifier,
|
||||
OwnerAuthType: ownerAuthType,
|
||||
Status: mapFamilyStatus(family.Status),
|
||||
ActiveMemberCount: activeMemberCount,
|
||||
MaxMembers: family.MaxMembers,
|
||||
|
||||
Reference in New Issue
Block a user