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
ed1e22bac5
@ -13,7 +13,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"time"
|
||||
@ -158,27 +157,28 @@ func joinGroups(operationID, userID, userName string, groupIDList []string) {
|
||||
log.NewError(req.OperationID, utils.GetSelfFuncName(), resp)
|
||||
continue
|
||||
}
|
||||
onboardingProcessNotification(operationID, userID, groupID)
|
||||
onboardingProcessNotification(operationID, userID, groupID, userName)
|
||||
}
|
||||
}
|
||||
|
||||
// welcome user join department notification
|
||||
func onboardingProcessNotification(operationID, userID, groupID string) {
|
||||
func onboardingProcessNotification(operationID, userID, groupID, userName string) {
|
||||
defer func() {
|
||||
log.NewInfo(operationID, utils.GetSelfFuncName(), userID, groupID)
|
||||
}()
|
||||
var tips commonPb.TipsComm
|
||||
tips.DefaultTips = config.Config.Notification.JoinDepartmentNotification.DefaultTips.Tips
|
||||
tips.JsonDetail = ""
|
||||
content, err := proto.Marshal(&tips)
|
||||
if err != nil {
|
||||
log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), "proto marshal failed")
|
||||
return
|
||||
}
|
||||
//var tips commonPb.TipsComm
|
||||
//tips.DefaultTips = config.Config.Notification.JoinDepartmentNotification.DefaultTips.Tips
|
||||
//tips.JsonDetail = ""
|
||||
//content, err := proto.Marshal(&tips)
|
||||
//if err != nil {
|
||||
// log.NewError(operationID, utils.GetSelfFuncName(), err.Error(), "proto marshal failed")
|
||||
// return
|
||||
//}
|
||||
welcomeString := fmt.Sprintf("欢迎%s加入部门", userName)
|
||||
notification := &msg.NotificationMsg{
|
||||
SendID: userID,
|
||||
RecvID: groupID,
|
||||
Content: content,
|
||||
Content: []byte(welcomeString),
|
||||
MsgFrom: constant.UserMsgType,
|
||||
ContentType: constant.Text,
|
||||
SessionType: constant.GroupChatType,
|
||||
|
@ -265,7 +265,9 @@ func getDepartmentParent(departmentID string, dbConn *gorm.DB) (*db.Department,
|
||||
if err != nil {
|
||||
return nil, utils.Wrap(err, "")
|
||||
}
|
||||
err = dbConn.Model(&parentDepartment).Where("department_id = ?", department.ParentID).Find(&parentDepartment).Error
|
||||
if department.ParentID != "" {
|
||||
err = dbConn.Model(&parentDepartment).Where("department_id = ?", department.ParentID).Find(&parentDepartment).Error
|
||||
}
|
||||
return &parentDepartment, utils.Wrap(err, "")
|
||||
}
|
||||
|
||||
@ -275,7 +277,7 @@ func GetDepartmentParent(departmentID string, dbConn *gorm.DB, parentIDList *[]s
|
||||
return err
|
||||
}
|
||||
if department.DepartmentID != "" {
|
||||
*parentIDList = append(*parentIDList, department.ParentID)
|
||||
*parentIDList = append(*parentIDList, department.DepartmentID)
|
||||
err = GetDepartmentParent(department.DepartmentID, dbConn, parentIDList)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user