diff --git a/internal/demo/register/onboarding_process.go b/internal/demo/register/onboarding_process.go index 647fbe3c5..f96312b37 100644 --- a/internal/demo/register/onboarding_process.go +++ b/internal/demo/register/onboarding_process.go @@ -21,7 +21,8 @@ import ( "time" ) -func onboardingProcess(operationID, userID, userName string) { +func onboardingProcess(operationID, userID, userName, faceURL string) { + log.NewInfo(operationID, utils.GetSelfFuncName(), userName, userID, faceURL) if err := createOrganizationUser(operationID, userID, userName); err != nil { log.NewError(operationID, utils.GetSelfFuncName(), "createOrganizationUser failed", err.Error()) } @@ -39,8 +40,7 @@ func onboardingProcess(operationID, userID, userName string) { if err != nil { log.NewError(operationID, utils.GetSelfFuncName(), err.Error()) } - log.NewInfo(operationID, utils.GetSelfFuncName(), groupIDList) - joinGroups(operationID, userID, userName, groupIDList) + joinGroups(operationID, userID, userName, faceURL, groupIDList) log.NewInfo(operationID, utils.GetSelfFuncName(), "fineshed") oaNotification(operationID, userID) } @@ -157,7 +157,7 @@ func GetDepartmentGroupIDList(operationID, departmentID string) ([]string, error return getDepartmentParentIDListResp.GroupIDList, nil } -func joinGroups(operationID, userID, userName string, groupIDList []string) { +func joinGroups(operationID, userID, userName, faceURL string, groupIDList []string) { defer func() { log.NewInfo(operationID, utils.GetSelfFuncName(), userID, groupIDList) }() @@ -185,12 +185,12 @@ func joinGroups(operationID, userID, userName string, groupIDList []string) { log.NewError(req.OperationID, utils.GetSelfFuncName(), resp) continue } - onboardingProcessNotification(operationID, userID, groupID, userName) + onboardingProcessNotification(operationID, userID, groupID, userName, faceURL) } } // welcome user join department notification -func onboardingProcessNotification(operationID, userID, groupID, userName string) { +func onboardingProcessNotification(operationID, userID, groupID, userName, faceURL string) { defer func() { log.NewInfo(operationID, utils.GetSelfFuncName(), userID, groupID) }() @@ -204,13 +204,15 @@ func onboardingProcessNotification(operationID, userID, groupID, userName string //} welcomeString := fmt.Sprintf("欢迎%s加入部门", userName) notification := &msg.NotificationMsg{ - SendID: userID, - RecvID: groupID, - Content: []byte(welcomeString), - MsgFrom: constant.UserMsgType, - ContentType: constant.Text, - SessionType: constant.GroupChatType, - OperationID: operationID, + SendID: userID, + RecvID: groupID, + Content: []byte(welcomeString), + MsgFrom: constant.UserMsgType, + ContentType: constant.Text, + SessionType: constant.GroupChatType, + OperationID: operationID, + SenderNickname: userName, + SenderFaceURL: faceURL, } // notification user join group diff --git a/internal/demo/register/set_password.go b/internal/demo/register/set_password.go index 545a489d3..9e954f63a 100644 --- a/internal/demo/register/set_password.go +++ b/internal/demo/register/set_password.go @@ -87,7 +87,7 @@ func SetPassword(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"errCode": constant.RegisterFailed, "errMsg": "register failed: " + openIMRegisterResp.ErrMsg}) return } - log.Info(params.OperationID, "begin store mysql", account, params.Password) + log.Info(params.OperationID, "begin store mysql", account, params.Password, "info", params.FaceURL, params.Nickname) err = im_mysql_model.SetPassword(account, params.Password, params.Ex, userID) if err != nil { log.NewError(params.OperationID, "set phone number password error", account, "err", err.Error()) @@ -96,7 +96,7 @@ func SetPassword(c *gin.Context) { } log.Info(params.OperationID, "end setPassword", account, params.Password) // demo onboarding - onboardingProcess(params.OperationID, userID, params.Nickname) + onboardingProcess(params.OperationID, userID, params.Nickname, params.FaceURL) c.JSON(http.StatusOK, gin.H{"errCode": constant.NoError, "errMsg": "", "data": openIMRegisterResp.UserToken}) return } diff --git a/internal/msg_gateway/gate/rpc_server.go b/internal/msg_gateway/gate/rpc_server.go index 6c7ec7809..c8eb15538 100644 --- a/internal/msg_gateway/gate/rpc_server.go +++ b/internal/msg_gateway/gate/rpc_server.go @@ -55,7 +55,7 @@ func (r *RPCServer) run() { defer srv.GracefulStop() pbRelay.RegisterOnlineMessageRelayServiceServer(srv, r) - rpcRegisterIP := "" + rpcRegisterIP := config.Config.RpcRegisterIP if config.Config.RpcRegisterIP == "" { rpcRegisterIP, err = utils.GetLocalIP() if err != nil { @@ -291,9 +291,11 @@ func (r *RPCServer) KickUserOffline(_ context.Context, req *pbRelay.KickUserOffl for _, v := range req.KickUserIDList { oldConnMap := ws.getUserAllCons(v) if conn, ok := oldConnMap[int(req.PlatformID)]; ok { // user->map[platform->conn] + log.NewWarn(req.OperationID, "send kick msg, close connection ", req.PlatformID, v) ws.sendKickMsg(conn, &UserConn{}) conn.Close() } + log.NewWarn(req.OperationID, "SetTokenKicked ", v, req.PlatformID, req.OperationID) SetTokenKicked(v, int(req.PlatformID), req.OperationID) } return &pbRelay.KickUserOfflineResp{}, nil diff --git a/internal/push/logic/push_rpc_server.go b/internal/push/logic/push_rpc_server.go index 8fbf4e7d1..08939ef1a 100644 --- a/internal/push/logic/push_rpc_server.go +++ b/internal/push/logic/push_rpc_server.go @@ -44,7 +44,7 @@ func (r *RPCServer) run() { srv := grpc.NewServer() defer srv.GracefulStop() pbPush.RegisterPushMsgServiceServer(srv, r) - rpcRegisterIP := "" + rpcRegisterIP := config.Config.RpcRegisterIP if config.Config.RpcRegisterIP == "" { rpcRegisterIP, err = utils.GetLocalIP() if err != nil { diff --git a/internal/rpc/admin_cms/admin_cms.go b/internal/rpc/admin_cms/admin_cms.go index ed744b312..4a97f94e1 100644 --- a/internal/rpc/admin_cms/admin_cms.go +++ b/internal/rpc/admin_cms/admin_cms.go @@ -56,7 +56,7 @@ func (s *adminCMSServer) Run() { defer srv.GracefulStop() //Service registers with etcd pbAdminCMS.RegisterAdminCMSServer(srv, s) - rpcRegisterIP := "" + rpcRegisterIP := config.Config.RpcRegisterIP if config.Config.RpcRegisterIP == "" { rpcRegisterIP, err = utils.GetLocalIP() if err != nil { diff --git a/internal/rpc/auth/auth.go b/internal/rpc/auth/auth.go index 38a27dfcf..31c0cd62b 100644 --- a/internal/rpc/auth/auth.go +++ b/internal/rpc/auth/auth.go @@ -134,7 +134,7 @@ func (rpc *rpcAuth) Run() { //service registers with etcd pbAuth.RegisterAuthServer(srv, rpc) - rpcRegisterIP := "" + rpcRegisterIP := config.Config.RpcRegisterIP if config.Config.RpcRegisterIP == "" { rpcRegisterIP, err = utils.GetLocalIP() if err != nil { @@ -142,6 +142,7 @@ func (rpc *rpcAuth) Run() { } } log.NewInfo("", "rpcRegisterIP", rpcRegisterIP) + err = getcdv3.RegisterEtcd(rpc.etcdSchema, strings.Join(rpc.etcdAddr, ","), rpcRegisterIP, rpc.rpcPort, rpc.rpcRegisterName, 10) if err != nil { log.NewError(operationID, "RegisterEtcd failed ", err.Error(), diff --git a/internal/rpc/cache/cache.go b/internal/rpc/cache/cache.go index 2d58d190a..79d86f2b8 100644 --- a/internal/rpc/cache/cache.go +++ b/internal/rpc/cache/cache.go @@ -65,7 +65,7 @@ func (s *cacheServer) Run() { defer srv.GracefulStop() pbCache.RegisterCacheServer(srv, s) - rpcRegisterIP := "" + rpcRegisterIP := config.Config.RpcRegisterIP if config.Config.RpcRegisterIP == "" { rpcRegisterIP, err = utils.GetLocalIP() if err != nil { diff --git a/internal/rpc/conversation/conversaion.go b/internal/rpc/conversation/conversaion.go index 3c68e5c46..9ea7efcc0 100644 --- a/internal/rpc/conversation/conversaion.go +++ b/internal/rpc/conversation/conversaion.go @@ -157,7 +157,7 @@ func (rpc *rpcConversation) Run() { //service registers with etcd pbConversation.RegisterConversationServer(srv, rpc) - rpcRegisterIP := "" + rpcRegisterIP := config.Config.RpcRegisterIP if config.Config.RpcRegisterIP == "" { rpcRegisterIP, err = utils.GetLocalIP() if err != nil { diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 946002363..63fc077d1 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -66,7 +66,7 @@ func (s *groupServer) Run() { pbGroup.RegisterGroupServer(srv, s) rpcRegisterIP := config.Config.RpcRegisterIP - if rpcRegisterIP == "" { + if config.Config.RpcRegisterIP == "" { rpcRegisterIP, err = utils.GetLocalIP() if err != nil { log.Error("", "GetLocalIP failed ", err.Error()) diff --git a/internal/rpc/message_cms/message_cms.go b/internal/rpc/message_cms/message_cms.go index 4f983e787..44fdca1e4 100644 --- a/internal/rpc/message_cms/message_cms.go +++ b/internal/rpc/message_cms/message_cms.go @@ -63,7 +63,7 @@ func (s *messageCMSServer) Run() { defer srv.GracefulStop() //Service registers with etcd pbMessageCMS.RegisterMessageCMSServer(srv, s) - rpcRegisterIP := "" + rpcRegisterIP := config.Config.RpcRegisterIP if config.Config.RpcRegisterIP == "" { rpcRegisterIP, err = utils.GetLocalIP() if err != nil { diff --git a/internal/rpc/msg/rpcChat.go b/internal/rpc/msg/rpcChat.go index cc65a4612..e7ae283ab 100644 --- a/internal/rpc/msg/rpcChat.go +++ b/internal/rpc/msg/rpcChat.go @@ -64,7 +64,7 @@ func (rpc *rpcChat) Run() { srv := grpc.NewServer() defer srv.GracefulStop() - rpcRegisterIP := "" + rpcRegisterIP := config.Config.RpcRegisterIP pbChat.RegisterChatServer(srv, rpc) if config.Config.RpcRegisterIP == "" { rpcRegisterIP, err = utils.GetLocalIP() diff --git a/internal/rpc/msg/send_msg.go b/internal/rpc/msg/send_msg.go index 08d3006ca..118b7bd01 100644 --- a/internal/rpc/msg/send_msg.go +++ b/internal/rpc/msg/send_msg.go @@ -553,13 +553,15 @@ func modifyMessageByUserMessageReceiveOptoptimization(userID, sourceID string, s } type NotificationMsg struct { - SendID string - RecvID string - Content []byte // open_im_sdk.TipsComm - MsgFrom int32 - ContentType int32 - SessionType int32 - OperationID string + SendID string + RecvID string + Content []byte // open_im_sdk.TipsComm + MsgFrom int32 + ContentType int32 + SessionType int32 + OperationID string + SenderNickname string + SenderFaceURL string } func Notification(n *NotificationMsg) { @@ -579,6 +581,8 @@ func Notification(n *NotificationMsg) { msg.CreateTime = utils.GetCurrentTimestampByMill() msg.ClientMsgID = utils.GetMsgID(n.SendID) msg.Options = make(map[string]bool, 7) + msg.SenderNickname = n.SenderNickname + msg.SenderFaceURL = n.SenderFaceURL switch n.SessionType { case constant.GroupChatType, constant.SuperGroupChatType: msg.RecvID = "" diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index 71a6db68b..ace207322 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -71,7 +71,7 @@ func (s *officeServer) Run() { defer srv.GracefulStop() //Service registers with etcd pbOffice.RegisterOfficeServiceServer(srv, s) - rpcRegisterIP := "" + rpcRegisterIP := config.Config.RpcRegisterIP if config.Config.RpcRegisterIP == "" { rpcRegisterIP, err = utils.GetLocalIP() if err != nil { diff --git a/internal/rpc/organization/organization.go b/internal/rpc/organization/organization.go index 81659ef60..db423caa0 100644 --- a/internal/rpc/organization/organization.go +++ b/internal/rpc/organization/organization.go @@ -61,7 +61,7 @@ func (s *organizationServer) Run() { defer srv.GracefulStop() //Service registers with etcd rpc.RegisterOrganizationServer(srv, s) - rpcRegisterIP := "" + rpcRegisterIP := config.Config.RpcRegisterIP if config.Config.RpcRegisterIP == "" { rpcRegisterIP, err = utils.GetLocalIP() if err != nil { diff --git a/internal/rpc/statistics/statistics.go b/internal/rpc/statistics/statistics.go index b1811cb48..920fc9d73 100644 --- a/internal/rpc/statistics/statistics.go +++ b/internal/rpc/statistics/statistics.go @@ -67,7 +67,7 @@ func (s *statisticsServer) Run() { defer srv.GracefulStop() //Service registers with etcd pbStatistics.RegisterUserServer(srv, s) - rpcRegisterIP := "" + rpcRegisterIP := config.Config.RpcRegisterIP if config.Config.RpcRegisterIP == "" { rpcRegisterIP, err = utils.GetLocalIP() if err != nil { diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index fa733cbe4..c774a9c6e 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -62,7 +62,7 @@ func (s *userServer) Run() { defer srv.GracefulStop() //Service registers with etcd pbUser.RegisterUserServer(srv, s) - rpcRegisterIP := "" + rpcRegisterIP := config.Config.RpcRegisterIP if config.Config.RpcRegisterIP == "" { rpcRegisterIP, err = utils.GetLocalIP() if err != nil { @@ -284,7 +284,7 @@ func (s *userServer) SetRecvMsgOpt(ctx context.Context, req *pbUser.SetRecvMsgOp stringList := strings.Split(req.ConversationID, "_") if len(stringList) > 1 { switch stringList[0] { - case "single_": + case "single": conversation.UserID = stringList[1] conversation.ConversationType = constant.SingleChatType case "group":