Example #1
0
func CheckKey(user, keyHex string) bool {
	rds := g.GetRedisConn()
	defer g.ReleaseRedisConn(rds)
	checkKey := fmt.Sprintf(common.CHECK_KEY, user)
	var err error
	var rep *gore.Reply
	if rep, err = gore.NewCommand("HGET", checkKey, keyHex).Run(rds); err != nil {
		logs.Info("Get info failed", err)
		return false
	}
	if rep.IsNil() {
		return false
	}
	return true
}
Example #2
0
func GetRealUserRemote(username string) (string, string) {
	var remote string
	rds := g.GetRedisConn()
	defer g.ReleaseRedisConn(rds)

	keys := strings.Split(username, "~")
	user, ident := keys[0], keys[1]
	routeKey := fmt.Sprintf(common.ROUTE_KEY, user)
	var err error
	var rep *gore.Reply
	if rep, err = gore.NewCommand("HGET", routeKey, ident).Run(rds); err != nil {
		logs.Info("Get info failed", err)
		return "", ""
	}
	if rep.IsNil() {
		return "", ""
	}
	remote, _ = rep.String()
	return user, remote
}