zhangzengfei
2021-12-01 c8d4a56f0e2f6794ef68abaca4b281fb9f26402c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package logc
 
import "encoding/json"
 
const (
    UpdateTaskState int = iota
    IncreaseSuccess
    IncreaseFailure
    UpdateCacheCount
    UpdateLastState
    ReduceFailure
)
 
type RuleServerLog struct {
    ID            string `gorm:"column:id;primaryKey;unique;autoIncrement" json:"id"` // 主键id
    Name          string `gorm:"column:name" json:"name"`
    State         string `gorm:"column:state" json:"state"`
    TotalSuccess  int    `gorm:"column:totalSuccess" json:"totalSuccess"`
    TotalFailure  int    `gorm:"column:totalFailure" json:"totalFailure"`
    TotalCached   string `gorm:"column:totalCached" json:"totalCached"`
    LastSendDate  string `gorm:"column:lastSendDate" json:"lastSendDate"`
    LastSendState string `gorm:"column:lastSendState" json:"lastSendState"`
    CreateDate    string `gorm:"column:createDate" json:"createDate"`
}
 
type RuleServerPushLog struct {
    ID       string // 主键id
    TaskName string // 任务名称
    Type     int    // 消息类型: 0 更新状态 1 成功+1 2 失败+1 3 缓存上报
    Info     string // 详情
}
 
func (l *RuleServerPushLog) Marshal() ([]byte, error) {
    return json.Marshal(l)
}
 
func (l *RuleServerPushLog) Topic() string {
    return RuleServerLogTopic
}