Merge remote-tracking branch 'origin/superGroup' into superGroup

pull/236/head
skiffer-git 2 years ago
commit 89d228e605

@ -1,6 +1,7 @@
package register package register
import ( import (
"Open_IM/internal/api/manage"
"Open_IM/internal/rpc/msg" "Open_IM/internal/rpc/msg"
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant" "Open_IM/pkg/common/constant"
@ -11,6 +12,7 @@ import (
commonPb "Open_IM/pkg/proto/sdk_ws" commonPb "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"encoding/json"
"errors" "errors"
"fmt" "fmt"
"math/rand" "math/rand"
@ -35,6 +37,7 @@ func onboardingProcess(operationID, userID, userName string) {
log.NewInfo(operationID, utils.GetSelfFuncName(), groupIDList) log.NewInfo(operationID, utils.GetSelfFuncName(), groupIDList)
joinGroups(operationID, userID, userName, groupIDList) joinGroups(operationID, userID, userName, groupIDList)
log.NewInfo(operationID, utils.GetSelfFuncName(), "fineshed") log.NewInfo(operationID, utils.GetSelfFuncName(), "fineshed")
oaNotification(operationID, userID)
} }
func createOrganizationUser(operationID, userID, userName string) error { func createOrganizationUser(operationID, userID, userName string) error {
@ -184,8 +187,40 @@ func onboardingProcessNotification(operationID, userID, groupID, userName string
SessionType: constant.GroupChatType, SessionType: constant.GroupChatType,
OperationID: operationID, OperationID: operationID,
} }
// notification user join group // notification user join group
msg.Notification(notification) 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 { func randomEnglishName() string {
@ -193,7 +228,6 @@ func randomEnglishName() string {
"feudal", "adverse", "exploit", "occupy", "solve", "amazing", "fantasy", "orchid", "spiky", "approve", "flap"} "feudal", "adverse", "exploit", "occupy", "solve", "amazing", "fantasy", "orchid", "spiky", "approve", "flap"}
rand.Seed(time.Now().UnixNano()) rand.Seed(time.Now().UnixNano())
index := rand.Intn(len(l) - 1) index := rand.Intn(len(l) - 1)
fmt.Println(index)
return l[index] return l[index]
} }
@ -201,6 +235,5 @@ func randomPosition() string {
l := []string{"Golang工程师", "前端工程师", "后端工程师", "产品经理", "测试开发工程师", "运维开发工程师"} l := []string{"Golang工程师", "前端工程师", "后端工程师", "产品经理", "测试开发工程师", "运维开发工程师"}
rand.Seed(time.Now().UnixNano()) rand.Seed(time.Now().UnixNano())
index := rand.Intn(len(l) - 1) index := rand.Intn(len(l) - 1)
fmt.Println(index)
return l[index] return l[index]
} }

Loading…
Cancel
Save