xiaoetech/service/class.go
2026-07-30 18:11:06 +08:00

55 lines
1.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}