From fa02c20e1cfec0d9b8849f754c8584e643a3b4d3 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Fri, 10 Jun 2022 18:13:11 +0800 Subject: [PATCH] fix signal --- internal/demo/register/onboarding_process.go | 37 ++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/internal/demo/register/onboarding_process.go b/internal/demo/register/onboarding_process.go index b25b2d763..3ced655ab 100644 --- a/internal/demo/register/onboarding_process.go +++ b/internal/demo/register/onboarding_process.go @@ -1,6 +1,7 @@ package register import ( + "Open_IM/internal/api/manage" "Open_IM/internal/rpc/msg" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" @@ -11,6 +12,7 @@ import ( commonPb "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "context" + "encoding/json" "errors" "fmt" "math/rand" @@ -35,6 +37,7 @@ func onboardingProcess(operationID, userID, userName string) { log.NewInfo(operationID, utils.GetSelfFuncName(), groupIDList) joinGroups(operationID, userID, userName, groupIDList) log.NewInfo(operationID, utils.GetSelfFuncName(), "fineshed") + oaNotification(operationID, userID) } func createOrganizationUser(operationID, userID, userName string) error { @@ -184,8 +187,40 @@ func onboardingProcessNotification(operationID, userID, groupID, userName string SessionType: constant.GroupChatType, OperationID: operationID, } + // notification user join group msg.Notification(notification) + +} + +func oaNotification(operationID, userID string) { + elem := manage.OANotificationElem{ + NotificationName: "入职通知", + NotificationFaceURL: "", + NotificationType: 1, + Text: "欢迎你入职公司", + Url: "", + MixType: 0, + PictureElem: manage.PictureElem{}, + SoundElem: manage.SoundElem{}, + VideoElem: manage.VideoElem{}, + FileElem: manage.FileElem{}, + Ex: "", + } + bytes, err := json.Marshal(elem) + if err != nil { + return + } + sysNotification := &msg.NotificationMsg{ + SendID: config.Config.Manager.AppManagerUid[0], + RecvID: userID, + Content: bytes, + MsgFrom: constant.SysMsgType, + ContentType: constant.OANotification, + SessionType: constant.NotificationChatType, + OperationID: operationID, + } + msg.Notification(sysNotification) } func randomEnglishName() string { @@ -193,7 +228,6 @@ func randomEnglishName() string { "feudal", "adverse", "exploit", "occupy", "solve", "amazing", "fantasy", "orchid", "spiky", "approve", "flap"} rand.Seed(time.Now().UnixNano()) index := rand.Intn(len(l) - 1) - fmt.Println(index) return l[index] } @@ -201,6 +235,5 @@ func randomPosition() string { l := []string{"Golang工程师", "前端工程师", "后端工程师", "产品经理", "测试开发工程师", "运维开发工程师"} rand.Seed(time.Now().UnixNano()) index := rand.Intn(len(l) - 1) - fmt.Println(index) return l[index] }