revert: remove duplicate GetVacationQuota from app_checkin
This commit is contained in:
parent
67e974de0e
commit
c9341af4aa
|
|
@ -225,34 +225,3 @@ func (q *AppCheckin) GetCheckinDataV2(startDay, endDay string, userIds []string)
|
|||
|
||||
return userDatas, nil
|
||||
}
|
||||
|
||||
type VacationQuota struct {
|
||||
VacationName string `json:"vacation_name"`
|
||||
LeftQuota int64 `json:"left_quota"`
|
||||
UsedQuota int64 `json:"used_quota"`
|
||||
TotalQuota int64 `json:"total_quota"`
|
||||
}
|
||||
|
||||
func (q *AppCheckin) GetVacationQuota(userid string) ([]*VacationQuota, error) {
|
||||
reqUrl := fmt.Sprintf("https://qyapi.weixin.qq.com/cgi-bin/checkin/getvacationquota?access_token=%s", q.GetToken())
|
||||
reqParam := fmt.Sprintf(`{"userid":"%s"}`, userid)
|
||||
rspBody, err := util.HttpPostJson(reqUrl, nil, []byte(reqParam))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
g := gjson.ParseBytes(rspBody)
|
||||
if g.Get("errcode").Int() != 0 {
|
||||
return nil, fmt.Errorf("%d:%s", g.Get("errcode").Int(), g.Get("errmsg").String())
|
||||
}
|
||||
items := make([]*VacationQuota, 0)
|
||||
for _, v := range g.Get("lists").Array() {
|
||||
item := &VacationQuota{
|
||||
VacationName: v.Get("vacation_name").String(),
|
||||
LeftQuota: v.Get("left_quota").Int(),
|
||||
UsedQuota: v.Get("used_quota").Int(),
|
||||
TotalQuota: v.Get("total_quota").Int(),
|
||||
}
|
||||
items = append(items, item)
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue