package service import ( "encoding/json" "net/http" ) type GetClassListRequest struct { PageIndex *int `json:"page_index,omitempty"` // 第几页,默认值1 PageSize *int `json:"page_size,omitempty"` // 每页条数,最大50条,默认值10 SearchContent *string `json:"search_content,omitempty"` // 班课名称关键字 ClassType *int `json:"class_type,omitempty"` // 班课类型:1-系列课 2-单节课,其他值表示全部 } type Class struct { Id string `json:"id"` AppId string `json:"app_id"` Title string `json:"title"` ClassType int `json:"class_type"` DisplayState int `json:"display_state"` JoinCount int `json:"join_count"` Address string `json:"address"` CoverUrl string `json:"cover_url"` } type GetClassListResponseData struct { PageInfoResponse List []Class `json:"list"` } type GetClassListResponse struct { BaseResponse Data GetClassListResponseData `json:"data"` } // MARK 获取班课列表 func (client *Client) GetClassList(req *GetClassListRequest) (*GetClassListResponse, error) { paramsMap, err := ToMap(req) if err != nil { return nil, err } respByte, err := client.CurlDo(http.MethodPost, GetClassListUrl, paramsMap) if err != nil { return nil, err } resp := GetClassListResponse{} err = json.Unmarshal(respByte, &resp) if err != nil { return nil, err } return &resp, nil }