pull/232/head
Gordon 3 years ago
parent c49b5f78bf
commit 9303096430

@ -1 +1 @@
Subproject commit 588c9bb77b9bd89a9261964006568b8655233cb6
Subproject commit 856ac29b7c59a722c339a37d509035d94db8451f

@ -35,10 +35,6 @@ func GetSeq(c *gin.Context) {
pbData.UserID = params.SendID
pbData.OperationID = params.OperationID
grpcConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
if grpcConn == nil {
log.ErrorByKv("get grpcConn err", pbData.OperationID, "args", params)
}
msgClient := pbMsg.NewChatClient(grpcConn)
reply, err := msgClient.GetMaxAndMinSeq(context.Background(), &pbData)
if err != nil {

@ -55,10 +55,10 @@ func PullMsgBySeqList(c *gin.Context) {
msgClient := pbChat.NewChatClient(grpcConn)
reply, err := msgClient.PullMessageBySeqList(context.Background(), &pbData)
if err != nil {
log.ErrorByKv("PullMessageBySeqList error", pbData.OperationID, "err", err.Error())
log.Error(pbData.OperationID, "PullMessageBySeqList error", err.Error())
return
}
log.InfoByKv("rpc call success to PullMessageBySeqList", pbData.OperationID, "ReplyArgs", reply.String(), len(reply.List))
log.NewInfo(pbData.OperationID, "rpc call success to PullMessageBySeqList", reply.String(), len(reply.List))
c.JSON(http.StatusOK, gin.H{
"errCode": reply.ErrCode,
"errMsg": reply.ErrMsg,

@ -63,13 +63,12 @@ func SendMsg(c *gin.Context) {
if err := c.BindJSON(&params); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
log.ErrorByKv("json unmarshal err", "", "err", err.Error(), "data", c.PostForm("data"))
log.Error("0", "BindJSON failed ", err.Error())
return
}
token := c.Request.Header.Get("token")
log.InfoByKv("api call success to sendMsgReq", params.OperationID, "Parameters", params)
log.NewInfo(params.OperationID, "api call success to sendMsgReq", params)
pbData := newUserSendMsgReq(token, &params)
log.Info("", "", "api SendMsg call start..., [data: %s]", pbData.String())

@ -166,7 +166,7 @@ func ManagementSendMsg(c *gin.Context) {
}
}
log.InfoByKv("Ws call success to ManagementSendMsgReq", params.OperationID, "Parameters", params)
log.NewInfo(params.OperationID, "Ws call success to ManagementSendMsgReq", params)
pbData := newUserSendMsgReq(&params)
log.Info("", "", "api ManagementSendMsg call start..., [data: %s]", pbData.String())

@ -35,14 +35,14 @@ func Verify(c *gin.Context) {
}
if params.VerificationCode == config.Config.Demo.SuperCode {
log.InfoByKv("Super Code Verified successfully", account)
log.NewInfo(params.OperationID, "Super Code Verified successfully", account)
data := make(map[string]interface{})
data["account"] = account
data["verificationCode"] = params.VerificationCode
c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "Verified successfully!", "data": data})
return
}
log.NewInfo("0", " params.VerificationCode != config.Config.Demo.SuperCode", params.VerificationCode, config.Config.Demo)
log.NewInfo(params.OperationID, " params.VerificationCode != config.Config.Demo.SuperCode", params.VerificationCode, config.Config.Demo)
log.NewInfo(params.OperationID, "begin get form redis", account)
if params.UsedFor == 0 {
params.UsedFor = constant.VerificationCodeForRegister

@ -80,7 +80,7 @@ func (ws *WServer) getSeqReq(conn *UserConn, m *Req) {
nReply.ErrMsg = err.Error()
ws.getSeqResp(conn, m, nReply)
} else {
log.InfoByKv("rpc call success to getSeqReq", rpcReq.OperationID, "replyData", rpcReply.String())
log.NewInfo(rpcReq.OperationID, "rpc call success to getSeqReq", rpcReply.String())
ws.getSeqResp(conn, m, rpcReply)
}
}

@ -43,8 +43,7 @@ func (r *RPCServer) run() {
address := listenIP + ":" + strconv.Itoa(r.rpcPort)
listener, err := net.Listen("tcp", address)
if err != nil {
log.Error("", "fail to listening consumer failed ", err.Error(), address)
return
panic("listening err:" + err.Error() + r.rpcRegisterName)
}
defer listener.Close()
srv := grpc.NewServer()

@ -111,7 +111,7 @@ func (HistoryConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { ret
func (mc *HistoryConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
claim sarama.ConsumerGroupClaim) error {
for msg := range claim.Messages() {
log.InfoByKv("kafka get info to mongo", "", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
log.NewDebug("", "kafka get info to mongo", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
mc.msgHandle[msg.Topic](msg.Value, string(msg.Key))
sess.MarkMessage(msg, "")
}

@ -70,7 +70,7 @@ func (PersistentConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error {
func (pc *PersistentConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
claim sarama.ConsumerGroupClaim) error {
for msg := range claim.Messages() {
log.InfoByKv("kafka get info to mysql", "", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
log.NewDebug("", "kafka get info to mysql", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
pc.msgHandle[msg.Topic](msg.Value, string(msg.Key))
sess.MarkMessage(msg, "")
}

@ -31,7 +31,7 @@ func (ms *PushConsumerHandler) Init() {
config.Config.Kafka.ConsumerGroupID.MsgToPush)
}
func (ms *PushConsumerHandler) handleMs2PsChat(msg []byte) {
log.InfoByKv("msg come from kafka And push!!!", "", "msg", string(msg))
log.NewDebug("", "msg come from kafka And push!!!", "msg", string(msg))
msgFromMQ := pbChat.PushMsgDataToMQ{}
if err := proto.Unmarshal(msg, &msgFromMQ); err != nil {
log.ErrorByKv("push Unmarshal msg err", "", "msg", string(msg), "err", err.Error())
@ -45,7 +45,7 @@ func (PushConsumerHandler) Cleanup(_ sarama.ConsumerGroupSession) error { return
func (ms *PushConsumerHandler) ConsumeClaim(sess sarama.ConsumerGroupSession,
claim sarama.ConsumerGroupClaim) error {
for msg := range claim.Messages() {
log.InfoByKv("kafka get info to mysql", "", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
log.NewDebug("", "kafka get info to mysql", "msgTopic", msg.Topic, "msgPartition", msg.Partition, "msg", string(msg.Value))
ms.msgHandle[msg.Topic](msg.Value)
}
return nil

@ -37,8 +37,7 @@ func (r *RPCServer) run() {
listener, err := net.Listen("tcp", address)
if err != nil {
log.Error("", "push module rpc listening port err", err.Error(), address)
return
panic("listening err:" + err.Error() + r.rpcRegisterName)
}
defer listener.Close()
srv := grpc.NewServer()

@ -46,8 +46,7 @@ func (s *adminCMSServer) Run() {
//listener network
listener, err := net.Listen("tcp", address)
if err != nil {
log.NewError("0", "Listen failed ", err.Error(), address)
return
panic("listening err:" + err.Error() + s.rpcRegisterName)
}
log.NewInfo("0", "listen network success, ", address, listener)
defer listener.Close()

@ -88,8 +88,7 @@ func (rpc *rpcAuth) Run() {
address := listenIP + ":" + strconv.Itoa(rpc.rpcPort)
listener, err := net.Listen("tcp", address)
if err != nil {
log.NewError(operationID, "listen network failed ", err.Error(), address)
return
panic("listening err:" + err.Error() + rpc.rpcRegisterName)
}
log.NewInfo(operationID, "listen network success, ", address, listener)
//grpc server

@ -47,8 +47,7 @@ func (s *cacheServer) Run() {
//listener network
listener, err := net.Listen("tcp", address)
if err != nil {
log.NewError("0", "Listen failed ", err.Error(), address)
return
panic("listening err:" + err.Error() + s.rpcRegisterName)
}
log.NewInfo("0", "listen network success, ", address, listener)
defer listener.Close()

@ -148,8 +148,7 @@ func (rpc *rpcConversation) Run() {
listener, err := net.Listen("tcp", address)
if err != nil {
log.NewError("0", "listen network failed ", err.Error(), address)
return
panic("listening err:" + err.Error() + rpc.rpcRegisterName)
}
log.NewInfo("0", "listen network success, ", address, listener)
//grpc server

@ -53,8 +53,7 @@ func (s *friendServer) Run() {
//listener network
listener, err := net.Listen("tcp", address)
if err != nil {
log.NewError("0", "Listen failed ", err.Error(), address)
return
panic("listening err:" + err.Error() + s.rpcRegisterName)
}
log.NewInfo("0", "listen ok ", address)
defer listener.Close()

@ -54,8 +54,7 @@ func (s *groupServer) Run() {
//listener network
listener, err := net.Listen("tcp", address)
if err != nil {
log.NewError("", "Listen failed ", err.Error(), address)
return
panic("listening err:" + err.Error() + s.rpcRegisterName)
}
log.NewInfo("", "listen network success, ", address, listener)
defer listener.Close()

@ -54,8 +54,7 @@ func (s *messageCMSServer) Run() {
//listener network
listener, err := net.Listen("tcp", address)
if err != nil {
log.NewError("0", "Listen failed ", err.Error(), address)
return
panic("listening err:" + err.Error() + s.rpcRegisterName)
}
log.NewInfo("0", "listen network success, ", address, listener)
defer listener.Close()

@ -11,7 +11,7 @@ import (
)
func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *pbMsg.GetMaxAndMinSeqReq) (*pbMsg.GetMaxAndMinSeqResp, error) {
log.InfoByKv("rpc getMaxAndMinSeq is arriving", in.OperationID, in.String())
log.NewInfo(in.OperationID, "rpc getMaxAndMinSeq is arriving", in.String())
//seq, err := model.GetBiggestSeqFromReceive(in.UserID)
maxSeq, err1 := commonDB.DB.GetUserMaxSeq(in.UserID)
minSeq, err2 := commonDB.DB.GetUserMinSeq(in.UserID)

@ -45,8 +45,7 @@ func (rpc *rpcChat) Run() {
address := listenIP + ":" + strconv.Itoa(rpc.rpcPort)
listener, err := net.Listen("tcp", address)
if err != nil {
log.Error("", "listen network failed ", err.Error(), address)
return
panic("listening err:" + err.Error() + rpc.rpcRegisterName)
}
log.Info("", "listen network success, address ", address)

@ -49,8 +49,7 @@ func (s *officeServer) Run() {
//listener network
listener, err := net.Listen("tcp", address)
if err != nil {
log.NewError("0", "Listen failed ", err.Error(), address)
return
panic("listening err:" + err.Error() + s.rpcRegisterName)
}
log.NewInfo("0", "listen network success, ", address, listener)
defer listener.Close()

@ -50,8 +50,7 @@ func (s *organizationServer) Run() {
//listener network
listener, err := net.Listen("tcp", address)
if err != nil {
log.NewError("", "Listen failed ", err.Error(), address)
return
panic("listening err:" + err.Error() + s.rpcRegisterName)
}
log.NewInfo("", "listen network success, ", address, listener)
defer listener.Close()

@ -58,8 +58,7 @@ func (s *statisticsServer) Run() {
//listener network
listener, err := net.Listen("tcp", address)
if err != nil {
log.NewError("0", "Listen failed ", err.Error(), address)
return
panic("listening err:" + err.Error() + s.rpcRegisterName)
}
log.NewInfo("0", "listen network success, ", address, listener)
defer listener.Close()

@ -55,8 +55,7 @@ func (s *userServer) Run() {
//listener network
listener, err := net.Listen("tcp", address)
if err != nil {
log.NewError("0", "listen network failed ", err.Error(), address)
return
panic("listening err:" + err.Error() + s.rpcRegisterName)
}
log.NewInfo("0", "listen network success, address ", address, listener)
defer listener.Close()

Loading…
Cancel
Save