Selaa lähdekoodia

special depart add 29

abiao 4 vuotta sitten
vanhempi
commit
ba1d5c656d
1 muutettua tiedostoa jossa 27 lisäystä ja 0 poistoa
  1. 27 0
      go/gopath/src/fohow.com/libs/lib_redis/redis.go

+ 27 - 0
go/gopath/src/fohow.com/libs/lib_redis/redis.go

@@ -62,6 +62,23 @@ func SetRedisValue(key, value string, expiration time.Duration) error {
 }
 
 //获取keyValue
+func GetSimpleValue(key string) (err error, value string) {
+	redisClient := redisInitClient()
+	defer redisClient.Close()
+	_, err = redisClient.Ping().Result()
+	if err != nil {
+		beego.BeeLogger.Error("%s", err)
+		return err, ""
+	}
+	val, err := redisClient.Get(key).Result()
+	if err != nil {
+		return err, ""
+	}
+
+	return nil, val
+}
+
+//获取keyValue
 func GetRedisValue(key string, resp interface{}) (bool, interface{}) {
 	redisClient := redisInitClient()
 	defer redisClient.Close()
@@ -166,3 +183,13 @@ func GetKeyByWxUserId(id int64) string {
 func GetKeyByUserId(id int64) string {
 	return fmt.Sprintf("user_model.GetKeyByUserId:%d", id)
 }
+
+//注册会员 openid rediskey
+func GetOpenIdRedisKey(code string) string {
+	return fmt.Sprintf("user:openid%s", code)
+}
+
+//注册会员 unionid rediskey
+func GetUnionIdRedisKey(code string) string {
+	return fmt.Sprintf("user:unionid%s", code)
+}