|
|
@@ -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)
|
|
|
+}
|