mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-23 13:42:25 +08:00
feat: 企业微信-打卡-日报数据
This commit is contained in:
@@ -116,5 +116,13 @@ host: https://qyapi.weixin.qq.com/
|
|||||||
| ---------------- | -------- | --------------------- | ---------- | -------------------------- | -------- |
|
| ---------------- | -------- | --------------------- | ---------- | -------------------------- | -------- |
|
||||||
| 群机器人发送消息 | POST | /cgi-bin/webhook/send | YES | (r *Client) RobotBroadcast | chcthink |
|
| 群机器人发送消息 | POST | /cgi-bin/webhook/send | YES | (r *Client) RobotBroadcast | chcthink |
|
||||||
|
|
||||||
|
## 打卡
|
||||||
|
|
||||||
|
[官方文档](https://developer.work.weixin.qq.com/document/path/96497)
|
||||||
|
|
||||||
|
| 名称 | 请求方式 | URL | 是否已实现 | 使用方法 | 贡献者 |
|
||||||
|
| ---------------- | -------- | --------------------- | ---------- | -------------------------- |---------|
|
||||||
|
| 获取打卡日报数据 | POST | /cgi-bin/checkin/getcheckin_daydata | YES | (r *Client) GetDayData | Thinker |
|
||||||
|
|
||||||
## 应用管理
|
## 应用管理
|
||||||
TODO
|
TODO
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import (
|
|||||||
const (
|
const (
|
||||||
// getCheckinDataURL 获取打卡记录数据
|
// getCheckinDataURL 获取打卡记录数据
|
||||||
getCheckinDataURL = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckindata?access_token=%s"
|
getCheckinDataURL = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckindata?access_token=%s"
|
||||||
|
// getDayDataURL 获取打卡日报数据
|
||||||
|
getDayDataURL = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckin_daydata?access_token=%s"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -67,3 +69,124 @@ func (r *Client) GetCheckinData(req *GetCheckinDataRequest) (*GetCheckinDataResp
|
|||||||
}
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type (
|
||||||
|
// GetDayDataResponse 获取打卡日报数据
|
||||||
|
GetDayDataResponse struct {
|
||||||
|
util.CommonError
|
||||||
|
Datas []DayDataItem `json:"datas"`
|
||||||
|
}
|
||||||
|
|
||||||
|
DayDataItem struct {
|
||||||
|
BaseInfo DayBaseInfo `json:"base_info"`
|
||||||
|
SummaryInfo DaySummaryInfo `json:"summary_info"`
|
||||||
|
HolidayInfos []HolidayInfo `json:"holiday_infos"`
|
||||||
|
ExceptionInfos []ExceptionInfo `json:"exception_infos"`
|
||||||
|
OtInfo OtInfo `json:"ot_info"`
|
||||||
|
SpItems []SpItem `json:"sp_items"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DayBaseInfo 基础信息
|
||||||
|
DayBaseInfo struct {
|
||||||
|
Date int64 `json:"date"`
|
||||||
|
RecordType int64 `json:"record_type"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
NameEx string `json:"name_ex"`
|
||||||
|
DepartsName string `json:"departs_name"`
|
||||||
|
AcctId string `json:"acctid"`
|
||||||
|
DayType int64 `json:"day_type"`
|
||||||
|
RuleInfo DayRuleInfo `json:"rule_info"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CheckInTime 当日打卡时间
|
||||||
|
CheckInTime struct {
|
||||||
|
WorkSec int64 `json:"work_sec"`
|
||||||
|
OffWorkSec int64 `json:"off_work_sec"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DayRuleInfo 打卡人员所属规则信息
|
||||||
|
DayRuleInfo struct {
|
||||||
|
GroupId int64 `json:"groupid"`
|
||||||
|
GroupName string `json:"groupname"`
|
||||||
|
ScheduleId int64 `json:"scheduleid"`
|
||||||
|
ScheduleName string `json:"schedulename"`
|
||||||
|
CheckInTimes []CheckInTime `json:"checkintime"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// DaySummaryInfo 汇总信息
|
||||||
|
DaySummaryInfo struct {
|
||||||
|
CheckinCount int64 `json:"checkin_count"`
|
||||||
|
RegularWorkSec int64 `json:"regular_work_sec"`
|
||||||
|
StandardWorkSec int64 `json:"standard_work_sec"`
|
||||||
|
EarliestTime int64 `json:"earliest_time"`
|
||||||
|
LastestTime int64 `json:"lastest_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// HolidayInfo 假勤相关信息
|
||||||
|
HolidayInfo struct {
|
||||||
|
SpNumber string `json:"sp_number"`
|
||||||
|
SpTitle SpTitle `json:"sp_title"`
|
||||||
|
SpDescription SpDescription `json:"sp_description"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SpTitle 假勤信息摘要-标题信息
|
||||||
|
SpTitle struct {
|
||||||
|
Data []SpData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SpDescription 假勤信息摘要-描述信息
|
||||||
|
SpDescription struct {
|
||||||
|
Data []SpData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SpData 假勤信息(多种语言描述,目前只有中文一种)
|
||||||
|
SpData struct {
|
||||||
|
Lang string `json:"lang"`
|
||||||
|
Text string `json:"text"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SpItem 假勤统计信息
|
||||||
|
SpItem struct {
|
||||||
|
Count int64 `json:"count"`
|
||||||
|
Duration int64 `json:"duration"`
|
||||||
|
TimeType int64 `json:"time_type"`
|
||||||
|
Type int64 `json:"type"`
|
||||||
|
VacationId int64 `json:"vacation_id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExceptionInfo 校准状态信息
|
||||||
|
ExceptionInfo struct {
|
||||||
|
Count int64 `json:"count"`
|
||||||
|
Duration int64 `json:"duration"`
|
||||||
|
Exception int64 `json:"exception"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// OtInfo 加班信息
|
||||||
|
OtInfo struct {
|
||||||
|
OtStatus int64 `json:"ot_status"`
|
||||||
|
OtDuration int64 `json:"ot_duration"`
|
||||||
|
ExceptionDuration []uint64 `json:"exception_duration"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetDayData 获取打卡日报数据
|
||||||
|
// @see https://developer.work.weixin.qq.com/document/path/96498
|
||||||
|
func (r *Client) GetDayData(req *GetCheckinDataRequest) (result *GetDayDataResponse, err error) {
|
||||||
|
var (
|
||||||
|
response []byte
|
||||||
|
accessToken string
|
||||||
|
)
|
||||||
|
if accessToken, err = r.GetAccessToken(); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if response, err = util.PostJSON(fmt.Sprintf(getDayDataURL, accessToken), req); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
result = new(GetDayDataResponse)
|
||||||
|
if err = util.DecodeWithError(response, result, "GetDayData"); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user