From 6936f997707a321771c99f36cc960231a6aa7e4c Mon Sep 17 00:00:00 2001 From: pengyinjie Date: Tue, 4 Nov 2025 11:47:54 +0800 Subject: [PATCH] update --- .../weather_and_earthquake_service.go | 4 -- .../WeatherAndEarthquake.go | 59 ++----------------- internal/biz/earthquake.go | 7 --- 3 files changed, 6 insertions(+), 64 deletions(-) delete mode 100644 internal/biz/earthquake.go diff --git a/biz/handler/weather_and_earthquake/weather_and_earthquake_service.go b/biz/handler/weather_and_earthquake/weather_and_earthquake_service.go index 0599be2..7d36140 100644 --- a/biz/handler/weather_and_earthquake/weather_and_earthquake_service.go +++ b/biz/handler/weather_and_earthquake/weather_and_earthquake_service.go @@ -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() diff --git a/biz/model/weather_and_earthquake/WeatherAndEarthquake.go b/biz/model/weather_and_earthquake/WeatherAndEarthquake.go index 093a582..c3e4d8d 100644 --- a/biz/model/weather_and_earthquake/WeatherAndEarthquake.go +++ b/biz/model/weather_and_earthquake/WeatherAndEarthquake.go @@ -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: 请求头参数错误 @@ -255,12 +254,11 @@ type QueryResp struct { // 1: 查询天气失败 // 2: 查询地名失败 // 3: 根据地名查询到多个地址,需要确认。 - Code int32 `thrift:"Code,1" form:"Code" json:"Code" query:"Code"` - LocationKey string `thrift:"LocationKey,2" form:"LocationKey" json:"LocationKey" query:"LocationKey"` - 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"` + Code int32 `thrift:"Code,1" form:"Code" json:"Code" query:"Code"` + LocationKey string `thrift:"LocationKey,2" form:"LocationKey" json:"LocationKey" query:"LocationKey"` + 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"` } 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 "" diff --git a/internal/biz/earthquake.go b/internal/biz/earthquake.go deleted file mode 100644 index 925df3d..0000000 --- a/internal/biz/earthquake.go +++ /dev/null @@ -1,7 +0,0 @@ -package biz - -var _earthquakeInfo string - -func GetEarthquakeInfo() string { - return _earthquakeInfo -}