mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
【feat】首页面板数据
This commit is contained in:
@@ -24,10 +24,25 @@ import (
|
||||
|
||||
type DeviceApi struct {
|
||||
DeviceApp services.DeviceModel
|
||||
DeviceAlarmApp services.DeviceAlarmModel
|
||||
ProductApp services.ProductModel
|
||||
ProductTemplateApp services.ProductTemplateModel
|
||||
}
|
||||
|
||||
func (p *DeviceApi) GetDevicePanel(rc *restfulx.ReqCtx) {
|
||||
get, err := global.Cache.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
|
||||
}
|
||||
|
||||
// GetDeviceList Device列表数据
|
||||
func (p *DeviceApi) GetDeviceList(rc *restfulx.ReqCtx) {
|
||||
data := entity.Device{}
|
||||
|
||||
Reference in New Issue
Block a user