From de2cdd389beb0df80e33c22a5733e6ed9b3dbf6c Mon Sep 17 00:00:00 2001 From: willem <18710090979@163.com> Date: Tue, 26 Mar 2024 13:55:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=201.=20=E5=88=A0=E9=99=A4=E5=BC=80?= =?UTF-8?q?=E6=BA=90=E7=89=88=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../envirotronics/env_device_tree.go | 22 --- .../controller/envirotronics/env_weather.go | 156 ------------------ internal/logic/product/dev_device_test.go | 9 - 3 files changed, 187 deletions(-) delete mode 100644 internal/controller/envirotronics/env_device_tree.go delete mode 100644 internal/controller/envirotronics/env_weather.go diff --git a/internal/controller/envirotronics/env_device_tree.go b/internal/controller/envirotronics/env_device_tree.go deleted file mode 100644 index 8c95b80..0000000 --- a/internal/controller/envirotronics/env_device_tree.go +++ /dev/null @@ -1,22 +0,0 @@ -package envirotronics - -import ( - "context" - "sagooiot/api/v1/envirotronics" - "sagooiot/internal/service" -) - -var EnvDeviceTree = cEnvDeviceTree{} - -type cEnvDeviceTree struct{} - -func (c *cEnvDeviceTree) Statistic(ctx context.Context, req *envirotronics.EnvDeviceTreeStatisticReq) (res *envirotronics.EnvDeviceTreeStatisticRes, err error) { - out, err := service.EnvDeviceTree().Statistic(ctx, req.EnvDeviceTreeStatisticInput) - if err != nil { - return - } - res = &envirotronics.EnvDeviceTreeStatisticRes{ - EnvDeviceTreeStatisticOutput: out, - } - return -} diff --git a/internal/controller/envirotronics/env_weather.go b/internal/controller/envirotronics/env_weather.go deleted file mode 100644 index 2585b9e..0000000 --- a/internal/controller/envirotronics/env_weather.go +++ /dev/null @@ -1,156 +0,0 @@ -package envirotronics - -import ( - "context" - "github.com/gogf/gf/v2/util/gconv" - "sagooiot/api/v1/envirotronics" - "sagooiot/internal/model" - "sagooiot/internal/service" -) - -var Weather = cWeather{} - -type cWeather struct{} - -// CityWeatherList 获取城市的风力及日照时长 -func (a *cWeather) CityWeatherList(ctx context.Context, req *envirotronics.CityWeatherListReq) (res *envirotronics.CityWeatherListRes, err error) { - out, err := service.EnvWeather().CityWeatherList(ctx) - if err != nil { - return - } - var cityWeatherListRes []*model.CityWeatherListRes - if out != nil { - if err = gconv.Scan(out, &cityWeatherListRes); err != nil { - return - } - } - res = &envirotronics.CityWeatherListRes{ - Info: cityWeatherListRes, - } - return -} - -// GetCityWeatherById 根据ID获取指定城市的天气 -func (a *cWeather) GetCityWeatherById(ctx context.Context, req *envirotronics.GetCityWeatherByIdReq) (res *envirotronics.GetCityWeatherByIdRes, err error) { - out, err := service.EnvWeather().GetCityWeatherById(ctx, req.Id) - if err != nil { - return - } - var cityWeatherListRes *model.CityWeatherListRes - if out != nil { - if err = gconv.Scan(out, &cityWeatherListRes); err != nil { - return - } - } - - res = &envirotronics.GetCityWeatherByIdRes{ - Info: cityWeatherListRes, - } - return -} - -// GetCityTemperatureById 根据ID获取指定城市的温度图表 -func (a *cWeather) GetCityTemperatureById(ctx context.Context, req *envirotronics.GetCityTemperatureByIdReq) (res *envirotronics.GetCityTemperatureByIdRes, err error) { - cityWeatherEchartOut, avgCityWeatherEchartOut, foreCastCityWeatherHighEchartOut, foreCastCityWeatherLowEchartOut, err := service.EnvWeather().GetCityTemperatureById(ctx, req.Id, req.Types) - if err != nil { - return - } - var cityWeatherEchartRes []*model.CityWeatherEchartRes - if cityWeatherEchartOut != nil { - if err = gconv.Scan(cityWeatherEchartOut, &cityWeatherEchartRes); err != nil { - return - } - } - var avgCityWeatherEchartRes []*model.CityWeatherEchartRes - if avgCityWeatherEchartOut != nil { - if err = gconv.Scan(avgCityWeatherEchartOut, &avgCityWeatherEchartRes); err != nil { - return - } - } - var foreCastCityWeatherHighEchartRes []*model.CityWeatherEchartRes - if foreCastCityWeatherHighEchartOut != nil { - if err = gconv.Scan(foreCastCityWeatherHighEchartOut, &foreCastCityWeatherHighEchartRes); err != nil { - return - } - } - var foreCastCityWeatherLowEchartRes []*model.CityWeatherEchartRes - if foreCastCityWeatherLowEchartOut != nil { - if err = gconv.Scan(foreCastCityWeatherLowEchartOut, &foreCastCityWeatherLowEchartRes); err != nil { - return - } - } - res = &envirotronics.GetCityTemperatureByIdRes{ - Info: cityWeatherEchartRes, - AvgInfo: avgCityWeatherEchartRes, - ForeCastHighInfo: foreCastCityWeatherHighEchartRes, - ForeCastLowInfo: foreCastCityWeatherLowEchartRes, - } - return -} - -// GetCityWindpowerById 根据ID获取指定城市的风力图表 -func (a *cWeather) GetCityWindpowerById(ctx context.Context, req *envirotronics.GetCityWindpowerByIdReq) (res *envirotronics.GetCityWindpowerByIdRes, err error) { - cityWeatherEchartOut, avgCityWeatherEchartOut, foreCastCityWeatherEchartOut, foreCastAvgCityWeatherEchartOut, err := service.EnvWeather().GetCityWindpowerById(ctx, req.Id, req.Types) - if err != nil { - return - } - var cityWeatherEchartRes []*model.CityWeatherEchartRes - if cityWeatherEchartOut != nil { - if err = gconv.Scan(cityWeatherEchartOut, &cityWeatherEchartRes); err != nil { - return - } - } - var avgCityWeatherEchartRes []*model.CityWeatherEchartRes - if avgCityWeatherEchartOut != nil { - if err = gconv.Scan(avgCityWeatherEchartOut, &avgCityWeatherEchartRes); err != nil { - return - } - } - var foreCastCityWeatherEchartRes []*model.CityWeatherEchartRes - if foreCastCityWeatherEchartOut != nil { - if err = gconv.Scan(foreCastCityWeatherEchartOut, &foreCastCityWeatherEchartRes); err != nil { - return - } - } - var foreCastAvgCityWeatherEchartRes []*model.CityWeatherEchartRes - if foreCastAvgCityWeatherEchartOut != nil { - if err = gconv.Scan(foreCastAvgCityWeatherEchartOut, &foreCastAvgCityWeatherEchartRes); err != nil { - return - } - } - res = &envirotronics.GetCityWindpowerByIdRes{ - Info: cityWeatherEchartRes, - AvgInfo: avgCityWeatherEchartRes, - ForeCastInfo: foreCastCityWeatherEchartRes, - ForeCastAvgInfo: foreCastAvgCityWeatherEchartRes, - } - return -} - -// GetCityWeatherHistoryById 根据ID获取指定城市的天气历史数据 -func (a *cWeather) GetCityWeatherHistoryById(ctx context.Context, req *envirotronics.GetCityWeatherHistoryByIdReq) (res *envirotronics.GetCityWeatherHistoryByIdRes, err error) { - out, err := service.EnvWeather().GetCityWeatherHistoryById(ctx, req.Id, req.DateTime) - if err != nil { - return - } - var cityWeatherHistoryListRes []*model.CityWeatherHistoryListRes - if out != nil { - if err = gconv.Scan(out, &cityWeatherHistoryListRes); err != nil { - return - } - } - - res = &envirotronics.GetCityWeatherHistoryByIdRes{ - Info: cityWeatherHistoryListRes, - } - return -} - -// GetCityWeatherHistoryByIdExport 根据ID获取指定城市的天气历史数据导出 -func (a *cWeather) GetCityWeatherHistoryByIdExport(ctx context.Context, req *envirotronics.GetCityWeatherHistoryByIdExportReq) (res *envirotronics.GetCityWeatherHistoryByIdExportRes, err error) { - err = service.EnvWeather().GetCityWeatherHistoryByIdExport(ctx, req.Id, req.DateTime) - if err != nil { - return - } - return -} diff --git a/internal/logic/product/dev_device_test.go b/internal/logic/product/dev_device_test.go index 8673645..39b8dc5 100644 --- a/internal/logic/product/dev_device_test.go +++ b/internal/logic/product/dev_device_test.go @@ -4,19 +4,10 @@ import ( "context" _ "sagooiot/internal/logic/alarm" _ "sagooiot/internal/logic/common" - _ "sagooiot/internal/logic/configure" _ "sagooiot/internal/logic/context" - _ "sagooiot/internal/logic/datahub" - _ "sagooiot/internal/logic/dataview" - _ "sagooiot/internal/logic/envirotronics" - _ "sagooiot/internal/logic/gentools" _ "sagooiot/internal/logic/middleware" _ "sagooiot/internal/logic/network" _ "sagooiot/internal/logic/notice" - _ "sagooiot/internal/logic/operate" - _ "sagooiot/internal/logic/rules_engine" - _ "sagooiot/internal/logic/scene" - _ "sagooiot/internal/logic/screen" _ "sagooiot/internal/logic/system" _ "sagooiot/internal/logic/tdengine" "sagooiot/internal/model"