diff --git a/config/config.yaml b/config/config.yaml index 7af1ad769..81d7f9627 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -202,6 +202,7 @@ manager: #app管理员userID和对应的secret 建议修改。 用于管理后台登录,也可以用户管理后台对应的api appManagerUid: [ "openIM123456","openIM654321", "openIM333", "openIMAdmin"] secrets: [ "openIM1","openIM2", "openIM333", "openIMAdmin"] + appSysNotificationName: "系统通知" secret: tuoyun # 多端互踢策略 diff --git a/internal/rpc/msg/group_notification.go b/internal/rpc/msg/group_notification.go index 9c055d560..08b7d557d 100644 --- a/internal/rpc/msg/group_notification.go +++ b/internal/rpc/msg/group_notification.go @@ -117,15 +117,19 @@ func groupNotification(contentType int32, m proto.Message, sendID, groupID, recv } tips.JsonDetail, _ = marshaler.MarshalToString(m) - - from, err := imdb.GetUserByUserID(sendID) - if err != nil { - log.Error(operationID, "GetUserByUserID failed ", err.Error(), sendID) - } - nickname := "" - if from != nil { - nickname = from.Nickname + var nickname string + if utils.IsContain(sendID, config.Config.Manager.AppManagerUid) { + nickname = sendID + } else { + from, err := imdb.GetUserByUserID(sendID) + if err != nil { + log.Error(operationID, "GetUserByUserID failed ", err.Error(), sendID) + } + if from != nil { + nickname = from.Nickname + } } + to, err := imdb.GetUserByUserID(recvUserID) if err != nil { log.NewWarn(operationID, "GetUserByUserID failed ", err.Error(), recvUserID) diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index e6e34a7be..875051c27 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -174,8 +174,9 @@ type config struct { } } Manager struct { - AppManagerUid []string `yaml:"appManagerUid"` - Secrets []string `yaml:"secrets"` + AppManagerUid []string `yaml:"appManagerUid"` + Secrets []string `yaml:"secrets"` + AppSysNotificationName string `yaml:"appSysNotificationName"` } Kafka struct { diff --git a/pkg/common/db/mysql_model/im_mysql_model/user_model.go b/pkg/common/db/mysql_model/im_mysql_model/user_model.go index e3d507081..5b198b046 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/user_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/user_model.go @@ -22,7 +22,11 @@ func init() { } var appMgr db.User appMgr.UserID = v - appMgr.Nickname = "AppManager" + utils.IntToString(k+1) + if k == 0 { + appMgr.Nickname = config.Config.Manager.AppSysNotificationName + } else { + appMgr.Nickname = "AppManager" + utils.IntToString(k+1) + } appMgr.AppMangerLevel = constant.AppAdmin err = UserRegister(appMgr) if err != nil {