func RedisDeleteTeamMember(tid, uid uint64) error { userKey := fmt.Sprintf("%s%d", SET_TEAM_MEMBER, tid) val := fmt.Sprintf("%d", uid) redis.SRem(userKey, val) //member version val = fmt.Sprintf("%d", time.Now().Unix()) userKey = fmt.Sprintf("%s%d", KEY_TEAM_MEMBER_VER, tid) redis.RedisSet(userKey, val) userKey = fmt.Sprintf("%s%d", SET_USERS_TEAM, uid) val = fmt.Sprintf("%d", tid) redis.SRem(userKey, val) return nil }
func RedisDeleteTeam(tid uint64) error { userKey := fmt.Sprintf("%s%d", KEY_TEAM_INFO, tid) redis.RedisDel(userKey) userKey = fmt.Sprintf("%s%d", SET_TEAM_MEMBER, tid) uidList, err := redis.SMembers(userKey).Result() if err != nil { return errors.As(err, tid) } else { for _, val := range uidList { userKey2 := fmt.Sprintf("%s%s", SET_USERS_TEAM, val) val := fmt.Sprintf("%d", tid) redis.SRem(userKey2, val) } } redis.RedisDel(userKey) return nil }