Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) ConfigApiGormFun(apiClientFun golog.ApiGormFun)
- func (c *Client) Forecast7d(ctx context.Context, city string, notMustParams ...gorequest.Params) (*Forecast7dResult, error)
- func (c *Client) Observe(ctx context.Context, city string, notMustParams ...gorequest.Params) (*ObserveResult, error)
- type Forecast7dResponse
- type Forecast7dResult
- type ObserveResponse
- type ObserveResult
Constants ¶
View Source
const (
LogTable = "yytianqi"
)
View Source
const (
Version = "1.0.0"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ConfigApiGormFun ¶
func (c *Client) ConfigApiGormFun(apiClientFun golog.ApiGormFun)
ConfigApiGormFun 接口日志配置
func (*Client) Forecast7d ¶
func (c *Client) Forecast7d(ctx context.Context, city string, notMustParams ...gorequest.Params) (*Forecast7dResult, error)
Forecast7d 7天预报 http://www.yytianqi.com/api.html
type Forecast7dResponse ¶
type Forecast7dResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Counts int `json:"counts"` // 访问的剩余次数
Data struct {
CityId string `json:"cityId"` // 城市id
CityName string `json:"cityName"` // 城市名称
Sj string `json:"sj"` // 数据更新时间
List []struct {
Tq1 string `json:"tq1"` // 白天天气
Tq2 string `json:"tq2"` // 夜间天气,当与白天天气相同时,两者可合并为一个
Numtq1 string `json:"numtq1"` // 白天天气编码
Numtq2 string `json:"numtq2"` // 夜间天气编码
Qw1 interface{} `json:"qw1"` // 白天气温
Qw2 interface{} `json:"qw2"` // 夜间气温
Fl1 string `json:"fl1"` // 白天风力
Fl2 string `json:"fl2"` // 夜间风力
Numfl1 string `json:"numfl1"` // 白天风力编码
Numfl2 string `json:"numfl2"` // 夜间风力编码
Fx1 string `json:"fx1"` // 白天风向
Fx2 string `json:"fx2"` // 夜间风向,如白天风力风向与夜间风力风向一致,可合并为一行
Numfx1 string `json:"numfx1"` // 白天风向编码
Numfx2 string `json:"numfx2"` // 夜间风向编码
Date string `json:"date"` // 预报日期
} `json:"list"`
} `json:"data"`
}
type Forecast7dResult ¶
type Forecast7dResult struct {
Result Forecast7dResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
}
type ObserveResponse ¶
type ObserveResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Counts int `json:"counts"` // 访问的剩余次数
Data struct {
CityId string `json:"cityId"` // 城市id
CityName string `json:"cityName"` // 城市名称
LastUpdate string `json:"lastUpdate"` // 实况更新时间
Tq string `json:"tq"` // 天气现象
Numtq interface{} `json:"numtq"` // 天气现象编码
Qw string `json:"qw"` // 当前气温
Fl string `json:"fl"` // 当前风力
Numfl interface{} `json:"numfl"` // 当前风力编码
Fx string `json:"fx"` // 当前风向
Numfx interface{} `json:"numfx"` // 当前风向编码
Sd string `json:"sd"` // 相对湿度,直接在此数值后添加%即可
} `json:"data"`
}
type ObserveResult ¶
type ObserveResult struct {
Result ObserveResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
}
Click to show internal directories.
Click to hide internal directories.