Exemple #1
0
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
}
Exemple #2
0
func RedisDeleteFriend(uid, fid uint64, typ int) error {
	userKey := ""
	if typ == 1 {
		userKey = fmt.Sprintf("%s%d", SET_WHITELIST, uid)
	} else {
		userKey = fmt.Sprintf("%s%d", SET_BLACKLIST, uid)
	}
	uid_1 := fmt.Sprintf("%d", fid)

	redis.SRem(userKey, uid_1)

	// 双向好友
	if typ == 1 {
		userKey = fmt.Sprintf("%s%d", SET_WHITELIST, fid)
		uid_2 := fmt.Sprintf("%d", uid)
		redis.SRem(userKey, uid_2)
	}

	return nil
}
Exemple #3
0
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
}