|
@@ -1,9 +1,8 @@
|
|
|
-package xnet
|
|
|
|
|
|
|
+package cmd
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"encoding/json"
|
|
"encoding/json"
|
|
|
"fmt"
|
|
"fmt"
|
|
|
- "gcore/core"
|
|
|
|
|
"log"
|
|
"log"
|
|
|
"net/http"
|
|
"net/http"
|
|
|
"strings"
|
|
"strings"
|
|
@@ -36,6 +35,7 @@ type DingTalkConf struct {
|
|
|
// @description 获取access token
|
|
// @description 获取access token
|
|
|
// @param
|
|
// @param
|
|
|
// @return
|
|
// @return
|
|
|
|
|
+
|
|
|
func (m *DingTalkConf) GetToken() error {
|
|
func (m *DingTalkConf) GetToken() error {
|
|
|
params := map[string]string{"appkey": m.AppKey, "appsecret": m.AppSecret}
|
|
params := map[string]string{"appkey": m.AppKey, "appsecret": m.AppSecret}
|
|
|
content, err := GetX(m.GetTokenUrl, "", params, m.Headers, m.Cookie)
|
|
content, err := GetX(m.GetTokenUrl, "", params, m.Headers, m.Cookie)
|
|
@@ -87,6 +87,7 @@ func (m *DingTalkConf) GetHolidayType() (err error) {
|
|
|
// @description 获取部门列表,只支持查询下一级子部门 https://developers.dingtalk.com/document/app/obtain-the-department-list-v2
|
|
// @description 获取部门列表,只支持查询下一级子部门 https://developers.dingtalk.com/document/app/obtain-the-department-list-v2
|
|
|
// @param
|
|
// @param
|
|
|
// @return
|
|
// @return
|
|
|
|
|
+
|
|
|
func (m *DingTalkConf) GetDeptList(deptId int64) ([]interface{}, error) {
|
|
func (m *DingTalkConf) GetDeptList(deptId int64) ([]interface{}, error) {
|
|
|
result := []interface{}{}
|
|
result := []interface{}{}
|
|
|
PostData := make(map[string]interface{})
|
|
PostData := make(map[string]interface{})
|
|
@@ -136,6 +137,7 @@ func (m *DingTalkConf) GetDeptList(deptId int64) ([]interface{}, error) {
|
|
|
// @description 获取部门成员的姓名和userid https://developers.dingtalk.com/document/app/queries-the-simple-information-of-a-department-user
|
|
// @description 获取部门成员的姓名和userid https://developers.dingtalk.com/document/app/queries-the-simple-information-of-a-department-user
|
|
|
// @param
|
|
// @param
|
|
|
// @return
|
|
// @return
|
|
|
|
|
+
|
|
|
func (m *DingTalkConf) GetDeptUserList(deptId int64) (map[string]string, error) {
|
|
func (m *DingTalkConf) GetDeptUserList(deptId int64) (map[string]string, error) {
|
|
|
cursor := 0.0
|
|
cursor := 0.0
|
|
|
size := 100
|
|
size := 100
|
|
@@ -204,6 +206,7 @@ func (m *DingTalkConf) GetDeptUserList(deptId int64) (map[string]string, error)
|
|
|
// @description 批量获取考勤组摘要 https://developers.dingtalk.com/document/app/batch-query-of-simple-information-of-the-attendance-group
|
|
// @description 批量获取考勤组摘要 https://developers.dingtalk.com/document/app/batch-query-of-simple-information-of-the-attendance-group
|
|
|
// @param
|
|
// @param
|
|
|
// @return
|
|
// @return
|
|
|
|
|
+
|
|
|
func (m *DingTalkConf) GetAttendanceGroup() ([]map[string]interface{}, error) {
|
|
func (m *DingTalkConf) GetAttendanceGroup() ([]map[string]interface{}, error) {
|
|
|
groupData := []map[string]interface{}{}
|
|
groupData := []map[string]interface{}{}
|
|
|
|
|
|
|
@@ -261,12 +264,13 @@ func (m *DingTalkConf) GetAttendanceGroup() ([]map[string]interface{}, error) {
|
|
|
// @description 获取7天内的指定时间段成员的打卡记录, https://developers.dingtalk.com/document/app/open-attendance-clock-in-data
|
|
// @description 获取7天内的指定时间段成员的打卡记录, https://developers.dingtalk.com/document/app/open-attendance-clock-in-data
|
|
|
// @param days获取多少天内的考勤数据
|
|
// @param days获取多少天内的考勤数据
|
|
|
// @return
|
|
// @return
|
|
|
|
|
+
|
|
|
func (m *DingTalkConf) GetAttendanceClockData(days int, userIdList []string) (map[string][]int, error) {
|
|
func (m *DingTalkConf) GetAttendanceClockData(days int, userIdList []string) (map[string][]int, error) {
|
|
|
|
|
|
|
|
limit := 50 //表示获取考勤数据的条数,最大不能超过50条。
|
|
limit := 50 //表示获取考勤数据的条数,最大不能超过50条。
|
|
|
userIdStep := 50 //单次请求传入的userId数量
|
|
userIdStep := 50 //单次请求传入的userId数量
|
|
|
//最近30天日期数组
|
|
//最近30天日期数组
|
|
|
- workData, _ := core.GetWorkDate(days)
|
|
|
|
|
|
|
+ workData, _ := GetWorkDate(days)
|
|
|
fmt.Printf("workData lenght %v\n", len(workData))
|
|
fmt.Printf("workData lenght %v\n", len(workData))
|
|
|
//post请求的body
|
|
//post请求的body
|
|
|
PostData := make(map[string]interface{})
|
|
PostData := make(map[string]interface{})
|
|
@@ -361,6 +365,7 @@ func (m *DingTalkConf) GetAttendanceClockData(days int, userIdList []string) (ma
|
|
|
// @description 获取考勤组列表, https://developers.dingtalk.com/document/app/queries-attendance-group-list-details
|
|
// @description 获取考勤组列表, https://developers.dingtalk.com/document/app/queries-attendance-group-list-details
|
|
|
// @param
|
|
// @param
|
|
|
// @return map[5.5天制管理人员:753150009 5天制:761355305 6天制员工:667040040 合肥1:721640063 合肥6天制:795345194 清洁:854690013 音乐:761855162]
|
|
// @return map[5.5天制管理人员:753150009 5天制:761355305 6天制员工:667040040 合肥1:721640063 合肥6天制:795345194 清洁:854690013 音乐:761855162]
|
|
|
|
|
+
|
|
|
func (m *DingTalkConf) GetAttendanceGroupDetails() (map[int64]string, error) {
|
|
func (m *DingTalkConf) GetAttendanceGroupDetails() (map[int64]string, error) {
|
|
|
PostData := make(map[string]interface{})
|
|
PostData := make(map[string]interface{})
|
|
|
PostData["offset"] = 0
|
|
PostData["offset"] = 0
|
|
@@ -391,6 +396,7 @@ func (m *DingTalkConf) GetAttendanceGroupDetails() (map[int64]string, error) {
|
|
|
// @description 考勤组成员校验 , https://developers.dingtalk.com/document/app/query-members-by-id
|
|
// @description 考勤组成员校验 , https://developers.dingtalk.com/document/app/query-members-by-id
|
|
|
// @param
|
|
// @param
|
|
|
// @return
|
|
// @return
|
|
|
|
|
+
|
|
|
func (m *DingTalkConf) ListAttendanceGroupMenberListByIds(groupId int64, userIdList []string) ([]string, error) {
|
|
func (m *DingTalkConf) ListAttendanceGroupMenberListByIds(groupId int64, userIdList []string) ([]string, error) {
|
|
|
PostData := make(map[string]interface{})
|
|
PostData := make(map[string]interface{})
|
|
|
PostData["op_user_id"] = m.OpUserId
|
|
PostData["op_user_id"] = m.OpUserId
|