From 34c091f232e510ed95dd6e827f9a555cd6e5691b Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 6 Jun 2022 23:27:16 +0800 Subject: [PATCH] signal --- pkg/common/db/newRedisModel.go | 22 +++++++++++++++++++--- pkg/common/db/redisModel.go | 2 ++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/pkg/common/db/newRedisModel.go b/pkg/common/db/newRedisModel.go index 254a06975..ab7a28d8c 100644 --- a/pkg/common/db/newRedisModel.go +++ b/pkg/common/db/newRedisModel.go @@ -10,12 +10,15 @@ import ( "context" "errors" "fmt" + "github.com/garyburd/redigo/redis" + //goRedis "github.com/go-redis/redis/v8" - "github.com/golang/protobuf/proto" - "github.com/mitchellh/mapstructure" "strconv" "time" + + "github.com/golang/protobuf/proto" + "github.com/mitchellh/mapstructure" ) //func (d * DataBases)pubMessage(channel, msg string) { @@ -177,5 +180,18 @@ func (d *DataBases) GetAvailableSignalInvitationInfo(userID string) (invitationI } log2.NewDebug("", utils.GetSelfFuncName(), result, result.String()) invitationInfo, err = d.GetSignalInfoFromCacheByClientMsgID(key) - return invitationInfo, utils.Wrap(err, "GetSignalInfoFromCacheByClientMsgID") + if err != nil { + return nil, utils.Wrap(err, "GetSignalInfoFromCacheByClientMsgID") + } + err = d.delUserSingalList(userID) + if err != nil { + return nil, utils.Wrap(err, "GetSignalInfoFromCacheByClientMsgID") + } + return invitationInfo, nil +} + +func (d *DataBases) delUserSingalList(userID string) error { + keyList := SignalListCache + userID + err := d.rdb.Del(context.Background(), keyList).Err() + return err } diff --git a/pkg/common/db/redisModel.go b/pkg/common/db/redisModel.go index 6d54974ed..364b386ce 100644 --- a/pkg/common/db/redisModel.go +++ b/pkg/common/db/redisModel.go @@ -11,9 +11,11 @@ import ( "encoding/json" "errors" "fmt" + "github.com/garyburd/redigo/redis" "github.com/golang/protobuf/jsonpb" "github.com/golang/protobuf/proto" + //osconfig "google.golang.org/genproto/googleapis/cloud/osconfig/v1alpha" "strconv" )