forked from ouqiang/gocron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
op_log.go
36 lines (29 loc) · 1 KB
/
op_log.go
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
package models
import (
"time"
)
type OpType string
const (
LogModule OpType = "log"
TaskModule OpType = "task"
UserModule OpType = "user"
SystemModule OpType = "system"
)
// 操作日志
type OpLog struct {
Id int64 `json:"id" xorm:"bigint pk autoincr"`
Title string `json:"title" xorm:"varchar(64) notnull"` // 日志名称
UserId int `json:"user_id" xorm:"int notnull"` // 用户ID
UserName string `json:"user_name" xorm:"varchar(64) notnull"` // 用户名
Module string `json:"module" xorm:"varchar(16) notnull"` // 模块
Content string `json:"content" xorm:"mediumtext notnull "` // 日志内容
CreateTime time.Time `json:"create_time" xorm:"datetime created"` // 操作时间
BaseModel `json:"-" xorm:"-"`
}
func (log *OpLog)Create()(insertId int64, err error) {
_, err = Db.Insert(log)
if err == nil {
insertId = log.Id
}
return
}