update
This commit is contained in:
parent
77f5465180
commit
6936f99770
|
|
@ -29,10 +29,6 @@ func QueryMethod(ctx context.Context, c *app.RequestContext) {
|
|||
logs.Info("QueryMethod req: %v", req)
|
||||
resp := new(weather_and_earthquake.QueryResp)
|
||||
switch req.Op {
|
||||
case 0:
|
||||
// 获取地震信息
|
||||
resp.Code = 0
|
||||
resp.EarthquakeInformations = biz.GetEarthquakeInfo()
|
||||
case 1:
|
||||
// 通过ip地址查天气,不需要其他参数
|
||||
ip := c.ClientIP()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import (
|
|||
|
||||
type QueryReq struct {
|
||||
// 操作码
|
||||
// 0: 查最新地震信息。
|
||||
// 1: 默认情况,通过ip地址查看天气。此时不需要其他参数。
|
||||
// 2: 通过提供的 LocationKey 查看天气。需要提供 LocationKey。
|
||||
// 3: 通过地名查看天气。需要提供 Addr。
|
||||
|
|
@ -247,7 +246,7 @@ func (p *QueryReq) String() string {
|
|||
}
|
||||
|
||||
type QueryResp struct {
|
||||
// 0: 成功。如果是地震信息,就返回地震信息。如果是通过ip或者locationKey查询天气,就返回当前情况和预报。
|
||||
// 0: 成功。如果是通过ip或者locationKey查询天气,就返回当前情况和预报。
|
||||
// 如果是通过地点查询,表示查到地点,并且只有一个,且通过这个key查询到了天气情况。
|
||||
// -1: 参数错误
|
||||
// -2: 请求头参数错误
|
||||
|
|
@ -260,7 +259,6 @@ type QueryResp struct {
|
|||
Locations string `thrift:"Locations,3" form:"Locations" json:"Locations" query:"Locations"`
|
||||
CurrentConditions string `thrift:"CurrentConditions,4" form:"CurrentConditions" json:"CurrentConditions" query:"CurrentConditions"`
|
||||
DailyForecasts string `thrift:"DailyForecasts,5" form:"DailyForecasts" json:"DailyForecasts" query:"DailyForecasts"`
|
||||
EarthquakeInformations string `thrift:"EarthquakeInformations,6" form:"EarthquakeInformations" json:"EarthquakeInformations" query:"EarthquakeInformations"`
|
||||
}
|
||||
|
||||
func NewQueryResp() *QueryResp {
|
||||
|
|
@ -290,17 +288,12 @@ func (p *QueryResp) GetDailyForecasts() (v string) {
|
|||
return p.DailyForecasts
|
||||
}
|
||||
|
||||
func (p *QueryResp) GetEarthquakeInformations() (v string) {
|
||||
return p.EarthquakeInformations
|
||||
}
|
||||
|
||||
var fieldIDToName_QueryResp = map[int16]string{
|
||||
1: "Code",
|
||||
2: "LocationKey",
|
||||
3: "Locations",
|
||||
4: "CurrentConditions",
|
||||
5: "DailyForecasts",
|
||||
6: "EarthquakeInformations",
|
||||
}
|
||||
|
||||
func (p *QueryResp) Read(iprot thrift.TProtocol) (err error) {
|
||||
|
|
@ -362,14 +355,6 @@ func (p *QueryResp) Read(iprot thrift.TProtocol) (err error) {
|
|||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
case 6:
|
||||
if fieldTypeId == thrift.STRING {
|
||||
if err = p.ReadField6(iprot); err != nil {
|
||||
goto ReadFieldError
|
||||
}
|
||||
} else if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
}
|
||||
default:
|
||||
if err = iprot.Skip(fieldTypeId); err != nil {
|
||||
goto SkipFieldError
|
||||
|
|
@ -454,17 +439,6 @@ func (p *QueryResp) ReadField5(iprot thrift.TProtocol) error {
|
|||
p.DailyForecasts = _field
|
||||
return nil
|
||||
}
|
||||
func (p *QueryResp) ReadField6(iprot thrift.TProtocol) error {
|
||||
|
||||
var _field string
|
||||
if v, err := iprot.ReadString(); err != nil {
|
||||
return err
|
||||
} else {
|
||||
_field = v
|
||||
}
|
||||
p.EarthquakeInformations = _field
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *QueryResp) Write(oprot thrift.TProtocol) (err error) {
|
||||
|
||||
|
|
@ -493,10 +467,6 @@ func (p *QueryResp) Write(oprot thrift.TProtocol) (err error) {
|
|||
fieldId = 5
|
||||
goto WriteFieldError
|
||||
}
|
||||
if err = p.writeField6(oprot); err != nil {
|
||||
fieldId = 6
|
||||
goto WriteFieldError
|
||||
}
|
||||
}
|
||||
if err = oprot.WriteFieldStop(); err != nil {
|
||||
goto WriteFieldStopError
|
||||
|
|
@ -600,23 +570,6 @@ WriteFieldEndError:
|
|||
return thrift.PrependError(fmt.Sprintf("%T write field 5 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *QueryResp) writeField6(oprot thrift.TProtocol) (err error) {
|
||||
if err = oprot.WriteFieldBegin("EarthquakeInformations", thrift.STRING, 6); err != nil {
|
||||
goto WriteFieldBeginError
|
||||
}
|
||||
if err := oprot.WriteString(p.EarthquakeInformations); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = oprot.WriteFieldEnd(); err != nil {
|
||||
goto WriteFieldEndError
|
||||
}
|
||||
return nil
|
||||
WriteFieldBeginError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 6 begin error: ", p), err)
|
||||
WriteFieldEndError:
|
||||
return thrift.PrependError(fmt.Sprintf("%T write field 6 end error: ", p), err)
|
||||
}
|
||||
|
||||
func (p *QueryResp) String() string {
|
||||
if p == nil {
|
||||
return "<nil>"
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
package biz
|
||||
|
||||
var _earthquakeInfo string
|
||||
|
||||
func GetEarthquakeInfo() string {
|
||||
return _earthquakeInfo
|
||||
}
|
||||
Loading…
Reference in New Issue