pull/455/head
wangchuxiao 2 years ago committed by Xinwei Xiong(cubxxw-openim)
parent 2661f71671
commit dc3206dd3e

@ -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"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
@ -36,6 +38,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 {
@ -179,8 +182,40 @@ func onboardingProcessNotification(operationID, userID, groupID string) {
SessionType: constant.SingleChatType, SessionType: constant.SingleChatType,
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 {
@ -188,7 +223,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]
} }
@ -196,6 +230,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