deviceLog

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package device 设备操作日志

Package device 设备操作日志

Package device 设备操作日志

Package device 设备操作日志

Package device 设备操作日志

Index

Constants

View Source
const (
	MsgTypeSend    = "send" //控制下发
	MsgTypePublish = "publish"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Abnormal added in v1.0.4

type Abnormal struct {
	ProductID  string    `json:"productID,omitempty"`  // 产品id
	DeviceName string    `json:"deviceName,omitempty"` // 设备名称
	Action     bool      `json:"action,omitempty"`     //触发1还是解除2
	Type       string    `json:"type,omitempty"`       // 异常类型
	Timestamp  time.Time `json:"timestamp"`            // 操作时间
	TraceID    string    `json:"traceID,omitempty"`    // 服务器端事务id
	Reason     string    `json:"reason,omitempty"`     //原因
}

type AbnormalFilter added in v1.0.4

type AbnormalFilter struct {
	ProductID  string // 产品id
	DeviceName string // 设备名称
	Action     bool
	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
}

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     `json:"productID"`             // 产品id
	DeviceName  string     `json:"deviceName"`            // 设备名称
	Content     string     `json:"content,omitempty"`     // 具体信息
	Topic       string     `json:"topic,omitempty"`       // 主题
	Action      ActionType `json:"action,omitempty"`      // 操作类型
	Timestamp   time.Time  `json:"timestamp,omitempty"`   // 操作时间
	RequestID   string     `json:"requestID,omitempty"`   // 请求ID
	TraceID     string     `json:"traceID,omitempty"`     // 服务器端事务id
	ResultCode  int64      `json:"resultCode,omitempty"`  // 请求结果状态,200为成功
	RespPayload string     `json:"respPayload,omitempty"` //返回的内容
}

func (Hub) ToApp

func (h Hub) ToApp() application.Hub

type HubFilter

type HubFilter struct {
	ProductID  string   // 产品id
	DeviceName string   // 设备名称
	Actions    []string //过滤操作类型 property:属性 event:事件 action:操作 thing:物模型提交的操作为匹配的日志
	Topics     []string //过滤主题
	Content    string   //过滤内容
	RequestID  string   //过滤请求ID
}

type HubRepo

type HubRepo interface {
	ManageRepo
	GetDeviceLog(ctx context.Context, filter HubFilter, page def.PageInfo2) ([]*Hub, error)
	GetCountLog(ctx context.Context, filter HubFilter, page def.PageInfo2) (int64, error)
	Insert(ctx context.Context, data *Hub) error
}

type ManageRepo

type ManageRepo interface {
	InitProduct(ctx context.Context, productID string) error
	InitDevice(ctx context.Context, device devices.Info) error
	DeleteProduct(ctx context.Context, productID string) error
	DeleteDevice(ctx context.Context, productID string, deviceName string) error
}

type ModifyRepo

type ModifyRepo interface {
	ModifyDeviceTenant(ctx context.Context, device devices.Core, tenantCode string) error
	ModifyDeviceArea(ctx context.Context, device devices.Core, areaID int64) error
	ModifyDeviceProject(ctx context.Context, device devices.Core, projectID int64) error
}

type MsgType

type MsgType = string

type SDK

type SDK struct {
	ProductID  string    `json:"productID"`  // 产品id
	DeviceName string    `json:"deviceName"` // 设备名称
	Content    string    `json:"content"`    // 具体信息
	Timestamp  time.Time `json:"timestamp"`  // 操作时间
	LogLevel   int64     `json:"logLevel"`
}

type SDKFilter

type SDKFilter struct {
	ProductID  string // 产品id
	DeviceName string // 设备名称
	LogLevel   int    //日志等级
}

type SDKRepo

type SDKRepo interface {
	GetDeviceSDKLog(ctx context.Context, filter SDKFilter, page def.PageInfo2) ([]*SDK, error)
	GetCountLog(ctx context.Context, filter SDKFilter, page def.PageInfo2) (int64, error)
	Insert(ctx context.Context, data *SDK) error
	ManageRepo
}

type Send

type Send struct {
	UserID     int64     `json:"userID"`
	ProductID  string    `json:"productID,omitempty"`  // 产品id
	DeviceName string    `json:"deviceName,omitempty"` // 设备名称
	Action     string    `json:"action,omitempty"`     // 操作类型 propertySend:属性控制 actionSend:操作控制 propertyGetReportSend:获取最新属性请求
	DataID     string    `json:"dataID"`
	Timestamp  time.Time `json:"timestamp"`         // 操作时间
	TraceID    string    `json:"traceID,omitempty"` // 服务器端事务id
	Account    string    `json:"account"`
	Content    string    `json:"content"`              //操作的内容
	ResultCode int64     `json:"resultCode,omitempty"` // 请求结果状态,200为成功
}

type SendFilter

type SendFilter struct {
	TenantCode string
	ProjectID  int64    `json:"projectID,omitempty"`
	AreaIDs    []int64  `json:"areaID"`
	UserID     int64    `json:"userID"`
	ProductID  string   // 产品id
	DeviceName string   // 设备名称
	Actions    []string //过滤操作类型  propertySend:属性控制 actionSend:操作控制 propertyGetReportSend:获取最新属性请求
	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
}

type Status

type Status struct {
	ProductID  string    `json:"productID"`  // 产品id
	DeviceName string    `json:"deviceName"` // 设备名称
	Status     int64     `json:"status"`     // 设备状态 connected:上线 disconnected:下线
	Timestamp  time.Time `json:"timestamp"`  // 操作时间
}

type StatusFilter

type StatusFilter struct {
	TenantCode string
	ProjectID  int64
	AreaIDs    []int64
	ProductID  string // 产品id
	DeviceName string // 设备名称
	Status     int64  `json:"status"`
}

type StatusRepo

type StatusRepo interface {
	GetDeviceLog(ctx context.Context, filter StatusFilter, page def.PageInfo2) ([]*Status, error)
	GetCountLog(ctx context.Context, filter StatusFilter, page def.PageInfo2) (int64, error)
	Insert(ctx context.Context, data *Status) error
	ManageRepo
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL