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:
@@ -53,8 +53,13 @@ func normalizeFamilyStatusInput(status string) (uint8, bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func findUserIdentifiers(ctx context.Context, db *gorm.DB, userIDs []int64) (map[int64]string, error) {
|
||||
identifierMap := make(map[int64]string)
|
||||
type identifierInfo struct {
|
||||
Identifier string
|
||||
AuthType string
|
||||
}
|
||||
|
||||
func findUserIdentifiers(ctx context.Context, db *gorm.DB, userIDs []int64) (map[int64]identifierInfo, error) {
|
||||
identifierMap := make(map[int64]identifierInfo)
|
||||
if len(userIDs) == 0 {
|
||||
return identifierMap, nil
|
||||
}
|
||||
@@ -92,8 +97,31 @@ func findUserIdentifiers(ctx context.Context, db *gorm.DB, userIDs []int64) (map
|
||||
continue
|
||||
}
|
||||
selectedPriority[row.UserId] = currentPriority
|
||||
identifierMap[row.UserId] = row.AuthIdentifier
|
||||
identifierMap[row.UserId] = identifierInfo{
|
||||
Identifier: row.AuthIdentifier,
|
||||
AuthType: row.AuthType,
|
||||
}
|
||||
}
|
||||
|
||||
return identifierMap, nil
|
||||
}
|
||||
|
||||
func parseDeviceType(userAgent string) string {
|
||||
ua := strings.ToLower(userAgent)
|
||||
switch {
|
||||
case strings.Contains(ua, "iphone"):
|
||||
return "iPhone"
|
||||
case strings.Contains(ua, "ipad"):
|
||||
return "iPad"
|
||||
case strings.Contains(ua, "android"):
|
||||
return "Android"
|
||||
case strings.Contains(ua, "windows"):
|
||||
return "Windows"
|
||||
case strings.Contains(ua, "macintosh"), strings.Contains(ua, "mac os"):
|
||||
return "Mac"
|
||||
case strings.Contains(ua, "linux"):
|
||||
return "Linux"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user