判断 allperson是否为空才插入避免空数据导致清空
This commit is contained in:
parent
698a1241f4
commit
c5085c7e6f
10
main.go
10
main.go
|
@ -116,6 +116,7 @@ func main() {
|
|||
pf := perfectshutdown.New()
|
||||
|
||||
pf.Loop(func(index int, cxt *perfectshutdown.PerfectShutdown) {
|
||||
|
||||
ldapconn, err := ldap.DialURL("ldap://ldap.yuandian.com:389")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -200,7 +201,6 @@ func main() {
|
|||
allperson = append(allperson, dn)
|
||||
persondict[dn] = true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if department.DepartID > 1 {
|
||||
|
@ -210,13 +210,15 @@ func main() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.Println(string(resp.Content()))
|
||||
}
|
||||
|
||||
if !LdapGroupAdd(ldapconn, "源典所有成员", "源典所有成员", allperson) {
|
||||
LdapGroupModify(ldapconn, "源典所有成员", "源典所有成员", allperson)
|
||||
if len(allperson) > 0 {
|
||||
if !LdapGroupAdd(ldapconn, "源典所有成员", "源典所有成员", allperson) {
|
||||
LdapGroupModify(ldapconn, "源典所有成员", "源典所有成员", allperson)
|
||||
}
|
||||
}
|
||||
|
||||
cxt.Wait(time.Minute * 5)
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user