From 91194b04a9c400e9d9f63896e0f59fecabea30f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E4=B8=AB=E8=AE=B2=E6=A2=B5?= Date: Wed, 22 Jun 2022 10:27:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E4=B8=89=E6=96=B9IM=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=BA=90=E5=AE=98=E6=96=B9=E5=9C=B0=E5=9D=80=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=20(#42)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.yml | 1 + public/client/dingtalk/dingtalk.go | 5 +++++ public/client/feishu/feishu.go | 3 +++ public/client/wechat/wecom.go | 2 ++ 4 files changed, 11 insertions(+) diff --git a/config.yml b/config.yml index 06c3d42..f3cd07b 100644 --- a/config.yml +++ b/config.yml @@ -114,6 +114,7 @@ wecom: corp-secret: "xxxxx" # 企业微信中创建的应用secret enable-sync: false # 是否开启定时同步企业微信的任务 feishu: + # 配置获取详细文档参考:http://ldapdoc.eryajf.net/pages/83c90b/ flag: "feishu" # 作为飞书在平台的标识 app-id: "xxxxxxx" # 飞书的app-id app-secret: "xxxxxxxxxxx" # 飞书的app-secret \ No newline at end of file diff --git a/public/client/dingtalk/dingtalk.go b/public/client/dingtalk/dingtalk.go index 9cb033d..de14ef7 100644 --- a/public/client/dingtalk/dingtalk.go +++ b/public/client/dingtalk/dingtalk.go @@ -7,6 +7,8 @@ import ( "github.com/zhaoyunxing92/dingtalk/v2/request" ) +// 官方文档地址: https://open.dingtalk.com/document/orgapp-server/obtain-the-department-list +// GetAllDepts 获取所有部门 func GetAllDepts(deptId int) (result []*DingTalkDept, err error) { depts, err := InitDingTalkClient().FetchDeptList(deptId, true, "zh_CN") if err != nil { @@ -24,6 +26,8 @@ func GetAllDepts(deptId int) (result []*DingTalkDept, err error) { return } +// 官方文档地址: https://open.dingtalk.com/document/orgapp-server/queries-the-complete-information-of-a-department-user +// GetAllUsers 获取所有员工信息 func GetAllUsers() (result []*DingTalkUser, err error) { depts, err := GetAllDepts(1) if err != nil { @@ -82,6 +86,7 @@ func GetAllUsers() (result []*DingTalkUser, err error) { return } +// 官方文档:https://open.dingtalk.com/document/orgapp-server/intelligent-personnel-query-company-turnover-list // GetLeaveUserIds 获取离职人员ID列表 func GetLeaveUserIds() ([]string, error) { var ids []string diff --git a/public/client/feishu/feishu.go b/public/client/feishu/feishu.go index 0ea745c..19f081f 100644 --- a/public/client/feishu/feishu.go +++ b/public/client/feishu/feishu.go @@ -6,6 +6,7 @@ import ( "github.com/chyroc/lark" ) +// 官方文档: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/department/children // GetAllDepts 获取所有部门 func GetAllDepts() (depts []*lark.GetDepartmentListRespItem, err error) { var ( @@ -32,6 +33,7 @@ func GetAllDepts() (depts []*lark.GetDepartmentListRespItem, err error) { return } +// 官方文档: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/reference/contact-v3/user/find_by_department // GetAllUsers 获取所有员工信息 func GetAllUsers() (users []*lark.GetUserListRespItem, err error) { var ( @@ -62,6 +64,7 @@ func GetAllUsers() (users []*lark.GetUserListRespItem, err error) { return } +// 官方文档: https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/ehr/ehr-v1/employee/list // GetLeaveUserIds 获取离职人员ID列表 func GetLeaveUserIds() ([]string, error) { var ids []string diff --git a/public/client/wechat/wecom.go b/public/client/wechat/wecom.go index 8d5096a..dce6e73 100644 --- a/public/client/wechat/wecom.go +++ b/public/client/wechat/wecom.go @@ -6,6 +6,7 @@ import ( "github.com/wenerme/go-wecom/wecom" ) +// 官方文档: https://developer.work.weixin.qq.com/document/path/90208 // GetAllDepts 获取所有部门 func GetAllDepts() ([]wecom.ListDepartmentResponseItem, error) { depts, err := InitWeComClient().ListDepartment( @@ -17,6 +18,7 @@ func GetAllDepts() ([]wecom.ListDepartmentResponseItem, error) { return depts.Department, nil } +// 官方文档: https://developer.work.weixin.qq.com/document/path/90201 // GetAllUsers 获取所有员工信息 func GetAllUsers() ([]wecom.ListUserResponseItem, error) { depts, err := GetAllDepts()