-
-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Description
Describe the bug
我想获取最近离职的员工,通过 StartTime 和 EndTime 参数时获取的离职员工并没有我想要的离职人员。
To Reproduce
package main
import (
"context"
"fmt"
"github.com/alibabacloud-go/tea/tea"
"github.com/chyroc/lark"
)
func InitFeiShuClient() *lark.Lark {
return lark.New(lark.WithAppCredential(
"cli_xxxxx",
"xxxxxxxx",
))
}
// GetLeaveUserIds 获取最近1周前的离职人员ID列表
func GetLeaveUserIds() {
var ids []string
users, _, err := InitFeiShuClient().EHR.GetEHREmployeeList(context.TODO(), &lark.GetEHREmployeeListReq{
Status: []int64{5},
UserIDType: lark.IDTypePtr(lark.IDTypeUnionID), // 只查询unionID
StartTime: tea.String("1709222400000"), //2024-03-01 00:00:00 000
EndTime: tea.String("1710691200000"), //2024-03-18 00:00:00 000
})
if err != nil {
fmt.Println(err)
}
for _, user := range users.Items {
ids = append(ids, user.UserID, user.SystemFields.LastDay)
}
fmt.Println(ids)
}
// GetLeaveUserIds 通过指定UnionID获取离职人员ID列表
func GetLeaveUserName() {
var ids []string
users, _, err := InitFeiShuClient().EHR.GetEHREmployeeList(context.TODO(), &lark.GetEHREmployeeListReq{
View: tea.String("full"),
Status: []int64{5},
UserIDType: lark.IDTypePtr(lark.IDTypeUnionID), // 只查询unionID
UserIDs: []string{"on_14e8878b82af423707ea1f0c457aba39"},
})
if err != nil {
fmt.Println(err)
}
for _, user := range users.Items {
ids = append(ids, user.UserID, user.SystemFields.LastDay) //打印用户UnionID 和离职时间
}
fmt.Println(ids)
}
func main() {
GetLeaveUserIds()
GetLeaveUserName()
}
输出结果:
// 函数GetLeaveUserIds执行结果
[on_8722b156f76f5a7c3fdfae799bb855c8 on_4b54f4bdd77c2bf70096972c5628174b on_780750292cec2a66c1e5df622a8ab100 on_2bb99bcec16419eb960dce8b33ab9040 on_afebd56d5af3285abcb4fb43226f2207 on_574461a06d803064c3a2868df3814712 on_853e7db3fff051a9d40d2ff02d52f9ec ]
// GetLeaveUserName 执行结果
[on_14e8878b82af423707ea1f0c457aba39 2024-03-15]
Expected behavior
我想通过GetLeaveUserIds函数获取到on_14e8878b82af423707ea1f0c457aba39 这个 UnionID 的用户 。 而且我并不清楚GetEHREmployeeListReq现在的StartTime 和 EndTime 参数指定的是用户的离职时间还是入职时间。或者有其他更加方便的方式获取最近的离职用户吗?
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels