You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/service/nldyp/partner.data4.getCityLists.go

43 lines
1.5 KiB

1 year ago
package nldyp
import (
"context"
1 year ago
"github.com/dtapps/go-library/utils/gojson"
"github.com/dtapps/go-library/utils/gorequest"
)
type PartnerData4GetCityListsResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data []struct {
Id string `json:"id"` // 城市ID
CityName string `json:"city_name"` // 城市名
Letter string `json:"letter"` // 首字母
Hot int `json:"hot"` // 是否热门0 否 1 是
} `json:"data"`
}
type PartnerData4GetCityListsResult struct {
Result PartnerData4GetCityListsResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
Err error // 错误
}
func newPartnerData4GetCityListsResult(result PartnerData4GetCityListsResponse, body []byte, http gorequest.Response, err error) *PartnerData4GetCityListsResult {
return &PartnerData4GetCityListsResult{Result: result, Body: body, Http: http, Err: err}
}
// PartnerData4GetCityLists 获取城市
// https://docs.apipost.cn/preview/fa101f4865dc783f/66e7c2e894fda4a6?target_id=d8842641-00bd-4bb4-a031-fb6d89908742
func (c *Client) PartnerData4GetCityLists(ctx context.Context) *PartnerData4GetCityListsResult {
// 参数
params := gorequest.NewParams()
// 请求
request, err := c.request(ctx, apiUrl+"/partner/data4/getCityLists", params)
// 定义
var response PartnerData4GetCityListsResponse
1 year ago
err = gojson.Unmarshal(request.ResponseBody, &response)
return newPartnerData4GetCityListsResult(response, request.ResponseBody, request, err)
}