pull/103/head
Gordon 3 years ago
parent bd31d4ff9c
commit cb487e3e79

@ -19,31 +19,28 @@ func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *pbMsg.GetMaxAndMinSeq
maxSeq, err1 := commonDB.DB.GetUserMaxSeq(in.UserID) maxSeq, err1 := commonDB.DB.GetUserMaxSeq(in.UserID)
minSeq, err2 := commonDB.DB.GetUserMinSeq(in.UserID) minSeq, err2 := commonDB.DB.GetUserMinSeq(in.UserID)
resp := new(pbMsg.GetMaxAndMinSeqResp) resp := new(pbMsg.GetMaxAndMinSeqResp)
if err1 == nil && err2 == nil { if err1 == nil {
resp.MaxSeq = maxSeq resp.MaxSeq = maxSeq
resp.MinSeq = minSeq } else if err1 == redis.ErrNil {
resp.ErrCode = 0
resp.ErrMsg = ""
return resp, nil
} else {
if err1 == redis.ErrNil {
resp.MaxSeq = 0 resp.MaxSeq = 0
} else if err1 != nil { } else {
log.NewInfo(in.OperationID, "getMaxSeq from redis error", in.String(), err1.Error()) log.NewError(in.OperationID, "getMaxSeq from redis error", in.String(), err1.Error())
resp.MaxSeq = -1 resp.MaxSeq = -1
resp.ErrCode = 200
resp.ErrMsg = "redis get err"
} }
if err2 == redis.ErrNil { if err2 == nil {
resp.MinSeq = minSeq
} else if err2 == redis.ErrNil {
resp.MinSeq = 0 resp.MinSeq = 0
} else if err2 != nil { } else {
log.NewInfo(in.OperationID, "getMinSeq from redis error", in.String(), err2.Error()) log.NewError(in.OperationID, "getMaxSeq from redis error", in.String(), err2.Error())
resp.MinSeq = -1 resp.MinSeq = -1
resp.ErrCode = 200
resp.ErrMsg = "redis get err"
} }
resp.ErrCode = 0
resp.ErrMsg = ""
return resp, nil return resp, nil
} }
}
func (rpc *rpcChat) PullMessage(_ context.Context, in *pbMsg.PullMessageReq) (*pbMsg.PullMessageResp, error) { func (rpc *rpcChat) PullMessage(_ context.Context, in *pbMsg.PullMessageReq) (*pbMsg.PullMessageResp, error) {
log.InfoByKv("rpc pullMessage is arriving", in.OperationID, "args", in.String()) log.InfoByKv("rpc pullMessage is arriving", in.OperationID, "args", in.String())
resp := new(pbMsg.PullMessageResp) resp := new(pbMsg.PullMessageResp)

Loading…
Cancel
Save