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

This commit is contained in:
skiffer-git 2022-06-13 14:59:06 +08:00
commit 464200e693
3 changed files with 28 additions and 12 deletions

View File

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

View File

@ -5,6 +5,7 @@ import (
"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"
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
groupRpc "Open_IM/pkg/proto/group" groupRpc "Open_IM/pkg/proto/group"
@ -29,7 +30,12 @@ func onboardingProcess(operationID, userID, userName string) {
if err := joinTestDepartment(operationID, userID, departmentID); err != nil { if err := joinTestDepartment(operationID, userID, departmentID); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), "joinTestDepartment failed", err.Error()) 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) groupIDList, err := GetDepartmentGroupIDList(operationID, departmentID)
if err != nil { if err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error()) log.NewError(operationID, utils.GetSelfFuncName(), err.Error())

View File

@ -295,3 +295,13 @@ func GetDepartmentParentIDList(departmentID string) ([]string, error) {
err = GetDepartmentParent(departmentID, dbConn, &parentIDList) err = GetDepartmentParent(departmentID, dbConn, &parentIDList)
return parentIDList, err 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
}