Documentation
¶
Overview ¶
Package device 设备操作日志
Package device 设备操作日志 ¶
Package device 设备操作日志 ¶
Package device 设备操作日志 ¶
Package device 设备操作日志
Index ¶
Constants ¶
View Source
const ( MsgTypeSend = "send" //控制下发 MsgTypePublish = "publish" MsgTypeOnline = "online" //在线统计 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Abnormal ¶ added in v1.0.4
type Abnormal struct { TenantCode dataType.TenantCode `gorm:"column:tenant_code;index;type:VARCHAR(50);NOT NULL"` // 租户编码 ProjectID dataType.ProjectID `gorm:"column:project_id;index:project_id_area_id;type:bigint;default:0;NOT NULL"` // 项目ID(雪花ID) AreaID dataType.AreaID `gorm:"column:area_id;index:project_id_area_id;type:bigint;default:0;NOT NULL"` // 项目区域ID(雪花ID) AreaIDPath dataType.AreaIDPath `gorm:"column:area_id_path;type:varchar(100);default:'';NOT NULL"` // 项目区域ID路径(雪花ID) ProductID string `gorm:"column:product_id;type:varchar(100);NOT NULL" json:"productID,omitempty"` // 产品id DeviceName string `gorm:"column:device_name;type:varchar(100);NOT NULL" json:"deviceName,omitempty"` // 设备名称 Action def.Bool `gorm:"column:user_id;type:BIGINT;default:1" json:"action,omitempty"` //触发1还是解除2 Type string `gorm:"column:type;type:varchar(100);NOT NULL" json:"type,omitempty"` // 异常类型 Timestamp time.Time `gorm:"column:ts;NOT NULL;" json:"timestamp"` // 操作时间 TraceID string `gorm:"column:trace_id;type:varchar(100);NOT NULL" json:"traceID,omitempty"` // 服务器端事务id Reason string `gorm:"column:reason;type:varchar(100);NOT NULL" json:"reason,omitempty"` //原因 }
type AbnormalFilter ¶ added in v1.0.4
type AbnormalFilter struct { TenantCode string ProjectID int64 `json:"projectID,omitempty"` AreaID int64 `json:"areaID,omitempty"` AreaIDPath string `json:"areaIDPath,omitempty"` AreaIDs []int64 `json:"areaIDs"` ProductID string // 产品id ProductIDs []string DeviceName string // 设备名称 Action int64 Type string `json:"type,omitempty"` // 异常类型 Reason string }
type AbnormalRepo ¶ added in v1.0.4
type AbnormalRepo interface { GetDeviceLog(ctx context.Context, filter AbnormalFilter, page def.PageInfo2) ([]*Abnormal, error) GetCountLog(ctx context.Context, filter AbnormalFilter, page def.PageInfo2) (int64, error) Insert(ctx context.Context, data *Abnormal) error ManageRepo UpdateDevice(ctx context.Context, devices []*devices.Core, affiliation devices.Affiliation) error UpdateDevices(ctx context.Context, devices []*devices.Info) error VersionUpdate(ctx context.Context, version string) error }
type ActionType ¶
type ActionType = string
const ( ActionTypeGateway ActionType = "gateway" //网关操作子设备 ActionTypeOta ActionType = "ota" //ota升级消息 ActionTypeProperty ActionType = "property" //物模型属性消息 ActionTypeEvent ActionType = "event" //事件消息 ActionTypeAction ActionType = "action" //行为消息 ActionTypeExt ActionType = "ext" //拓展消息 ActionTypeNtp ActionType = "ntp" //获取时间 )
type Hub ¶
type Hub struct { ProductID string `gorm:"column:product_id;type:varchar(100);NOT NULL" json:"productID,omitempty"` // 产品id DeviceName string `gorm:"column:device_name;type:varchar(100);NOT NULL" json:"deviceName,omitempty"` // 设备名称 Content string `gorm:"column:content;type:varchar(256);NOT NULL" json:"content,omitempty"` // 具体信息 Topic string `gorm:"column:topic;type:varchar(100);NOT NULL" json:"topic,omitempty"` // 主题 Action ActionType `gorm:"column:action;type:varchar(25);NOT NULL" json:"action,omitempty"` // 操作类型 Timestamp time.Time `gorm:"column:ts;NOT NULL;" json:"timestamp"` // 操作时间 RequestID string `gorm:"column:request_id;type:varchar(100);NOT NULL" json:"requestID,omitempty"` // 请求ID TraceID string `gorm:"column:trace_id;type:varchar(100);NOT NULL" json:"traceID,omitempty"` // 服务器端事务id ResultCode int64 `gorm:"column:result_code;type:BIGINT;default:200" json:"resultCode,omitempty"` // 请求结果状态,200为成功 RespPayload string `gorm:"column:resp_payload;type:varchar(256);NOT NULL" json:"respPayload,omitempty"` //返回的内容 }
func (Hub) ToApp ¶
func (h Hub) ToApp() application.Hub
type ManageRepo ¶
type ModifyRepo ¶
type SDK ¶
type SDK struct { ProductID string `gorm:"column:product_id;type:varchar(100);NOT NULL" json:"productID,omitempty"` // 产品id DeviceName string `gorm:"column:device_name;type:varchar(100);NOT NULL" json:"deviceName,omitempty"` // 设备名称 Content string `gorm:"column:content;type:varchar(256);NOT NULL" json:"content,omitempty"` // 具体信息 Timestamp time.Time `gorm:"column:ts;NOT NULL;" json:"timestamp"` // 操作时间 LogLevel int64 `gorm:"column:log_level;type:BIGINT;default:1" json:"logLevel"` }
type Send ¶
type Send struct { TenantCode dataType.TenantCode `gorm:"column:tenant_code;index;type:VARCHAR(50);NOT NULL"` // 租户编码 ProjectID dataType.ProjectID `gorm:"column:project_id;index:project_id_area_id;type:bigint;default:0;NOT NULL"` // 项目ID(雪花ID) AreaID dataType.AreaID `gorm:"column:area_id;index:project_id_area_id;type:bigint;default:0;NOT NULL"` // 项目区域ID(雪花ID) AreaIDPath dataType.AreaIDPath `gorm:"column:area_id_path;type:varchar(100);default:'';NOT NULL"` // 项目区域ID路径(雪花ID) UserID int64 `gorm:"column:user_id;type:BIGINT;NOT NULL" json:"userID"` ProductID string `gorm:"column:product_id;type:varchar(100);NOT NULL" json:"productID,omitempty"` // 产品id DeviceName string `gorm:"column:device_name;type:varchar(100);NOT NULL" json:"deviceName,omitempty"` // 设备名称 Action string `gorm:"column:action;type:varchar(100);NOT NULL" json:"action,omitempty"` // 操作类型 propertySend:属性控制 actionSend:操作控制 propertyGetReportSend:获取最新属性请求 DataID string `gorm:"column:data_id;type:varchar(100);NOT NULL" json:"dataID"` Timestamp time.Time `gorm:"column:ts;NOT NULL;" json:"timestamp"` // 操作时间 TraceID string `gorm:"column:trace_id;type:varchar(100);NOT NULL" json:"traceID,omitempty"` // 服务器端事务id Account string `gorm:"column:account;type:varchar(100);NOT NULL" json:"account"` Content string `gorm:"column:content;type:varchar(100);NOT NULL" json:"content"` //操作的内容 ResultCode int64 `gorm:"column:result_code;type:BIGINT;default:200" json:"resultCode,omitempty"` // 请求结果状态 }
type SendFilter ¶
type SendFilter struct { TenantCode string ProjectID int64 `json:"projectID,omitempty"` AreaID int64 `json:"areaID,omitempty"` AreaIDPath string `json:"areaIDPath,omitempty"` AreaIDs []int64 `json:"areaIDs"` UserID int64 `json:"userID"` ProductIDs []string ProductID string // 产品id DeviceName string // 设备名称 Actions []string //过滤操作类型 propertySend:属性控制 actionSend:操作控制 propertyGetReportSend:获取最新属性请求 DataIDs []string DataID string ResultCode int64 }
type SendRepo ¶
type SendRepo interface { GetDeviceLog(ctx context.Context, filter SendFilter, page def.PageInfo2) ([]*Send, error) GetCountLog(ctx context.Context, filter SendFilter, page def.PageInfo2) (int64, error) Insert(ctx context.Context, data *Send) error ManageRepo UpdateDevice(ctx context.Context, devices []*devices.Core, affiliation devices.Affiliation) error UpdateDevices(ctx context.Context, devices []*devices.Info) error VersionUpdate(ctx context.Context, version string) error }
type Status ¶
type Status struct { ProductID string `gorm:"column:product_id;type:varchar(100);NOT NULL" json:"productID,omitempty"` // 产品id DeviceName string `gorm:"column:device_name;type:varchar(100);NOT NULL" json:"deviceName,omitempty"` // 设备名称 Status def.ConnStatus `gorm:"column:status;type:BIGINT;NOT NULL" json:"status"` // 设备状态 connected:上线 disconnected:下线 Timestamp time.Time `gorm:"column:ts;NOT NULL;" json:"timestamp"` // 操作时间 }
type StatusFilter ¶
Click to show internal directories.
Click to hide internal directories.