Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法获取一段时间内员工状态为离职的用户 #89

Open
ixiaoyi93 opened this issue Mar 18, 2024 · 5 comments
Open

无法获取一段时间内员工状态为离职的用户 #89

ixiaoyi93 opened this issue Mar 18, 2024 · 5 comments

Comments

@ixiaoyi93
Copy link

ixiaoyi93 commented Mar 18, 2024

Describe the bug
我想获取最近离职的员工,通过 StartTimeEndTime 参数时获取的离职员工并没有我想要的离职人员。

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现在的StartTimeEndTime 参数指定的是用户的离职时间还是入职时间。或者有其他更加方便的方式获取最近的离职用户吗?

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Copy link

🙏, thanks for your issue.

@chyroc
Copy link
Owner

chyroc commented Mar 18, 2024

可以搜索【飞书技术支持服务台】进行咨询。

@ixiaoyi93
Copy link
Author

可以搜索【飞书技术支持服务台】进行咨询。

哪里搜索,没有找到呢

@chyroc
Copy link
Owner

chyroc commented Mar 19, 2024

  1. 如果您的企业是付费企业,可以参考这个文档开通飞书技术支持服务台: https://bytedance.larkoffice.com/docs/doccnBeU1OC1NZez5oBmML8FYDc
  2. 如果您的企业不满足开通要求,可以参考这个文档进入飞书开发互助寻求帮助:https://bytedance.larkoffice.com/docx/T0Krdi1iXoGC6exDkQycgzKvngh
  3. 我并非飞书员工,本条回答不保证正确性。我在飞书技术支持服务台内咨询了这个问题,他们给出的答案是:“这个时间是获取对应数据周期的时间,不是说离职对应的时间和入职对应的时间”,具体什么意思还在咨询。

@ixiaoyi93
Copy link
Author

  1. 如果您的企业是付费企业,可以参考这个文档开通飞书技术支持服务台: https://bytedance.larkoffice.com/docs/doccnBeU1OC1NZez5oBmML8FYDc
  2. 如果您的企业不满足开通要求,可以参考这个文档进入飞书开发互助寻求帮助:https://bytedance.larkoffice.com/docx/T0Krdi1iXoGC6exDkQycgzKvngh
  3. 我并非飞书员工,本条回答不保证正确性。我在飞书技术支持服务台内咨询了这个问题,他们给出的答案是:“这个时间是获取对应数据周期的时间,不是说离职对应的时间和入职对应的时间”,具体什么意思还在咨询。

好的,感谢老哥(其实我还是没有懂这个时间是啥意思)。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants