mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
Clear personal chat history
This commit is contained in:
parent
4c305b7cc0
commit
2b4df5be16
@ -119,6 +119,7 @@ func main() {
|
||||
chatGroup.POST("/send_msg", apiChat.SendMsg)
|
||||
chatGroup.POST("/pull_msg_by_seq", apiChat.PullMsgBySeqList)
|
||||
chatGroup.POST("/del_msg", apiChat.DelMsg)
|
||||
chatGroup.POST("/clean_up_msg", apiChat.ClearMsg)
|
||||
}
|
||||
//Manager
|
||||
managementGroup := r.Group("/manager")
|
||||
|
@ -5,8 +5,9 @@ import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/grpc-etcdv3/getcdv3"
|
||||
pbChat "Open_IM/pkg/proto/chat"
|
||||
rpc "Open_IM/pkg/proto/chat"
|
||||
pbCommon "Open_IM/pkg/proto/sdk_ws"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
@ -30,7 +31,7 @@ func DelMsg(c *gin.Context) {
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields", err.Error())
|
||||
}
|
||||
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
||||
msgClient := pbChat.NewChatClient(grpcConn)
|
||||
msgClient := rpc.NewChatClient(grpcConn)
|
||||
respPb, err := msgClient.DelMsgList(context.Background(), &reqPb)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), "DelMsgList failed", err.Error(), reqPb)
|
||||
@ -42,3 +43,41 @@ func DelMsg(c *gin.Context) {
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
||||
func ClearMsg(c *gin.Context) {
|
||||
params := api.CleanUpMsgReq{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.NewError("0", "BindJSON failed ", err.Error())
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
//
|
||||
req := &rpc.ClearMsgReq{}
|
||||
utils.CopyStructFields(req, ¶ms)
|
||||
|
||||
var ok bool
|
||||
var errInfo string
|
||||
ok, req.OpUserID, errInfo = token_verify.GetUserIDFromToken(c.Request.Header.Get("token"), req.OperationID)
|
||||
if !ok {
|
||||
errMsg := req.OperationID + " " + "GetUserIDFromToken failed " + errInfo + " token:" + c.Request.Header.Get("token")
|
||||
log.NewError(req.OperationID, errMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg})
|
||||
return
|
||||
}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api args ", req.String())
|
||||
|
||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
||||
client := rpc.NewChatClient(etcdConn)
|
||||
RpcResp, err := client.ClearMsg(context.Background(), req)
|
||||
if err != nil {
|
||||
log.NewError(req.OperationID, " CleanUpMsg failed ", err.Error(), req.String(), RpcResp.ErrMsg)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": RpcResp.ErrMsg})
|
||||
return
|
||||
}
|
||||
|
||||
resp := api.CleanUpMsgResp{CommResp: api.CommResp{ErrCode: RpcResp.ErrCode, ErrMsg: RpcResp.ErrMsg}}
|
||||
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " api return ", resp)
|
||||
c.JSON(http.StatusOK, resp)
|
||||
}
|
||||
|
38
internal/rpc/msg/chat.go
Normal file
38
internal/rpc/msg/chat.go
Normal file
@ -0,0 +1,38 @@
|
||||
package msg
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/constant"
|
||||
"Open_IM/pkg/common/db"
|
||||
"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/common/token_verify"
|
||||
"Open_IM/pkg/proto/chat"
|
||||
"Open_IM/pkg/utils"
|
||||
"context"
|
||||
)
|
||||
|
||||
func (rpc *rpcChat) ClearMsg(_ context.Context, req *pbChat.ClearMsgReq) (*pbChat.ClearMsgResp, error) {
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc req: ", req.String())
|
||||
if req.OpUserID != req.UserID && !token_verify.IsManagerUserID(req.UserID) {
|
||||
errMsg := "No permission" + req.OpUserID + req.UserID
|
||||
log.Error(req.OperationID, errMsg)
|
||||
return &pbChat.ClearMsgResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil
|
||||
}
|
||||
log.Debug(req.OperationID, "CleanUpOneUserAllMsgFromRedis args", req.UserID)
|
||||
err := db.DB.CleanUpOneUserAllMsgFromRedis(req.UserID)
|
||||
if err != nil {
|
||||
errMsg := "CleanUpOneUserAllMsgFromRedis failed " + err.Error() + req.OperationID + req.UserID
|
||||
log.Error(req.OperationID, errMsg)
|
||||
return &pbChat.ClearMsgResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil
|
||||
}
|
||||
log.Debug(req.OperationID, "CleanUpUserMsgFromMongo args", req.UserID)
|
||||
err = db.DB.CleanUpUserMsgFromMongo(req.UserID)
|
||||
if err != nil {
|
||||
errMsg := "CleanUpUserMsgFromMongo failed " + err.Error() + req.OperationID + req.UserID
|
||||
log.Error(req.OperationID, errMsg)
|
||||
return &pbChat.ClearMsgResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: errMsg}, nil
|
||||
}
|
||||
|
||||
resp := pbChat.ClearMsgResp{ErrCode: 0}
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
||||
return &resp, nil
|
||||
}
|
@ -10,3 +10,12 @@ type DelMsgReq struct {
|
||||
type DelMsgResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
||||
type CleanUpMsgReq struct {
|
||||
UserID string `json:"userID" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
}
|
||||
|
||||
type CleanUpMsgResp struct {
|
||||
CommResp
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ func GroupIsBanPrivateChat(status int32) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
const BigVersion = "v3"
|
||||
const BigVersion = "v2"
|
||||
|
||||
const LogFileName = "OpenIM.log"
|
||||
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/gogo/protobuf/sortkeys"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
@ -1136,6 +1137,17 @@ func getSeqUid(uid string, seq uint32) string {
|
||||
seqSuffix := seq / singleGocMsgNum
|
||||
return indexGen(uid, seqSuffix)
|
||||
}
|
||||
|
||||
func getSeqUserIDList(userID string, maxSeq uint32) []string {
|
||||
seqMaxSuffix := maxSeq / singleGocMsgNum
|
||||
var seqUserIDList []string
|
||||
for i := 0; i <= int(seqMaxSuffix); i++ {
|
||||
seqUserID := indexGen(userID, uint32(i))
|
||||
seqUserIDList = append(seqUserIDList, seqUserID)
|
||||
}
|
||||
return seqUserIDList
|
||||
}
|
||||
|
||||
func getSeqSuperGroupID(groupID string, seq uint32) string {
|
||||
seqSuffix := seq / singleGocMsgNum
|
||||
return superGroupIndexGen(groupID, seqSuffix)
|
||||
@ -1180,3 +1192,23 @@ func indexGen(uid string, seqSuffix uint32) string {
|
||||
func superGroupIndexGen(groupID string, seqSuffix uint32) string {
|
||||
return "super_group_" + groupID + ":" + strconv.FormatInt(int64(seqSuffix), 10)
|
||||
}
|
||||
|
||||
func (d *DataBases) CleanUpUserMsgFromMongo(userID string) error {
|
||||
ctx := context.Background()
|
||||
c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cChat)
|
||||
maxSeq, err := d.GetUserMaxSeq(userID)
|
||||
if err == redis.Nil {
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
return utils.Wrap(err, "")
|
||||
}
|
||||
|
||||
seqUsers := getSeqUserIDList(userID, uint32(maxSeq))
|
||||
//bson.M{"id":bson.M{"$in":list}}
|
||||
_, err = c.DeleteMany(ctx, bson.M{"uid": bson.M{"$in": seqUsers}})
|
||||
if err == mongo.ErrNoDocuments {
|
||||
return nil
|
||||
}
|
||||
return utils.Wrap(err, "")
|
||||
}
|
||||
|
@ -83,3 +83,16 @@ func (d *DataBases) NewSetMessageToCache(msgList []*pbChat.MsgDataToMQ, uid stri
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *DataBases) CleanUpOneUserAllMsgFromRedis(userID string) error {
|
||||
ctx := context.Background()
|
||||
key := messageCache + userID + "_" + "*"
|
||||
vals, err := d.rdb.Keys(ctx, key).Result()
|
||||
if err != nil {
|
||||
return utils.Wrap(err, "")
|
||||
}
|
||||
if err = d.rdb.Del(ctx, vals...).Err(); err != nil {
|
||||
return utils.Wrap(err, "")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ func (m *MsgDataToMQ) Reset() { *m = MsgDataToMQ{} }
|
||||
func (m *MsgDataToMQ) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgDataToMQ) ProtoMessage() {}
|
||||
func (*MsgDataToMQ) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_chat_732204f30d7bcb33, []int{0}
|
||||
return fileDescriptor_chat_9735d58eeaab60cd, []int{0}
|
||||
}
|
||||
func (m *MsgDataToMQ) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MsgDataToMQ.Unmarshal(m, b)
|
||||
@ -90,7 +90,7 @@ func (m *MsgDataToDB) Reset() { *m = MsgDataToDB{} }
|
||||
func (m *MsgDataToDB) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgDataToDB) ProtoMessage() {}
|
||||
func (*MsgDataToDB) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_chat_732204f30d7bcb33, []int{1}
|
||||
return fileDescriptor_chat_9735d58eeaab60cd, []int{1}
|
||||
}
|
||||
func (m *MsgDataToDB) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_MsgDataToDB.Unmarshal(m, b)
|
||||
@ -137,7 +137,7 @@ func (m *PushMsgDataToMQ) Reset() { *m = PushMsgDataToMQ{} }
|
||||
func (m *PushMsgDataToMQ) String() string { return proto.CompactTextString(m) }
|
||||
func (*PushMsgDataToMQ) ProtoMessage() {}
|
||||
func (*PushMsgDataToMQ) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_chat_732204f30d7bcb33, []int{2}
|
||||
return fileDescriptor_chat_9735d58eeaab60cd, []int{2}
|
||||
}
|
||||
func (m *PushMsgDataToMQ) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_PushMsgDataToMQ.Unmarshal(m, b)
|
||||
@ -210,7 +210,7 @@ func (m *GetMaxAndMinSeqReq) Reset() { *m = GetMaxAndMinSeqReq{} }
|
||||
func (m *GetMaxAndMinSeqReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetMaxAndMinSeqReq) ProtoMessage() {}
|
||||
func (*GetMaxAndMinSeqReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_chat_732204f30d7bcb33, []int{3}
|
||||
return fileDescriptor_chat_9735d58eeaab60cd, []int{3}
|
||||
}
|
||||
func (m *GetMaxAndMinSeqReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetMaxAndMinSeqReq.Unmarshal(m, b)
|
||||
@ -258,7 +258,7 @@ func (m *GetMaxAndMinSeqResp) Reset() { *m = GetMaxAndMinSeqResp{} }
|
||||
func (m *GetMaxAndMinSeqResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*GetMaxAndMinSeqResp) ProtoMessage() {}
|
||||
func (*GetMaxAndMinSeqResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_chat_732204f30d7bcb33, []int{4}
|
||||
return fileDescriptor_chat_9735d58eeaab60cd, []int{4}
|
||||
}
|
||||
func (m *GetMaxAndMinSeqResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_GetMaxAndMinSeqResp.Unmarshal(m, b)
|
||||
@ -319,7 +319,7 @@ func (m *SendMsgReq) Reset() { *m = SendMsgReq{} }
|
||||
func (m *SendMsgReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*SendMsgReq) ProtoMessage() {}
|
||||
func (*SendMsgReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_chat_732204f30d7bcb33, []int{5}
|
||||
return fileDescriptor_chat_9735d58eeaab60cd, []int{5}
|
||||
}
|
||||
func (m *SendMsgReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SendMsgReq.Unmarshal(m, b)
|
||||
@ -375,7 +375,7 @@ func (m *SendMsgResp) Reset() { *m = SendMsgResp{} }
|
||||
func (m *SendMsgResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*SendMsgResp) ProtoMessage() {}
|
||||
func (*SendMsgResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_chat_732204f30d7bcb33, []int{6}
|
||||
return fileDescriptor_chat_9735d58eeaab60cd, []int{6}
|
||||
}
|
||||
func (m *SendMsgResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SendMsgResp.Unmarshal(m, b)
|
||||
@ -430,6 +430,106 @@ func (m *SendMsgResp) GetSendTime() int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
type ClearMsgReq struct {
|
||||
UserID string `protobuf:"bytes,1,opt,name=userID" json:"userID,omitempty"`
|
||||
OpUserID string `protobuf:"bytes,2,opt,name=opUserID" json:"opUserID,omitempty"`
|
||||
OperationID string `protobuf:"bytes,3,opt,name=operationID" json:"operationID,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ClearMsgReq) Reset() { *m = ClearMsgReq{} }
|
||||
func (m *ClearMsgReq) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClearMsgReq) ProtoMessage() {}
|
||||
func (*ClearMsgReq) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_chat_9735d58eeaab60cd, []int{7}
|
||||
}
|
||||
func (m *ClearMsgReq) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ClearMsgReq.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ClearMsgReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ClearMsgReq.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ClearMsgReq) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ClearMsgReq.Merge(dst, src)
|
||||
}
|
||||
func (m *ClearMsgReq) XXX_Size() int {
|
||||
return xxx_messageInfo_ClearMsgReq.Size(m)
|
||||
}
|
||||
func (m *ClearMsgReq) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ClearMsgReq.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ClearMsgReq proto.InternalMessageInfo
|
||||
|
||||
func (m *ClearMsgReq) GetUserID() string {
|
||||
if m != nil {
|
||||
return m.UserID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ClearMsgReq) GetOpUserID() string {
|
||||
if m != nil {
|
||||
return m.OpUserID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *ClearMsgReq) GetOperationID() string {
|
||||
if m != nil {
|
||||
return m.OperationID
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ClearMsgResp struct {
|
||||
ErrCode int32 `protobuf:"varint,1,opt,name=errCode" json:"errCode,omitempty"`
|
||||
ErrMsg string `protobuf:"bytes,2,opt,name=errMsg" json:"errMsg,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ClearMsgResp) Reset() { *m = ClearMsgResp{} }
|
||||
func (m *ClearMsgResp) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClearMsgResp) ProtoMessage() {}
|
||||
func (*ClearMsgResp) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_chat_9735d58eeaab60cd, []int{8}
|
||||
}
|
||||
func (m *ClearMsgResp) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ClearMsgResp.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ClearMsgResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ClearMsgResp.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ClearMsgResp) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ClearMsgResp.Merge(dst, src)
|
||||
}
|
||||
func (m *ClearMsgResp) XXX_Size() int {
|
||||
return xxx_messageInfo_ClearMsgResp.Size(m)
|
||||
}
|
||||
func (m *ClearMsgResp) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ClearMsgResp.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ClearMsgResp proto.InternalMessageInfo
|
||||
|
||||
func (m *ClearMsgResp) GetErrCode() int32 {
|
||||
if m != nil {
|
||||
return m.ErrCode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *ClearMsgResp) GetErrMsg() string {
|
||||
if m != nil {
|
||||
return m.ErrMsg
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MsgDataToMQ)(nil), "pbChat.MsgDataToMQ")
|
||||
proto.RegisterType((*MsgDataToDB)(nil), "pbChat.MsgDataToDB")
|
||||
@ -438,6 +538,8 @@ func init() {
|
||||
proto.RegisterType((*GetMaxAndMinSeqResp)(nil), "pbChat.GetMaxAndMinSeqResp")
|
||||
proto.RegisterType((*SendMsgReq)(nil), "pbChat.SendMsgReq")
|
||||
proto.RegisterType((*SendMsgResp)(nil), "pbChat.SendMsgResp")
|
||||
proto.RegisterType((*ClearMsgReq)(nil), "pbChat.ClearMsgReq")
|
||||
proto.RegisterType((*ClearMsgResp)(nil), "pbChat.ClearMsgResp")
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -455,6 +557,7 @@ type ChatClient interface {
|
||||
PullMessageBySeqList(ctx context.Context, in *sdk_ws.PullMessageBySeqListReq, opts ...grpc.CallOption) (*sdk_ws.PullMessageBySeqListResp, error)
|
||||
SendMsg(ctx context.Context, in *SendMsgReq, opts ...grpc.CallOption) (*SendMsgResp, error)
|
||||
DelMsgList(ctx context.Context, in *sdk_ws.DelMsgListReq, opts ...grpc.CallOption) (*sdk_ws.DelMsgListResp, error)
|
||||
ClearMsg(ctx context.Context, in *ClearMsgReq, opts ...grpc.CallOption) (*ClearMsgResp, error)
|
||||
}
|
||||
|
||||
type chatClient struct {
|
||||
@ -501,6 +604,15 @@ func (c *chatClient) DelMsgList(ctx context.Context, in *sdk_ws.DelMsgListReq, o
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatClient) ClearMsg(ctx context.Context, in *ClearMsgReq, opts ...grpc.CallOption) (*ClearMsgResp, error) {
|
||||
out := new(ClearMsgResp)
|
||||
err := grpc.Invoke(ctx, "/pbChat.Chat/ClearMsg", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for Chat service
|
||||
|
||||
type ChatServer interface {
|
||||
@ -508,6 +620,7 @@ type ChatServer interface {
|
||||
PullMessageBySeqList(context.Context, *sdk_ws.PullMessageBySeqListReq) (*sdk_ws.PullMessageBySeqListResp, error)
|
||||
SendMsg(context.Context, *SendMsgReq) (*SendMsgResp, error)
|
||||
DelMsgList(context.Context, *sdk_ws.DelMsgListReq) (*sdk_ws.DelMsgListResp, error)
|
||||
ClearMsg(context.Context, *ClearMsgReq) (*ClearMsgResp, error)
|
||||
}
|
||||
|
||||
func RegisterChatServer(s *grpc.Server, srv ChatServer) {
|
||||
@ -586,6 +699,24 @@ func _Chat_DelMsgList_Handler(srv interface{}, ctx context.Context, dec func(int
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Chat_ClearMsg_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ClearMsgReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ChatServer).ClearMsg(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/pbChat.Chat/ClearMsg",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ChatServer).ClearMsg(ctx, req.(*ClearMsgReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Chat_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "pbChat.Chat",
|
||||
HandlerType: (*ChatServer)(nil),
|
||||
@ -606,45 +737,53 @@ var _Chat_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "DelMsgList",
|
||||
Handler: _Chat_DelMsgList_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ClearMsg",
|
||||
Handler: _Chat_ClearMsg_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "chat/chat.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_732204f30d7bcb33) }
|
||||
func init() { proto.RegisterFile("chat/chat.proto", fileDescriptor_chat_9735d58eeaab60cd) }
|
||||
|
||||
var fileDescriptor_chat_732204f30d7bcb33 = []byte{
|
||||
// 508 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xdd, 0x6e, 0xda, 0x30,
|
||||
0x14, 0x56, 0x68, 0x0b, 0xe3, 0xb0, 0x0a, 0xc9, 0xad, 0xa6, 0x88, 0xab, 0x34, 0xd2, 0x26, 0xb4,
|
||||
0x49, 0x89, 0xc4, 0x76, 0xb7, 0xab, 0xd1, 0x54, 0x13, 0xd2, 0xbc, 0xb6, 0x81, 0xdd, 0xec, 0x86,
|
||||
0xb9, 0xcd, 0x51, 0x88, 0x80, 0xc4, 0xf8, 0x84, 0xd1, 0x6d, 0xcf, 0xb0, 0x67, 0xd8, 0xab, 0xed,
|
||||
0x51, 0xa6, 0xd8, 0x69, 0x09, 0x05, 0xa9, 0x5c, 0xed, 0x06, 0xe9, 0x7c, 0xfe, 0xfc, 0xfd, 0x18,
|
||||
0xc7, 0xd0, 0xbe, 0x9d, 0x88, 0xdc, 0x2f, 0x7e, 0x3c, 0xa9, 0xb2, 0x3c, 0x63, 0x75, 0x79, 0x73,
|
||||
0x3e, 0x11, 0x79, 0xe7, 0xec, 0x52, 0x62, 0x3a, 0x1e, 0x70, 0x5f, 0x4e, 0x63, 0x5f, 0x2f, 0xf9,
|
||||
0x14, 0x4d, 0xc7, 0x2b, 0xf2, 0x57, 0x64, 0xa8, 0xee, 0x2f, 0x68, 0x71, 0x8a, 0x03, 0x91, 0x8b,
|
||||
0x51, 0xc6, 0xaf, 0xd9, 0x29, 0x1c, 0xe5, 0xd9, 0x14, 0x53, 0xdb, 0x72, 0xac, 0x6e, 0x33, 0x34,
|
||||
0x03, 0x73, 0xa0, 0x95, 0x49, 0x54, 0x22, 0x4f, 0xb2, 0x74, 0x10, 0xd8, 0x35, 0xbd, 0x56, 0x85,
|
||||
0xd8, 0x3b, 0x68, 0xcc, 0x8d, 0x8c, 0x7d, 0xe0, 0x58, 0xdd, 0x56, 0xaf, 0xe3, 0x11, 0xaa, 0xef,
|
||||
0xa8, 0xc6, 0x42, 0x26, 0x63, 0x29, 0x94, 0x98, 0x93, 0x57, 0x1a, 0x85, 0xf7, 0x54, 0x17, 0x2b,
|
||||
0xe6, 0x41, 0xbf, 0x2a, 0x62, 0xed, 0x2d, 0xf2, 0x74, 0x38, 0xf7, 0xb7, 0x05, 0xed, 0xab, 0x25,
|
||||
0x4d, 0xaa, 0x45, 0x1d, 0x68, 0x5d, 0x56, 0x76, 0x99, 0xba, 0x55, 0xa8, 0x9a, 0xa6, 0xb6, 0x7f,
|
||||
0x1a, 0x17, 0x9e, 0xcb, 0x25, 0x4d, 0x46, 0xd9, 0x17, 0x42, 0x35, 0x08, 0xf4, 0x69, 0x34, 0xc3,
|
||||
0x0d, 0xcc, 0xfd, 0x0c, 0xec, 0x23, 0xe6, 0x5c, 0xdc, 0x7d, 0x48, 0x23, 0x9e, 0xa4, 0x43, 0x5c,
|
||||
0x84, 0xb8, 0x60, 0x2f, 0xa0, 0x5e, 0xee, 0x31, 0x61, 0xca, 0xe9, 0x71, 0xd2, 0xda, 0x56, 0x52,
|
||||
0x77, 0x05, 0x27, 0x5b, 0x7a, 0x24, 0x99, 0x0d, 0x8d, 0x0b, 0xa5, 0xce, 0xb3, 0x08, 0xb5, 0xe2,
|
||||
0x51, 0x78, 0x3f, 0x16, 0x56, 0x17, 0x4a, 0x71, 0x8a, 0x4b, 0xb5, 0x72, 0x2a, 0x70, 0x2e, 0xee,
|
||||
0x86, 0xb8, 0xd0, 0xb1, 0x8f, 0xc3, 0x72, 0xd2, 0xb8, 0xd6, 0xb5, 0x0f, 0x4b, 0x5c, 0x4f, 0xee,
|
||||
0x4f, 0x80, 0x21, 0xa6, 0x11, 0xa7, 0xb8, 0x28, 0xf0, 0x7f, 0xef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 0x13, 0x05, 0x00, 0x00,
|
||||
var fileDescriptor_chat_9735d58eeaab60cd = []byte{
|
||||
// 563 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xc1, 0x6e, 0xda, 0x40,
|
||||
0x10, 0x95, 0x43, 0x42, 0x92, 0x71, 0x22, 0xa4, 0x4d, 0x14, 0x59, 0x3e, 0x39, 0x96, 0x5a, 0xa1,
|
||||
0x56, 0x32, 0x12, 0x6d, 0x4f, 0xbd, 0xb4, 0xe0, 0xa8, 0x42, 0xaa, 0x9b, 0xc4, 0xd0, 0x4b, 0x2f,
|
||||
0x74, 0x03, 0x23, 0x63, 0x01, 0xf6, 0xe2, 0x31, 0x25, 0x6d, 0xbf, 0xa1, 0xe7, 0x1e, 0xfb, 0xab,
|
||||
0x95, 0x77, 0x0d, 0x18, 0x8c, 0x14, 0xd4, 0x43, 0x2f, 0x96, 0xde, 0xdb, 0xf1, 0x7b, 0x6f, 0x76,
|
||||
0x47, 0x03, 0xb5, 0xc1, 0x88, 0xa7, 0x8d, 0xec, 0xe3, 0x88, 0x24, 0x4e, 0x63, 0x56, 0x15, 0x0f,
|
||||
0xed, 0x11, 0x4f, 0xcd, 0xeb, 0x5b, 0x81, 0x51, 0xbf, 0xe3, 0x35, 0xc4, 0x38, 0x68, 0xc8, 0xa3,
|
||||
0x06, 0x0d, 0xc7, 0xfd, 0x05, 0x35, 0x16, 0xa4, 0x4a, 0xed, 0x9f, 0xa0, 0x7b, 0x14, 0xb8, 0x3c,
|
||||
0xe5, 0xbd, 0xd8, 0xbb, 0x67, 0x97, 0x70, 0x94, 0xc6, 0x63, 0x8c, 0x0c, 0xcd, 0xd2, 0xea, 0xa7,
|
||||
0xbe, 0x02, 0xcc, 0x02, 0x3d, 0x16, 0x98, 0xf0, 0x34, 0x8c, 0xa3, 0x8e, 0x6b, 0x1c, 0xc8, 0xb3,
|
||||
0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 0xfc, 0xd1,
|
||||
0x40, 0x5f, 0x99, 0xab, 0x6e, 0x71, 0xb3, 0x5b, 0x5c, 0x77, 0x8b, 0x1b, 0xdd, 0x2a, 0x94, 0x25,
|
||||
0x53, 0x3e, 0x1e, 0x05, 0x1d, 0x57, 0xb6, 0x76, 0xea, 0x17, 0xa9, 0xac, 0x62, 0x30, 0x09, 0x31,
|
||||
0x4a, 0x55, 0xc5, 0x91, 0xaa, 0x28, 0x50, 0xcc, 0x84, 0x13, 0xc2, 0x68, 0xd8, 0x0b, 0xa7, 0x68,
|
||||
0x54, 0x2d, 0xad, 0x5e, 0xf1, 0x57, 0xd8, 0x1e, 0x80, 0xde, 0x9e, 0x20, 0x4f, 0xf2, 0xeb, 0xb9,
|
||||
0x82, 0xea, 0x7c, 0xe3, 0x7d, 0x15, 0xca, 0x24, 0x62, 0x91, 0xbf, 0xbc, 0x0a, 0xb8, 0xc2, 0xdb,
|
||||
0x97, 0x57, 0x29, 0xcf, 0xf6, 0x3b, 0x38, 0x5b, 0x9b, 0xfc, 0xcb, 0x35, 0x34, 0x7f, 0x57, 0xe0,
|
||||
0x30, 0xdb, 0x16, 0xec, 0x2b, 0xd4, 0xb6, 0xc6, 0x88, 0x3d, 0xdb, 0xf1, 0x12, 0xe5, 0xd1, 0x35,
|
||||
0x9f, 0xef, 0x53, 0x46, 0x82, 0xc5, 0x70, 0x79, 0x37, 0x9f, 0x4c, 0x3c, 0x24, 0xe2, 0x01, 0xb6,
|
||||
0xbe, 0x77, 0x71, 0xf6, 0x31, 0xa4, 0x94, 0xbd, 0xd8, 0xf1, 0xff, 0xae, 0xc2, 0xcc, 0xeb, 0xe5,
|
||||
0xde, 0xb5, 0x24, 0x58, 0x13, 0x8e, 0xf3, 0x19, 0x61, 0xcc, 0x51, 0x4b, 0xd1, 0x59, 0x4f, 0xac,
|
||||
0x79, 0x51, 0xe2, 0x48, 0xb0, 0x7b, 0x00, 0x17, 0x27, 0x1e, 0x05, 0x32, 0x9a, 0xb5, 0xc3, 0x6e,
|
||||
0x7d, 0x9c, 0x89, 0x5c, 0x3f, 0x51, 0x41, 0x82, 0xbd, 0x81, 0x93, 0xe5, 0x23, 0xb1, 0x95, 0x67,
|
||||
0x61, 0x36, 0xcc, 0xcb, 0x32, 0x49, 0xa2, 0x55, 0xfb, 0x72, 0xee, 0xc8, 0xb5, 0xfe, 0x56, 0x9d,
|
||||
0x3e, 0x54, 0xe5, 0xce, 0x7e, 0xf5, 0x37, 0x00, 0x00, 0xff, 0xff, 0xee, 0x03, 0xc5, 0x33, 0xf1,
|
||||
0x05, 0x00, 0x00,
|
||||
}
|
||||
|
@ -69,14 +69,25 @@ message SendMsgResp {
|
||||
string serverMsgID = 4;
|
||||
string clientMsgID = 5;
|
||||
int64 sendTime = 6;
|
||||
|
||||
}
|
||||
|
||||
|
||||
message ClearMsgReq{
|
||||
string userID = 1;
|
||||
string opUserID = 2;
|
||||
string operationID = 3;
|
||||
}
|
||||
|
||||
|
||||
message ClearMsgResp{
|
||||
int32 errCode = 1;
|
||||
string errMsg = 2;
|
||||
}
|
||||
|
||||
service Chat {
|
||||
rpc GetMaxAndMinSeq(server_api_params.GetMaxAndMinSeqReq) returns(server_api_params.GetMaxAndMinSeqResp);
|
||||
rpc PullMessageBySeqList(server_api_params.PullMessageBySeqListReq) returns(server_api_params.PullMessageBySeqListResp);
|
||||
rpc SendMsg(SendMsgReq) returns(SendMsgResp);
|
||||
rpc DelMsgList(server_api_params.DelMsgListReq) returns(server_api_params.DelMsgListResp);
|
||||
rpc ClearMsg(ClearMsgReq) returns(ClearMsgResp);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user