Merge remote-tracking branch 'origin/v2.3.0release' into v2.3.0release

This commit is contained in:
Gordon 2022-08-05 16:43:43 +08:00
commit 2436ea6ff9
4 changed files with 39 additions and 16 deletions

View File

@ -731,6 +731,10 @@ demo:
smtpPort: 25 #需开放此端口 出口方向 smtpPort: 25 #需开放此端口 出口方向
testDepartMentID: 001 testDepartMentID: 001
imAPIURL: http://127.0.0.1:10002 imAPIURL: http://127.0.0.1:10002
onboardProcess: false # 是否开启注册流程
joinDepartmentIDList: [] # 用户注册进来默认加的部门ID列表 不填就随机
joinDepartmentGroups: false # 注册是否加部门群
oaNotification: false # 注册是否发送OA通知
rtc: rtc:
signalTimeout: 35 signalTimeout: 35

View File

@ -50,23 +50,38 @@ func onboardingProcess(operationID, userID, userName, faceURL, phoneNumber, emai
if err := createOrganizationUser(operationID, userID, userName, phoneNumber, email); err != nil { if err := createOrganizationUser(operationID, userID, userName, phoneNumber, email); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), "createOrganizationUser failed", err.Error()) log.NewError(operationID, utils.GetSelfFuncName(), "createOrganizationUser failed", err.Error())
} }
departmentID, err := imdb.GetRandomDepartmentID() var joinDepartmentIDList []string
if len(config.Config.Demo.JoinDepartmentIDList) == 0 {
departmentID, err := imdb.GetRandomDepartmentID()
if err != nil {
log.NewError(utils.GetSelfFuncName(), "GetRandomDepartmentID failed", err.Error())
return
}
joinDepartmentIDList = []string{departmentID}
} else {
joinDepartmentIDList = config.Config.Demo.JoinDepartmentIDList
}
if err := joinTestDepartment(operationID, userID, departmentID); err != nil { for _, departmentID := range joinDepartmentIDList {
log.NewError(operationID, utils.GetSelfFuncName(), "joinTestDepartment failed", err.Error()) if err := joinTestDepartment(operationID, userID, departmentID); err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), "joinTestDepartment failed", err.Error())
}
} }
log.NewInfo(operationID, utils.GetSelfFuncName(), "random departmentID", departmentID)
if err != nil { if config.Config.Demo.JoinDepartmentGroups {
log.NewError(utils.GetSelfFuncName(), "GetRandomDepartmentID failed", err.Error()) for _, departmentID := range joinDepartmentIDList {
return groupIDList, err := GetDepartmentGroupIDList(operationID, departmentID)
if err != nil {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
}
joinGroups(operationID, userID, userName, faceURL, groupIDList)
log.NewInfo(operationID, utils.GetSelfFuncName(), "fineshed")
}
} }
groupIDList, err := GetDepartmentGroupIDList(operationID, departmentID)
if err != nil { if config.Config.Demo.OaNotification {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error()) oaNotification(operationID, userID)
} }
joinGroups(operationID, userID, userName, faceURL, groupIDList)
log.NewInfo(operationID, utils.GetSelfFuncName(), "fineshed")
oaNotification(operationID, userID)
} }
func createOrganizationUser(operationID, userID, userName, phoneNumber, email string) error { func createOrganizationUser(operationID, userID, userName, phoneNumber, email string) error {

View File

@ -107,7 +107,7 @@ func SetPassword(c *gin.Context) {
} }
log.Info(params.OperationID, "end setPassword", account, params.Password) log.Info(params.OperationID, "end setPassword", account, params.Password)
// demo onboarding // demo onboarding
if params.UserID == "" { if params.UserID == "" && config.Config.Demo.OnboardProcess {
select { select {
case Ch <- OnboardingProcessReq{ case Ch <- OnboardingProcessReq{
OperationID: params.OperationID, OperationID: params.OperationID,

View File

@ -488,8 +488,12 @@ type config struct {
SmtpAddr string `yaml:"smtpAddr"` SmtpAddr string `yaml:"smtpAddr"`
SmtpPort int `yaml:"smtpPort"` SmtpPort int `yaml:"smtpPort"`
} }
TestDepartMentID string `yaml:"testDepartMentID"` TestDepartMentID string `yaml:"testDepartMentID"`
ImAPIURL string `yaml:"imAPIURL"` ImAPIURL string `yaml:"imAPIURL"`
OnboardProcess bool `yaml:"onboardProcess"`
JoinDepartmentIDList []string `yaml:"joinDepartmentIDList"`
JoinDepartmentGroups bool `yaml:"joinDepartmentGroups"`
OaNotification bool `yaml:"oaNotification"`
} }
Rtc struct { Rtc struct {
SignalTimeout string `yaml:"signalTimeout"` SignalTimeout string `yaml:"signalTimeout"`