1 Star 0 Fork 0

taadis / aikucun-sdk-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
activity_list.go 1.60 KB
一键复制 编辑 原始数据 按行查看 历史
taadis 提交于 2020-09-12 17:11 . use json.NewEncoder
package aikucun
import (
"bytes"
"encoding/json"
"net/http"
"strconv"
)
type ActivityListRequest struct {
//BaseRequest
Status int `json:"status,omitempty"`
}
func (request *ActivityListRequest) Method() string {
return http.MethodGet
}
func (request *ActivityListRequest) Path() string {
return "/api/v2/activity/list"
}
func (request *ActivityListRequest) Params() map[string]interface{} {
m := make(map[string]interface{})
m["status"] = strconv.Itoa(request.Status)
return m
}
type ActivityListResponse struct {
BaseResponse
Data struct {
Size int `json:"size"`
List []struct {
Id string `json:"id"`
No string `json:"no"`
Name string `json:"name"`
CorpId string `json:"corpid"`
CorpName string `json:"corpname"`
BrandId string `json:"brandid"`
BrandName string `json:"brandname"`
BeginTime string `json:"begintime"`
EndTime string `json:"endtime"`
AfterSaleTime string `json:"aftersaletime"`
} `json:"list"`
} `json:"data"`
}
// NewActivityListRequest
func NewActivityListRequest() *ActivityListRequest {
return new(ActivityListRequest)
}
//
func (resp *ActivityListResponse) String() string {
//buf, _ := json.Marshal(resp)
//return string(buf)
//buf := bytes.NewBuffer([]byte(""))
buf := &bytes.Buffer{}
err := json.NewEncoder(buf).Encode(resp)
if err != nil {
panic(err)
}
return buf.String()
}
// ActivityList
func (client *Client) ActivityList(request *ActivityListRequest) (response *ActivityListResponse, err error) {
response = &ActivityListResponse{}
err = client.Do(request, response)
return
}
Go
1
https://gitee.com/taadis/aikucun-sdk-go.git
git@gitee.com:taadis/aikucun-sdk-go.git
taadis
aikucun-sdk-go
aikucun-sdk-go
master

搜索帮助