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

pull/236/head
skiffer-git 3 years ago
commit 464200e693

@ -347,15 +347,15 @@ type RevokeElem struct {
RevokeMsgClientID string `mapstructure:"revokeMsgClientID" validate:"required"`
}
type OANotificationElem struct {
NotificationName string `mapstructure:"notificationName" validate:"required"`
NotificationFaceURL string `mapstructure:"notificationFaceURL" validate:"required"`
NotificationType int32 `mapstructure:"notificationType" validate:"required"`
Text string `mapstructure:"text" validate:"required"`
Url string `mapstructure:"url"`
MixType int32 `mapstructure:"mixType"`
PictureElem PictureElem `mapstructure:"pictureElem"`
SoundElem SoundElem `mapstructure:"soundElem"`
VideoElem VideoElem `mapstructure:"videoElem"`
FileElem FileElem `mapstructure:"fileElem"`
Ex string `mapstructure:"ex"`
NotificationName string `mapstructure:"notificationName" json:"notificationName" validate:"required"`
NotificationFaceURL string `mapstructure:"notificationFaceURL" json:"notificationFaceURL" validate:"required"`
NotificationType int32 `mapstructure:"notificationType" json:"notificationType" validate:"required"`
Text string `mapstructure:"text" json:"text" validate:"required"`
Url string `mapstructure:"url" json:"url"`
MixType int32 `mapstructure:"mixType" json:"mixType"`
PictureElem PictureElem `mapstructure:"pictureElem" json:"pictureElem"`
SoundElem SoundElem `mapstructure:"soundElem" json:"soundElem"`
VideoElem VideoElem `mapstructure:"videoElem" json:"videoElem"`
FileElem FileElem `mapstructure:"fileElem" json:"fileElem"`
Ex string `mapstructure:"ex" json:"ex"`
}

@ -5,6 +5,7 @@ import (
"Open_IM/internal/rpc/msg"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3"
groupRpc "Open_IM/pkg/proto/group"
@ -29,7 +30,12 @@ func onboardingProcess(operationID, userID, userName string) {
if err := joinTestDepartment(operationID, userID, departmentID); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), "joinTestDepartment failed", err.Error())
}
departmentID, err := imdb.GetRandomDepartmentID()
log.NewInfo(operationID, utils.GetSelfFuncName(), "random departmentID", departmentID)
if err != nil {
log.NewError(utils.GetSelfFuncName(), "GetRandomDepartmentID failed", err.Error())
return
}
groupIDList, err := GetDepartmentGroupIDList(operationID, departmentID)
if err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())

@ -295,3 +295,13 @@ func GetDepartmentParentIDList(departmentID string) ([]string, error) {
err = GetDepartmentParent(departmentID, dbConn, &parentIDList)
return parentIDList, err
}
func GetRandomDepartmentID() (string, error) {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return "", err
}
department := &db.Department{}
err = dbConn.Model(department).Where("related_group_id != ? AND parent_id != ?", "", "").Take(department).Error
return department.DepartmentID, err
}

Loading…
Cancel
Save