Пример #1
0
func RedisIsTeamMember(teamId, uid uint64) (bool, error) {
	userKey := fmt.Sprintf("%s%d", SET_TEAM_MEMBER, teamId)
	val := fmt.Sprintf("%d", uid)

	is, err := redis.SIsMember(userKey, val).Result()

	if err != nil {
		return false, errors.As(err, teamId, uid)
	}

	return is, nil
}
Пример #2
0
func RedisQueryFriend(uid, fid uint64, typ int) bool {
	userKey := ""
	if typ == 1 {
		userKey = fmt.Sprintf("%s%d", SET_WHITELIST, uid)
	} else {
		userKey = fmt.Sprintf("%s%d", SET_BLACKLIST, uid)
	}

	val := fmt.Sprintf("%d", fid)

	result := redis.SIsMember(userKey, val)
	if result == nil {
		if typ == 1 {
			return true
		} else {
			return false
		}
	}
	return result.Val()
}