mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-26 03:26:57 +08:00
Error code standardization
This commit is contained in:
parent
ec7f44358c
commit
217d6380f7
@ -12,7 +12,7 @@ import (
|
|||||||
"time"
|
"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())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
||||||
resp := &common.DelMsgListResp{}
|
resp := &common.DelMsgListResp{}
|
||||||
select {
|
select {
|
||||||
@ -30,7 +30,7 @@ func (rpc *rpcChat) DelMsgList(_ context.Context, req *common.DelMsgListReq) (*c
|
|||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
||||||
return resp, nil
|
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())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String())
|
||||||
if !tokenverify.CheckAccess(ctx, req.OpUserID, req.UserID) {
|
if !tokenverify.CheckAccess(ctx, req.OpUserID, req.UserID) {
|
||||||
log.NewError(req.OperationID, "CheckAccess false ", 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
|
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())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc req: ", req.String())
|
||||||
if req.OpUserID != req.UserID && !tokenverify.IsManagerUserID(req.UserID) {
|
if req.OpUserID != req.UserID && !tokenverify.IsManagerUserID(req.UserID) {
|
||||||
errMsg := "No permission" + req.OpUserID + req.UserID
|
errMsg := "No permission" + req.OpUserID + req.UserID
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
"time"
|
"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())
|
log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc args is:", req.String())
|
||||||
var rResp msg.SetMessageReactionExtensionsResp
|
var rResp msg.SetMessageReactionExtensionsResp
|
||||||
rResp.ClientMsgID = req.ClientMsgID
|
rResp.ClientMsgID = req.ClientMsgID
|
||||||
@ -216,7 +216,7 @@ func setDeleteKeyResultInfo(r *msg.DeleteMessageListReactionExtensionsResp, errC
|
|||||||
_ = db.DB.UnLockMessageTypeKey(clientMsgID, typeKey)
|
_ = 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())
|
log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc args is:", req.String())
|
||||||
var rResp msg.GetMessageListReactionExtensionsResp
|
var rResp msg.GetMessageListReactionExtensionsResp
|
||||||
for _, messageValue := range req.MessageReactionKeyList {
|
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
|
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())
|
log.Debug(req.OperationID, utils.GetSelfFuncName(), "rpc args is:", req.String())
|
||||||
var rResp msg.DeleteMessageListReactionExtensionsResp
|
var rResp msg.DeleteMessageListReactionExtensionsResp
|
||||||
callbackResp := notification.callbackDeleteMessageReactionExtensions(req)
|
callbackResp := notification.callbackDeleteMessageReactionExtensions(req)
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
goRedis "github.com/go-redis/redis/v8"
|
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{}
|
resp = &pbMsg.SetSendMsgStatusResp{}
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req.String())
|
||||||
if err := db.DB.SetSendMsgStatus(req.Status, req.OperationID); err != nil {
|
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
|
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())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), req.String())
|
||||||
resp = &pbMsg.GetSendMsgStatusResp{}
|
resp = &pbMsg.GetSendMsgStatusResp{}
|
||||||
status, err := db.DB.GetSendMsgStatus(req.OperationID)
|
status, err := db.DB.GetSendMsgStatus(req.OperationID)
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
go_redis "github.com/go-redis/redis/v8"
|
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())
|
log.Debug(req.OperationID, utils.GetSelfFuncName(), req.String())
|
||||||
resp := new(msg.GetSuperGroupMsgResp)
|
resp := new(msg.GetSuperGroupMsgResp)
|
||||||
redisMsgList, failedSeqList, err := commonDB.DB.GetMessageListBySeq(req.GroupID, []uint32{req.Seq}, req.OperationID)
|
redisMsgList, failedSeqList, err := commonDB.DB.GetMessageListBySeq(req.GroupID, []uint32{req.Seq}, req.OperationID)
|
||||||
|
@ -107,7 +107,7 @@ func groupIsMuted(ctx context.Context, groupID string) (bool, error) {
|
|||||||
return false, nil
|
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 {
|
switch data.MsgData.SessionType {
|
||||||
case constant.SingleChatType:
|
case constant.SingleChatType:
|
||||||
if utils.IsContain(data.MsgData.SendID, config.Config.Manager.AppManagerUid) {
|
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.ServerMsgID = GetMsgID(msg.SendID)
|
||||||
msg.SendTime = utils.GetCurrentTimestampByMill()
|
msg.SendTime = utils.GetCurrentTimestampByMill()
|
||||||
switch msg.ContentType {
|
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 {
|
switch status {
|
||||||
case constant.OnlineStatus:
|
case constant.OnlineStatus:
|
||||||
if m.MsgData.ContentType == constant.SignalingNotification {
|
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}
|
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)
|
// log.Debug(pb.OperationID, "split userID ", list)
|
||||||
offlinePushInfo := sdkws.OfflinePushInfo{}
|
offlinePushInfo := sdkws.OfflinePushInfo{}
|
||||||
if pb.MsgData.OfflinePushInfo != nil {
|
if pb.MsgData.OfflinePushInfo != nil {
|
||||||
@ -538,7 +538,7 @@ func (rpc *rpcChat) sendMsgToGroup(ctx context.Context, list []string, pb pbChat
|
|||||||
wg.Done()
|
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}
|
msgToMQGroup := pbChat.MsgDataToMQ{Token: groupPB.Token, OperationID: groupPB.OperationID, MsgData: groupPB.MsgData}
|
||||||
tempOptions := make(map[string]bool, 1)
|
tempOptions := make(map[string]bool, 1)
|
||||||
for k, v := range groupPB.MsgData.Options {
|
for k, v := range groupPB.MsgData.Options {
|
||||||
|
@ -21,7 +21,7 @@ func (m *msgServer) SendMsg(ctx context.Context, pb *pbChat.SendMsgReq) (*pbChat
|
|||||||
return returnMsg(&replay, pb, errCode, errMsg, "", 0)
|
return returnMsg(&replay, pb, errCode, errMsg, "", 0)
|
||||||
}
|
}
|
||||||
t1 := time.Now()
|
t1 := time.Now()
|
||||||
rpc.encapsulateMsgData(pb.MsgData)
|
m.encapsulateMsgData(pb.MsgData)
|
||||||
log.Debug(pb.OperationID, "encapsulateMsgData ", " cost time: ", time.Since(t1))
|
log.Debug(pb.OperationID, "encapsulateMsgData ", " cost time: ", time.Since(t1))
|
||||||
msgToMQSingle := pbChat.MsgDataToMQ{Token: pb.Token, OperationID: pb.OperationID, MsgData: pb.MsgData}
|
msgToMQSingle := pbChat.MsgDataToMQ{Token: pb.Token, OperationID: pb.OperationID, MsgData: pb.MsgData}
|
||||||
// callback
|
// callback
|
||||||
|
@ -32,9 +32,9 @@ type deleteMsg struct {
|
|||||||
OperationID string
|
OperationID string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRpcChatServer(port int) *rpcChat {
|
func NewRpcChatServer(port int) *msgServer {
|
||||||
log.NewPrivateLog(constant.LogFileName)
|
log.NewPrivateLog(constant.LogFileName)
|
||||||
rc := rpcChat{
|
rc := msgServer{
|
||||||
rpcPort: port,
|
rpcPort: port,
|
||||||
rpcRegisterName: config.Config.RpcRegisterName.OpenImMsgName,
|
rpcRegisterName: config.Config.RpcRegisterName.OpenImMsgName,
|
||||||
etcdSchema: config.Config.Etcd.EtcdSchema,
|
etcdSchema: config.Config.Etcd.EtcdSchema,
|
||||||
@ -73,7 +73,7 @@ func (rpc *rpcChat) initPrometheus() {
|
|||||||
promePkg.NewWorkSuperGroupChatMsgProcessFailedCounter()
|
promePkg.NewWorkSuperGroupChatMsgProcessFailedCounter()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rpc *rpcChat) Run() {
|
func (rpc *msgServer) Run() {
|
||||||
log.Info("", "rpcChat init...")
|
log.Info("", "rpcChat init...")
|
||||||
listenIP := ""
|
listenIP := ""
|
||||||
if config.Config.ListenIP == "" {
|
if config.Config.ListenIP == "" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user