diff --git a/internal/api/chat/get_max_min_seq.go b/internal/api/chat/get_max_min_seq.go index 7103cae4a..984497c18 100644 --- a/internal/api/chat/get_max_min_seq.go +++ b/internal/api/chat/get_max_min_seq.go @@ -42,7 +42,8 @@ func UserGetSeq(c *gin.Context) { msgClient := pbMsg.NewChatClient(grpcConn) reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData) if err != nil { - log.ErrorByKv("rpc call failed to getNewSeq", pbData.OperationID, "err", err, "pbData", pbData.String()) + log.NewError(params.OperationID, "UserGetSeq rpc failed, ", params, err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserGetSeq rpc failed, " + err.Error()}) return } diff --git a/internal/api/chat/pull_msg.go b/internal/api/chat/pull_msg.go index 46b568284..c0fa578e9 100644 --- a/internal/api/chat/pull_msg.go +++ b/internal/api/chat/pull_msg.go @@ -43,7 +43,8 @@ func UserPullMsg(c *gin.Context) { msgClient := pbChat.NewChatClient(grpcConn) reply, err := msgClient.PullMessage(context.Background(), &pbData) if err != nil { - log.ErrorByKv("PullMessage error", pbData.OperationID, "err", err.Error()) + log.NewError(params.OperationID, "UserPullMsg rpc failed, ", params, err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserPullMsg rpc failed, " + err.Error()}) return } log.InfoByKv("rpc call success to pullMsgRep", pbData.OperationID, "ReplyArgs", reply.String(), "maxSeq", reply.GetMaxSeq(), diff --git a/internal/api/chat/send_msg.go b/internal/api/chat/send_msg.go index 6d7294109..4d53bf769 100644 --- a/internal/api/chat/send_msg.go +++ b/internal/api/chat/send_msg.go @@ -77,7 +77,12 @@ func UserSendMsg(c *gin.Context) { log.Info("", "", "api UserSendMsg call, api call rpc...") - reply, _ := client.UserSendMsg(context.Background(), pbData) + reply, err := client.UserSendMsg(context.Background(), pbData) + if err != nil { + log.NewError(params.OperationID, "UserSendMsg rpc failed, ", params, err.Error()) + c.JSON(http.StatusBadRequest, gin.H{"errCode": 401, "errMsg": "UserSendMsg rpc failed, " + err.Error()}) + return + } log.Info("", "", "api UserSendMsg call end..., [data: %s] [reply: %s]", pbData.String(), reply.String()) c.JSON(http.StatusOK, gin.H{ diff --git a/internal/rpc/chat/send_msg.go b/internal/rpc/chat/send_msg.go index b0e8f663a..42d83e1a7 100644 --- a/internal/rpc/chat/send_msg.go +++ b/internal/rpc/chat/send_msg.go @@ -224,7 +224,7 @@ func modifyMessageByUserMessageReceiveOpt(userID, sourceID string, sessionType i case constant.NotReceiveMessage: return false case constant.ReceiveNotNotifyMessage: - m := utils.JsonStringToMap(msg.OfflineInfo) + m := utils.JsonStringToMap(msg.Options) utils.SetSwitchFromOptions(m, "offlinePush", 0) s := utils.MapToJsonString(m) msg.OfflineInfo = s