mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 10:58:35 +08:00
iot init
This commit is contained in:
42
apps/rule/entity/rulechain.go
Normal file
42
apps/rule/entity/rulechain.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"pandax/pkg/global"
|
||||
"time"
|
||||
)
|
||||
|
||||
type RuleChainBaseLabel struct {
|
||||
Id string `json:"id"`
|
||||
Root string `json:"root"`
|
||||
RuleName string `json:"ruleName"`
|
||||
}
|
||||
|
||||
type RuleChainBase struct {
|
||||
global.BaseAuthModel
|
||||
Root string `json:"root" gorm:"comment:是否根节点,1 根链 0 普通链"`
|
||||
RuleName string `gorm:"ruleName;type:varchar(50);comment:名称" json:"ruleName"`
|
||||
RuleBase64 string `gorm:"ruleBase64;type:longtext;comment:Base64缩略图" json:"ruleBase64"` //缩略图 base64
|
||||
RuleRemark string `gorm:"ruleRemark;type:varchar(256);comment:说明" json:"ruleRemark"`
|
||||
}
|
||||
|
||||
type RuleChain struct {
|
||||
RuleChainBase
|
||||
RuleDataJson string `gorm:"ruleDataJson;type:longtext;comment:Json数据" json:"ruleDataJson"`
|
||||
}
|
||||
|
||||
func (RuleChain) TableName() string {
|
||||
return "rule_chain"
|
||||
}
|
||||
|
||||
type RuleChainMsgLog struct {
|
||||
MessageId string `json:"message_id"`
|
||||
MsgType string `json:"msg_type"`
|
||||
DeviceName string `json:"device_name"`
|
||||
Ts time.Time `json:"ts"`
|
||||
Content string `json:"content"`
|
||||
CreatedAt time.Time // 创建时间
|
||||
}
|
||||
|
||||
func (RuleChainMsgLog) TableName() string {
|
||||
return "rule_chain_msg_log"
|
||||
}
|
||||
24
apps/rule/entity/rulechain_data.go
Normal file
24
apps/rule/entity/rulechain_data.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type RuleDataJson struct {
|
||||
LfData struct {
|
||||
GlobalColor string `json:"globalColor"`
|
||||
DataCode map[string]interface{} `json:"dataCode"`
|
||||
OpenRule bool `json:"openRule"`
|
||||
Setting map[string]interface{} `json:"setting"`
|
||||
} `json:"lfData"`
|
||||
}
|
||||
|
||||
// 序列化
|
||||
func (m *RuleDataJson) MarshalBinary() (data []byte, err error) {
|
||||
return json.Marshal(m)
|
||||
}
|
||||
|
||||
// 反序列化
|
||||
func (m *RuleDataJson) UnmarshalBinary(data []byte) error {
|
||||
return json.Unmarshal(data, m)
|
||||
}
|
||||
Reference in New Issue
Block a user