diff --git a/internal/api/auth/auth.go b/internal/api/auth/auth.go index cec540537..73a071548 100644 --- a/internal/api/auth/auth.go +++ b/internal/api/auth/auth.go @@ -3,6 +3,7 @@ package apiAuth import ( api "Open_IM/pkg/base_info" "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" @@ -66,7 +67,13 @@ func UserRegister(c *gin.Context) { if reply.CommonResp.ErrCode != 0 { errMsg := req.OperationID + " " + " UserRegister failed " + reply.CommonResp.ErrMsg + req.String() log.NewError(req.OperationID, errMsg) - c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) + if reply.CommonResp.ErrCode == constant.RegisterLimit { + c.JSON(http.StatusOK, gin.H{"errCode": constant.RegisterLimit, "errMsg": "用户注册被限制"}) + } else if reply.CommonResp.ErrCode == constant.InvitationError { + c.JSON(http.StatusOK, gin.H{"errCode": constant.InvitationError, "errMsg": "邀请码错误"}) + } else { + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": errMsg}) + } return } diff --git a/internal/msg_transfer/logic/persistent_msg_handler.go b/internal/msg_transfer/logic/persistent_msg_handler.go index c02c02739..817b3edb9 100644 --- a/internal/msg_transfer/logic/persistent_msg_handler.go +++ b/internal/msg_transfer/logic/persistent_msg_handler.go @@ -42,6 +42,7 @@ func (pc *PersistentConsumerHandler) Init() { Name: "insert_mysql_msg_total", Help: "The total number of msg insert mysql events", }) + prometheus.MustRegister(msgInsertMysqlProcessed) } }