diff --git a/.gitignore b/.gitignore index 0c5e605..3f6bb8a 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ go-ldap-admin # Dependency directories (remove the comment below to include it) # vendor/ -tmp \ No newline at end of file +tmp +docs/docker-compose/data \ No newline at end of file diff --git a/docs/docker-compose/config/config.yml b/docs/docker-compose/config/config.yml new file mode 120000 index 0000000..e9abc7f --- /dev/null +++ b/docs/docker-compose/config/config.yml @@ -0,0 +1 @@ +config.yml \ No newline at end of file diff --git a/docs/docker-compose/docker-compose.yaml b/docs/docker-compose/docker-compose.yaml index 3864c06..353251a 100644 --- a/docs/docker-compose/docker-compose.yaml +++ b/docs/docker-compose/docker-compose.yaml @@ -76,6 +76,8 @@ services: WAIT_HOSTS: mysql:3306, openldap:389 ports: - 8888:8888 + volumes: + - ./config/config.yml:/app/config.yml depends_on: - mysql - openldap diff --git a/public/client/dingtalk/dingtalk.go b/public/client/dingtalk/dingtalk.go index 639086d..adc40d1 100644 --- a/public/client/dingtalk/dingtalk.go +++ b/public/client/dingtalk/dingtalk.go @@ -52,7 +52,7 @@ func GetAllUsers() (ret []map[string]interface{}, err error) { ele := make(map[string]interface{}) ele["userid"] = user.UserId ele["unionid"] = user.UnionId - ele["name_pinyin"] = strings.Join(pinyin.LazyConvert(user.Name, nil), "") + ele["custom_name_pinyin"] = strings.Join(pinyin.LazyConvert(user.Name, nil), "") ele["name"] = user.Name ele["avatar"] = user.Avatar ele["mobile"] = user.Mobile @@ -62,7 +62,13 @@ func GetAllUsers() (ret []map[string]interface{}, err error) { ele["remark"] = user.Remark ele["leader"] = user.Leader ele["org_email"] = user.OrgEmail + if user.OrgEmail != "" { + ele["custom_nickname_org_email"] = strings.Split(user.OrgEmail, "@")[0] + } ele["email"] = user.Email + if user.Email != "" { + ele["custom_nickname_email"] = strings.Split(user.Email, "@")[0] + } // 部门ids var sourceDeptIds []string for _, deptId := range user.DeptIds { diff --git a/public/client/feishu/feishu.go b/public/client/feishu/feishu.go index 518a828..15e1a47 100644 --- a/public/client/feishu/feishu.go +++ b/public/client/feishu/feishu.go @@ -71,12 +71,18 @@ func GetAllUsers() (ret []map[string]interface{}, err error) { for _, user := range res.Items { ele := make(map[string]interface{}) ele["name"] = user.Name - ele["name_pinyin"] = strings.Join(pinyin.LazyConvert(user.Name, nil), "") + ele["custom_name_pinyin"] = strings.Join(pinyin.LazyConvert(user.Name, nil), "") ele["union_id"] = user.UnionID ele["user_id"] = user.UserID ele["open_id"] = user.OpenID ele["en_name"] = user.EnName ele["nickname"] = user.Nickname + if user.Email != "" { + ele["custom_nickname_email"] = strings.Split(user.Email, "@")[0] + } + if user.EnterpriseEmail != "" { + ele["custom_nickname_enterprise_email"] = strings.Split(user.EnterpriseEmail, "@")[0] + } ele["email"] = user.Email ele["mobile"] = user.Mobile[3:] ele["gender"] = user.Gender diff --git a/public/client/wechat/wecom.go b/public/client/wechat/wecom.go index 5245eed..22b331c 100644 --- a/public/client/wechat/wecom.go +++ b/public/client/wechat/wecom.go @@ -50,13 +50,19 @@ func GetAllUsers() (ret []map[string]interface{}, err error) { for _, user := range users.UserList { ele := make(map[string]interface{}) ele["name"] = user.Name - ele["name_pinyin"] = strings.Join(pinyin.LazyConvert(user.Name, nil), "") + ele["custom_name_pinyin"] = strings.Join(pinyin.LazyConvert(user.Name, nil), "") ele["userid"] = user.UserID ele["mobile"] = user.Mobile ele["position"] = user.Position ele["gender"] = user.Gender ele["email"] = user.Email + if user.Email != "" { + ele["custom_nickname_email"] = strings.Split(user.Email, "@")[0] + } ele["biz_email"] = user.BizMail + if user.BizMail != "" { + ele["custom_nickname_biz_email"] = strings.Split(user.BizMail, "@")[0] + } ele["avatar"] = user.Avatar ele["telephone"] = user.Telephone ele["alias"] = user.Alias