diff --git a/apps/device/api/device.go b/apps/device/api/device.go index b5b5977..7d28d61 100644 --- a/apps/device/api/device.go +++ b/apps/device/api/device.go @@ -11,7 +11,6 @@ import ( "github.com/PandaXGO/PandaKit/model" "github.com/PandaXGO/PandaKit/restfulx" "pandax/apps/device/util" - "pandax/pkg/cache" "pandax/pkg/global" model2 "pandax/pkg/global/model" "pandax/pkg/shadow" @@ -30,17 +29,13 @@ type DeviceApi struct { } func (p *DeviceApi) GetDevicePanel(rc *restfulx.ReqCtx) { - get, err := cache.PanelCache.ComputeIfAbsent("panel", func(k any) (any, error) { - var data entity.DeviceTotalOutput - data.DeviceInfo = p.DeviceApp.FindDeviceCount() - data.DeviceLinkStatusInfo = p.DeviceApp.FindDeviceCountGroupByLinkStatus() - data.DeviceCountType = p.DeviceApp.FindDeviceCountGroupByType() - data.AlarmInfo = p.DeviceAlarmApp.FindAlarmCount() - data.ProductInfo = p.ProductApp.FindProductCount() - return data, nil - }) - biz.ErrIsNil(err, "获取面板数据失败") - rc.ResData = get + var data entity.DeviceTotalOutput + data.DeviceInfo = p.DeviceApp.FindDeviceCount() + data.DeviceLinkStatusInfo = p.DeviceApp.FindDeviceCountGroupByLinkStatus() + data.DeviceCountType = p.DeviceApp.FindDeviceCountGroupByType() + data.AlarmInfo = p.DeviceAlarmApp.FindAlarmCount() + data.ProductInfo = p.ProductApp.FindProductCount() + rc.ResData = data } // GetDeviceList Device列表数据 diff --git a/config.yml b/config.yml index 60a0172..4642600 100644 --- a/config.yml +++ b/config.yml @@ -17,7 +17,7 @@ server: rate: enable: true rate-num: 100 - db-type: postgresql + db-type: mysql # 是否开启数据库表初始化 isInitTable: false excel-dir: ./resource/excel/ diff --git a/pkg/cache/panel.go b/pkg/cache/panel.go deleted file mode 100644 index 0302cf4..0000000 --- a/pkg/cache/panel.go +++ /dev/null @@ -1,8 +0,0 @@ -package cache - -import ( - "github.com/PandaXGO/PandaKit/cache" - "time" -) - -var PanelCache = cache.NewTimedCache(cache.NoExpiration, 600*time.Second)