From ff1ee6b076586cb5009e452bb9d39822df91973e Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期六, 28 十月 2023 18:25:12 +0800 Subject: [PATCH] fix --- service/lru.go | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/service/lru.go b/service/lru.go index 040f2b6..4a9f173 100644 --- a/service/lru.go +++ b/service/lru.go @@ -20,18 +20,23 @@ } func GetUserBaseCache(adminUserId string) *UserBaseInfo { - userCache, ok := userCache.Get(adminUserId) + cache, ok := userCache.Get(adminUserId) if !ok { userService := UserService{} userRecord, err := userService.GetUserInfo(adminUserId) if err != nil { return nil } - subIds, _, err := userService.UUID2CrmUserId(strings.Split(userRecord.SubUserIds, ",")) - subIds = append(subIds, userRecord.ID) - if err != nil { - return nil + var subIds []int + if len(userRecord.SubUserIds) > 0 { + subIds, _, err = userService.UUID2CrmUserId(strings.Split(userRecord.SubUserIds, ",")) + if err != nil { + return nil + } } + + subIds = append(subIds, userRecord.ID) + baseInfo := &UserBaseInfo{ UserId: userRecord.ID, NickName: userRecord.NickName, @@ -40,7 +45,7 @@ SetUserBaseCache(adminUserId, baseInfo) return baseInfo } - return userCache + return cache } func SetUserBaseCache(adminUserId string, user *UserBaseInfo) { -- Gitblit v1.8.0