55 lines
2.0 KiB
Go
55 lines
2.0 KiB
Go
package service
|
||
|
||
import (
|
||
"encoding/json"
|
||
"net/http"
|
||
)
|
||
|
||
type GetCampTaskListRequest struct {
|
||
TermId string `json:"term_id"` // 营期 ID
|
||
}
|
||
|
||
type GetCampTaskListResponseData struct {
|
||
AppId string `json:"app_id"` // 店铺 ID
|
||
CampId string `json:"camp_id"` // 训练营 ID
|
||
TermId string `json:"term_id"` // 营期 ID
|
||
Id string `json:"id"` // 节点 ID
|
||
Type int `json:"type"` // 节点类型 0-章节 1-学习任务
|
||
Pid string `json:"pid"` // 学习任务对应的章节ID,0-代表该节点为章节
|
||
Title string `json:"title"` // 节点名称
|
||
ResourceId string `json:"resource_id"` // 学习任务资源 ID,为空代表为章节
|
||
ResourceType int `json:"resource_type"` // 学习任务资源类型,为-1代表为章节
|
||
IsTry int `json:"is_try"` // 学习任务资源是否试看,0-不试看 1-试看
|
||
OrderWeight int `json:"order_weight"` // 排序,排在第几位
|
||
NeedPush int `json:"need_push"` // 是否推送:0-不推送,1-推送
|
||
UnlockTime string `json:"unlock_time"` // 节点的解锁时间(营期为日期解锁时间),也是节点解锁的通知时间
|
||
PushState int `json:"push_state"` // 推送状态:0-等待推送 1-推送中 2-推送成功 3-推送失败
|
||
CreatedAt string `json:"created_at"` // 创建时间
|
||
UpdatedAt string `json:"updated_at"` // 更新时间
|
||
}
|
||
|
||
type GetCampTaskListResponse struct {
|
||
BaseResponse
|
||
Data GetCampTaskListResponseData `json:"data"`
|
||
}
|
||
|
||
// MARK 获取训练营营期任务
|
||
func (client *Client) GetCampTaskList(req *GetCampTaskListRequest) (*GetCampTaskListResponse, error) {
|
||
paramsMap, err := ToMap(req)
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
|
||
respByte, err := client.CurlDo(http.MethodPost, GetCampTaskListURL, paramsMap)
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
resp := GetCampTaskListResponse{}
|
||
err = json.Unmarshal(respByte, &resp)
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
return &resp, nil
|
||
|
||
}
|