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