bug fix and shell optimization

This commit is contained in:
Gordon
2021-09-13 15:48:19 +08:00
parent c1bcadd9ed
commit 649bc5657e
14 changed files with 72 additions and 42 deletions
+7 -2
View File
@@ -2,6 +2,7 @@ package rpcChat
import (
"context"
"github.com/garyburd/redigo/redis"
commonDB "Open_IM/src/common/db"
"Open_IM/src/common/log"
@@ -23,8 +24,12 @@ func (rpc *rpcChat) GetNewSeq(_ context.Context, in *pbMsg.GetNewSeqReq) (*pbMsg
resp.ErrMsg = ""
return resp, err
} else {
log.ErrorByKv("getSeq from redis error", in.OperationID, "args", in.String(), "err", err.Error())
resp.Seq = 0
if err == redis.ErrNil {
resp.Seq = 0
} else {
log.ErrorByKv("getSeq from redis error", in.OperationID, "args", in.String(), "err", err.Error())
resp.Seq = -1
}
resp.ErrCode = 0
resp.ErrMsg = ""
return resp, nil
@@ -13,7 +13,7 @@ func (s *groupServer) GetGroupApplicationList(_ context.Context, pb *group.GetGr
reply, err := im_mysql_model.GetGroupApplicationList(pb.UID)
if err != nil {
log.Error("", "", "rpc GetGroupApplicationList call..., im_mysql_model.GetGroupApplicationList fail [uid: %s] [err: %s]", pb.UID, err.Error())
return nil, err
return &group.GetGroupApplicationListResp{ErrCode: 701, ErrMsg: "GetGroupApplicationList failed"}, nil
}
log.Info("", "", "rpc GetGroupApplicationList call..., im_mysql_model.GetGroupApplicationList")
@@ -14,7 +14,7 @@ func (s *groupServer) GroupApplicationResponse(_ context.Context, pb *group.Grou
reply, err := im_mysql_model.GroupApplicationResponse(pb)
if err != nil {
log.Error("", "", "rpc GroupApplicationResponse call..., im_mysql_model.GroupApplicationResponse fail [pb: %s] [err: %s]", pb.String(), err.Error())
return nil, err
return &group.GroupApplicationResponseResp{ErrCode: 702, ErrMsg: "rpc GroupApplicationResponse failed"}, nil
}
if pb.HandleResult == 1 {
+20 -9
View File
@@ -41,18 +41,29 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI
}
if RpcResp.ErrorCode != 0 {
log.ErrorByKv("get friend list rpc server failed", req.OperationID, "err", err.Error(), "req", req.String())
}
self, err := im_mysql_model.FindUserByUID(claims.UID)
if err != nil {
log.ErrorByKv("get self info failed", req.OperationID, "err", err.Error(), "req", req.String())
}
var name, faceUrl string
if self != nil {
name, faceUrl = self.Name, self.Icon
}
for _, v := range RpcResp.Data {
logic.SendMsgByWS(&pbChat.WSToMsgSvrChatMsg{
SendID: claims.UID,
RecvID: v.Uid,
Content: claims.UID + "'s info has changed",
SendTime: utils.GetCurrentTimestampBySecond(),
MsgFrom: constant.SysMsgType,
ContentType: constant.SetSelfInfoTip,
SessionType: constant.SingleChatType,
OperationID: req.OperationID,
Token: req.Token,
SendID: claims.UID,
RecvID: v.Uid,
SenderNickName: name,
SenderFaceURL: faceUrl,
Content: claims.UID + "'s info has changed",
SendTime: utils.GetCurrentTimestampBySecond(),
MsgFrom: constant.SysMsgType,
ContentType: constant.SetSelfInfoTip,
SessionType: constant.SingleChatType,
OperationID: req.OperationID,
Token: req.Token,
})
}