mindoc/models/logs.go
Minho 1afb119bde 1、实现超级管理员用户管理功能
2、实现超级管理员项目列表功能
3、实现项目成员列表功能
2017-04-24 18:25:17 +08:00

56 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package models
import (
"time"
"github.com/lifei6671/godoc/conf"
)
const (
Logger_Operate = "operate"
Logger_System = "system"
Logger_Exception = "exception"
)
// Logger struct .
type Logger struct {
LoggerId int64 `orm:"pk;auto;unique;column(logger_id)" json:"logger_id"`
MemberId int `orm:"column(member_id);type(int)" json:"member_id"`
// 日志类别operate 操作日志/ system 系统日志/ exception 异常日志
Category string `orm:"column(category);size(255);default(operate)" json:"category"`
Content string `orm:"column(content);type(text)" json:"content"`
OriginalData string `orm:"column(original_data);type(text)" json:"original_data"`
PresentData string `orm:"column(present_data);type(text)" json:"present_data"`
CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"`
UserAgent string `orm:"column(user_agent);size(500)" json:"user_agent"`
IPAddress string `orm:"column(ip_address);size(255)" json:"ip_address"`
}
// TableName 获取对应数据库表名.
func (m *Logger) TableName() string {
return "logs"
}
// TableEngine 获取数据使用的引擎.
func (m *Logger) TableEngine() string {
return "INNODB"
}
func (m *Logger) TableNameWithPrefix() string {
return conf.GetDatabasePrefix() + m.TableName()
}