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.
29 lines
723 B
29 lines
723 B
package hefengweather_test
|
|
|
|
import (
|
|
"yunyan/sys/hefengweather"
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func Test_Sys(t *testing.T) {
|
|
if sys, err := hefengweather.NewSys(
|
|
hefengweather.SetBaseUrl("https://mf6apvd72m.re.qweatherapi.com"),
|
|
hefengweather.SetKey("525e6198b9f846608dbfae43758ff8c4"),
|
|
); err != nil {
|
|
fmt.Printf("Sys Init err:%v", err)
|
|
} else {
|
|
// xal, _ := axml.NewSys()
|
|
result, err := sys.CityLookup("武汉")
|
|
if err != nil && result.Code != "200" {
|
|
fmt.Printf("CityLookup err:%v", err)
|
|
return
|
|
}
|
|
result1, err := sys.QueryWeather(result.Location[0].ID)
|
|
if err != nil && result.Code != "200" {
|
|
fmt.Printf("QueryWeather err:%v", err)
|
|
return
|
|
}
|
|
fmt.Printf(" result:%v err:%v", result1, err)
|
|
}
|
|
}
|
|
|