diff --git a/internal/rpc/msg/delete.go b/internal/rpc/msg/delete.go index 954126134..ee2c15d96 100644 --- a/internal/rpc/msg/delete.go +++ b/internal/rpc/msg/delete.go @@ -12,7 +12,7 @@ import ( "time" ) -func (rpc *rpcChat) DelMsgList(_ context.Context, req *common.DelMsgListReq) (*common.DelMsgListResp, error) { +func (rpc *msgServer) DelMsgList(_ context.Context, req *common.DelMsgListReq) (*common.DelMsgListResp, error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) resp := &common.DelMsgListResp{} select { @@ -30,7 +30,7 @@ func (rpc *rpcChat) DelMsgList(_ context.Context, req *common.DelMsgListReq) (*c log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil } -func (rpc *rpcChat) DelSuperGroupMsg(ctx context.Context, req *msg.DelSuperGroupMsgReq) (*msg.DelSuperGroupMsgResp, error) { +func (rpc *msgServer) DelSuperGroupMsg(ctx context.Context, req *msg.DelSuperGroupMsgReq) (*msg.DelSuperGroupMsgResp, error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) if !tokenverify.CheckAccess(ctx, req.OpUserID, req.UserID) { log.NewError(req.OperationID, "CheckAccess false ", req.OpUserID, req.UserID) @@ -55,7 +55,7 @@ func (rpc *rpcChat) DelSuperGroupMsg(ctx context.Context, req *msg.DelSuperGroup return resp, nil } -func (rpc *rpcChat) ClearMsg(_ context.Context, req *pbChat.ClearMsgReq) (*pbChat.ClearMsgResp, error) { +func (rpc *msgServer) ClearMsg(_ context.Context, req *pbChat.ClearMsgReq) (*pbChat.ClearMsgResp, error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc req: ", req.String()) if req.OpUserID != req.UserID && !tokenverify.IsManagerUserID(req.UserID) { errMsg := "No permission" + req.OpUserID + req.UserID diff --git a/internal/rpc/msg/extend_msg.go b/internal/rpc/msg/extend_msg.go index 043ff67b7..fa4af83b2 100644 --- a/internal/rpc/msg/extend_msg.go +++ b/internal/rpc/msg/extend_msg.go @@ -14,7 +14,7 @@ import ( "time" ) -func (rpc *rpcChat) SetMessageReactionExtensions(ctx context.Context, req *msg.SetMessageReactionExtensionsReq) (resp *msg.SetMessageReactionExtensionsResp, err error) { +func (rpc *msgServer) SetMessageReactionExtensions(ctx context.Context, req *msg.SetMessageReactionExtensionsReq) (resp *msg.SetMessageReactionExtensionsResp, err error) { log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc args is:", req.String()) var rResp msg.SetMessageReactionExtensionsResp rResp.ClientMsgID = req.ClientMsgID @@ -216,7 +216,7 @@ func setDeleteKeyResultInfo(r *msg.DeleteMessageListReactionExtensionsResp, errC _ = db.DB.UnLockMessageTypeKey(clientMsgID, typeKey) } -func (rpc *rpcChat) GetMessageListReactionExtensions(ctx context.Context, req *msg.GetMessageListReactionExtensionsReq) (resp *msg.GetMessageListReactionExtensionsResp, err error) { +func (rpc *msgServer) GetMessageListReactionExtensions(ctx context.Context, req *msg.GetMessageListReactionExtensionsReq) (resp *msg.GetMessageListReactionExtensionsResp, err error) { log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc args is:", req.String()) var rResp msg.GetMessageListReactionExtensionsResp for _, messageValue := range req.MessageReactionKeyList { @@ -272,11 +272,11 @@ func (rpc *rpcChat) GetMessageListReactionExtensions(ctx context.Context, req *m } -func (rpc *rpcChat) AddMessageReactionExtensions(ctx context.Context, req *msg.ModifyMessageReactionExtensionsReq) (resp *msg.ModifyMessageReactionExtensionsResp, err error) { +func (rpc *msgServer) AddMessageReactionExtensions(ctx context.Context, req *msg.ModifyMessageReactionExtensionsReq) (resp *msg.ModifyMessageReactionExtensionsResp, err error) { return } -func (rpc *rpcChat) DeleteMessageReactionExtensions(ctx context.Context, req *msg.DeleteMessageListReactionExtensionsReq) (resp *msg.DeleteMessageListReactionExtensionsResp, err error) { +func (rpc *msgServer) DeleteMessageReactionExtensions(ctx context.Context, req *msg.DeleteMessageListReactionExtensionsReq) (resp *msg.DeleteMessageListReactionExtensionsResp, err error) { log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc args is:", req.String()) var rResp msg.DeleteMessageListReactionExtensionsResp callbackResp := notification.callbackDeleteMessageReactionExtensions(req) diff --git a/internal/rpc/msg/msg_status.go b/internal/rpc/msg/msg_status.go index 698e98a3d..6a38def31 100644 --- a/internal/rpc/msg/msg_status.go +++ b/internal/rpc/msg/msg_status.go @@ -11,7 +11,7 @@ import ( goRedis "github.com/go-redis/redis/v8" ) -func (rpc *rpcChat) SetSendMsgStatus(_ context.Context, req *pbMsg.SetSendMsgStatusReq) (resp *pbMsg.SetSendMsgStatusResp, err error) { +func (rpc *msgServer) SetSendMsgStatus(_ context.Context, req *pbMsg.SetSendMsgStatusReq) (resp *pbMsg.SetSendMsgStatusResp, err error) { resp = &pbMsg.SetSendMsgStatusResp{} log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req.String()) if err := db.DB.SetSendMsgStatus(req.Status, req.OperationID); err != nil { @@ -24,7 +24,7 @@ func (rpc *rpcChat) SetSendMsgStatus(_ context.Context, req *pbMsg.SetSendMsgSta return resp, nil } -func (rpc *rpcChat) GetSendMsgStatus(_ context.Context, req *pbMsg.GetSendMsgStatusReq) (resp *pbMsg.GetSendMsgStatusResp, err error) { +func (rpc *msgServer) GetSendMsgStatus(_ context.Context, req *pbMsg.GetSendMsgStatusReq) (resp *pbMsg.GetSendMsgStatusResp, err error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req.String()) resp = &pbMsg.GetSendMsgStatusResp{} status, err := db.DB.GetSendMsgStatus(req.OperationID) diff --git a/internal/rpc/msg/query_msg.go b/internal/rpc/msg/query_msg.go index 1bdc98fac..e0f763f92 100644 --- a/internal/rpc/msg/query_msg.go +++ b/internal/rpc/msg/query_msg.go @@ -10,7 +10,7 @@ import ( go_redis "github.com/go-redis/redis/v8" ) -func (rpc *rpcChat) GetSuperGroupMsg(context context.Context, req *msg.GetSuperGroupMsgReq) (*msg.GetSuperGroupMsgResp, error) { +func (rpc *msgServer) GetSuperGroupMsg(context context.Context, req *msg.GetSuperGroupMsgReq) (*msg.GetSuperGroupMsgResp, error) { log.Debug(req.OperationID, utils.GetSelfFuncName(), req.String()) resp := new(msg.GetSuperGroupMsgResp) redisMsgList, failedSeqList, err := commonDB.DB.GetMessageListBySeq(req.GroupID, []uint32{req.Seq}, req.OperationID) diff --git a/internal/rpc/msg/send_msg.go b/internal/rpc/msg/send_msg.go index 6da381df9..380f91d7f 100644 --- a/internal/rpc/msg/send_msg.go +++ b/internal/rpc/msg/send_msg.go @@ -107,7 +107,7 @@ func groupIsMuted(ctx context.Context, groupID string) (bool, error) { return false, nil } -func (rpc *rpcChat) messageVerification(ctx context.Context, data *pbChat.SendMsgReq) (bool, int32, string, []string) { +func (rpc *msgServer) messageVerification(ctx context.Context, data *pbChat.SendMsgReq) (bool, int32, string, []string) { switch data.MsgData.SessionType { case constant.SingleChatType: if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) { @@ -282,7 +282,7 @@ func (rpc *rpcChat) messageVerification(ctx context.Context, data *pbChat.SendMs } } -func (rpc *rpcChat) encapsulateMsgData(msg *sdkws.MsgData) { +func (rpc *msgServer) encapsulateMsgData(msg *sdkws.MsgData) { msg.ServerMsgID = GetMsgID(msg.SendID) msg.SendTime = utils.GetCurrentTimestampByMill() switch msg.ContentType { @@ -331,7 +331,7 @@ func (rpc *rpcChat) encapsulateMsgData(msg *sdkws.MsgData) { } } -func (rpc *rpcChat) sendMsgToWriter(ctx context.Context, m *pbChat.MsgDataToMQ, key string, status string) error { +func (rpc *msgServer) sendMsgToWriter(ctx context.Context, m *pbChat.MsgDataToMQ, key string, status string) error { switch status { case constant.OnlineStatus: if m.MsgData.ContentType == constant.SignalingNotification { @@ -502,7 +502,7 @@ func valueCopy(pb *pbChat.SendMsgReq) *pbChat.SendMsgReq { return &pbChat.SendMsgReq{Token: pb.Token, OperationID: pb.OperationID, MsgData: &msgData} } -func (rpc *rpcChat) sendMsgToGroup(ctx context.Context, list []string, pb pbChat.SendMsgReq, status string, sendTag *bool, wg *sync.WaitGroup) { +func (rpc *msgServer) sendMsgToGroup(ctx context.Context, list []string, pb pbChat.SendMsgReq, status string, sendTag *bool, wg *sync.WaitGroup) { // log.Debug(pb.OperationID, "split userID ", list) offlinePushInfo := sdkws.OfflinePushInfo{} if pb.MsgData.OfflinePushInfo != nil { @@ -538,7 +538,7 @@ func (rpc *rpcChat) sendMsgToGroup(ctx context.Context, list []string, pb pbChat wg.Done() } -func (rpc *rpcChat) sendMsgToGroupOptimization(ctx context.Context, list []string, groupPB *pbChat.SendMsgReq, status string, sendTag *bool, wg *sync.WaitGroup) { +func (rpc *msgServer) sendMsgToGroupOptimization(ctx context.Context, list []string, groupPB *pbChat.SendMsgReq, status string, sendTag *bool, wg *sync.WaitGroup) { msgToMQGroup := pbChat.MsgDataToMQ{Token: groupPB.Token, OperationID: groupPB.OperationID, MsgData: groupPB.MsgData} tempOptions := make(map[string]bool, 1) for k, v := range groupPB.MsgData.Options { diff --git a/internal/rpc/msg/send_pull.go b/internal/rpc/msg/send_pull.go index 04159886a..77b204f7f 100644 --- a/internal/rpc/msg/send_pull.go +++ b/internal/rpc/msg/send_pull.go @@ -21,7 +21,7 @@ func (m *msgServer) SendMsg(ctx context.Context, pb *pbChat.SendMsgReq) (*pbChat return returnMsg(&replay, pb, errCode, errMsg, "", 0) } t1 := time.Now() - rpc.encapsulateMsgData(pb.MsgData) + m.encapsulateMsgData(pb.MsgData) log.Debug(pb.OperationID, "encapsulateMsgData ", " cost time: ", time.Since(t1)) msgToMQSingle := pbChat.MsgDataToMQ{Token: pb.Token, OperationID: pb.OperationID, MsgData: pb.MsgData} // callback diff --git a/internal/rpc/msg/server.go b/internal/rpc/msg/server.go index 659a70a3a..ea2187127 100644 --- a/internal/rpc/msg/server.go +++ b/internal/rpc/msg/server.go @@ -32,9 +32,9 @@ type deleteMsg struct { OperationID string } -func NewRpcChatServer(port int) *rpcChat { +func NewRpcChatServer(port int) *msgServer { log.NewPrivateLog(constant.LogFileName) - rc := rpcChat{ + rc := msgServer{ rpcPort: port, rpcRegisterName: config.Config.RpcRegisterName.OpenImMsgName, etcdSchema: config.Config.Etcd.EtcdSchema, @@ -73,7 +73,7 @@ func (rpc *rpcChat) initPrometheus() { promePkg.NewWorkSuperGroupChatMsgProcessFailedCounter() } -func (rpc *rpcChat) Run() { +func (rpc *msgServer) Run() { log.Info("", "rpcChat init...") listenIP := "" if config.Config.ListenIP == "" {