mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
Merge remote-tracking branch 'origin/superGroup' into superGroup
This commit is contained in:
commit
c27560ed44
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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(),
|
||||
|
2
internal/rpc/cache/cache.go
vendored
2
internal/rpc/cache/cache.go
vendored
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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())
|
||||
|
@ -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 {
|
||||
|
@ -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()
|
||||
|
@ -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 = ""
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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":
|
||||
|
Loading…
x
Reference in New Issue
Block a user