2025-10-31 06:42:43 +00:00
|
|
|
|
// ./idl/WeatherAndEarthquake.thrift
|
|
|
|
|
|
namespace go weather_and_earthquake
|
|
|
|
|
|
|
|
|
|
|
|
struct QueryReq {
|
|
|
|
|
|
// 操作码
|
|
|
|
|
|
// 1: 默认情况,通过ip地址查看天气。此时不需要其他参数。
|
|
|
|
|
|
// 2: 通过提供的 LocationKey 查看天气。需要提供 LocationKey。
|
|
|
|
|
|
// 3: 通过地名查看天气。需要提供 Addr。
|
|
|
|
|
|
1: i32 Op (api.query="op");
|
|
|
|
|
|
2: string LocationKey (api.query="key");
|
|
|
|
|
|
3: string Addr (api.query="addr");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct QueryResp {
|
2025-11-04 03:45:51 +00:00
|
|
|
|
// 0: 成功。如果是通过ip或者locationKey查询天气,就返回当前情况和预报。
|
2025-10-31 06:42:43 +00:00
|
|
|
|
// 如果是通过地点查询,表示查到地点,并且只有一个,且通过这个key查询到了天气情况。
|
|
|
|
|
|
// -1: 参数错误
|
|
|
|
|
|
// -2: 请求头参数错误
|
|
|
|
|
|
// -3: 签名校验失败
|
|
|
|
|
|
// 1: 查询天气失败
|
|
|
|
|
|
// 2: 查询地名失败
|
|
|
|
|
|
// 3: 根据地名查询到多个地址,需要确认。
|
|
|
|
|
|
1: i32 Code;
|
|
|
|
|
|
2: string LocationKey;
|
|
|
|
|
|
3: string Locations;
|
|
|
|
|
|
4: string CurrentConditions;
|
|
|
|
|
|
5: string DailyForecasts;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
service WeatherAndEarthquakeService {
|
2025-10-31 09:23:44 +00:00
|
|
|
|
QueryResp QueryMethod(1: QueryReq request) (api.get="/query");
|
2025-10-31 06:42:43 +00:00
|
|
|
|
}
|