package dao import ( "time" ) type QueryDevices struct { //countNum:灯杆总数, //faultNum:灯杆报警数, CountNum int64 `json:"countNum"` FaultNum int64 `json:"faultNum"` Devices []Device `json:"list"` } type Device struct { //lng经度,lat纬度,status:状态,name:名字,code:编码,lampPoleName:灯杆名,brand:品牌,model:型号,linkNum:连接设备数, Lng float64 `json:"lng"` Lat float64 `json:"lat"` Status int `json:"status"` Name string `json:"name"` Code string `json:"code"` LampPoleName string `json:"lampPoleName"` Model string `json:"model"` LinkNum int64 `json:"linkNum"` } type TotalLamp struct { CountNum int64 `json:"countNum"` FaultNum int64 `json:"faultNum"` } type ConfigInfo struct { Id int64 `json:"id"` SiteValue string `json:"siteValue"` } // url: '/api/longchi/largescreen/overview/device-status', type DeviceStatus struct { DeviceType string `json:"deviceType"` CountNum int64 `json:"countNum"` FaultNum int64 `json:"faultNum"` } func (d *DeviceStatus) Set(n, m int64) { d.CountNum = n d.FaultNum = m } // /api/longchi/largescreen/overview/energy-consumption type Energy struct { Date string `json:"date"` Difference float64 `json:"difference"` } type LightRate struct { Data []interface{} } // LightRate 亮灯率: /api/longchi/largescreen/overview/lighting-rate type LightRateM struct { Month string `json:"month"` Rate float64 `json:"rate"` } type LightRateQ struct { Quarter string `json:"quarter"` Rate float64 `json:"rate"` } type LightRateY struct { Year string `json:"year"` Rate float64 `json:"rate"` } // AlarmInfo http://localhost/api/longchi/largescreen/overview/alarm-information type AlarmList struct { Backlog int64 `json:"backlog"` LastMonthAlarm int64 `json:"lastMonthAlarm"` LastYearAlarm int64 `json:"lastYearAlarm"` List []AlarmInfo `json:"list"` } type AlarmInfo struct { ArmContent string `gorm:"arm_content" json:"armContent"` ArmDeviceTypeName string `gorm:"arm_device_type_name" json:"armDeviceTypeName"` ArmLevelName string `gorm:"level_name" json:"armLevelName"` CreateTime DateTimeString `gorm:"arm_time" json:"createTime"` } type DateTimeString time.Time const DateTimeFormatCN = "2006-01-02 15:04:05" func (t *DateTimeString) UnmarshalJSON(data []byte) (err error) { now, err := time.ParseInLocation(`"`+DateTimeFormatCN+`"`, string(data), time.Local) *t = DateTimeString(now) return } func (t *DateTimeString) MarshalJSON() ([]byte, error) { b := make([]byte, 0, len(DateTimeFormatCN)+2) b = append(b, '"') b = time.Time(*t).AppendFormat(b, DateTimeFormatCN) b = append(b, '"') return b, nil } func (t *DateTimeString) String() string { return time.Time(*t).Format(DateTimeFormatCN) } // lastYearJob,本月已处理lastMonthJob,待处理backJob,list{type,name,createTime}) type FlowList struct { LastYearJob int64 `json:"lastYearJob"` LastMonthJob int64 `json:"lastMonthJob"` List []FlowInfo `json:"list"` } type FlowInfo struct { Name string `json:"name"` CreateTime time.Time `json:"createTime"` } // /setting/query-large-screen type ScreenSet struct { SiteValue string } // 环境监测http://localhost/api/longchi/largescreen/overview/weather-now?id=1 type Environment struct { //AirIndex int64 Air float64 `json:"airQuality"` //LampPoleLocation string `json:"lampPoleLocation"` CreateDate string `json:"endLineTime"` Temperature float64 `json:"realTimeTemperature"` Humidity float64 `json:"humidity"` Pm25 float64 `json:"pm25"` Pm10 float64 `json:"pm10"` Noise float64 `json:"noise"` Hpa float64 `json:"pressure"` //气压 WindDirection string `json:"direction"` WindSpeed float64 `json:"realTimeWindSpeed"` //风力等级 } // 信息屏 type InfoBoardProgram struct { Id int64 `json:"id"` Name string `json:"name"` //节目名字 Duration int64 `json:"duration"` //播放时长 Count int64 `json:"countDeviceNum"` //关联设备 ResolutionName string `json:"resolutionName"` //分辨率 EndTime DateString `json:"endTime"` //结束时间 } type Program struct { Id int64 `json:"id"` SendUrl string `json:"sendUrl"` } type DateString time.Time const TimeFormatCN = "2006-01-02" func (t *DateString) UnmarshalJSON(data []byte) (err error) { now, err := time.ParseInLocation(`"`+TimeFormatCN+`"`, string(data), time.Local) *t = DateString(now) return } func (t *DateString) MarshalJSON() ([]byte, error) { b := make([]byte, 0, len(TimeFormatCN)+2) b = append(b, '"') b = time.Time(*t).AppendFormat(b, TimeFormatCN) b = append(b, '"') return b, nil } func (t *DateString) String() string { return time.Time(*t).Format(TimeFormatCN) } type Sensor struct { Id int64 `json:"id"` Name string `json:"name"` }