| | |
| | | } |
| | | |
| | | 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, |
| | |
| | | SetUserBaseCache(adminUserId, baseInfo) |
| | | return baseInfo |
| | | } |
| | | return userCache |
| | | return cache |
| | | } |
| | | |
| | | func SetUserBaseCache(adminUserId string, user *UserBaseInfo) { |