mirror of
https://github.com/skyle1995/NetworkAuth.git
synced 2026-05-25 02:24:05 +08:00
更新底层架构
This commit is contained in:
17
models/login_log.go
Normal file
17
models/login_log.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// LoginLog 登录日志模型
|
||||
type LoginLog struct {
|
||||
ID uint `gorm:"primarykey" json:"id"`
|
||||
Type string `gorm:"type:varchar(20);index;comment:日志类型(admin/user)" json:"type"`
|
||||
Username string `gorm:"type:varchar(100);index;comment:登录用户名" json:"username"`
|
||||
IP string `gorm:"type:varchar(50);comment:登录IP" json:"ip"`
|
||||
Status int `gorm:"type:tinyint;comment:登录状态 1:成功 0:失败" json:"status"`
|
||||
Message string `gorm:"type:varchar(255);comment:日志详情" json:"message"`
|
||||
UserAgent string `gorm:"type:varchar(255);comment:用户代理" json:"user_agent"`
|
||||
CreatedAt time.Time `gorm:"index;comment:创建时间" json:"created_at"`
|
||||
}
|
||||
24
models/operation_log.go
Normal file
24
models/operation_log.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// OperationLog 操作日志模型
|
||||
type OperationLog struct {
|
||||
ID uint `gorm:"primarykey" json:"id"`
|
||||
CreatedAt time.Time `gorm:"index;comment:创建时间" json:"created_at"`
|
||||
|
||||
// 操作信息
|
||||
OperationType string `gorm:"type:varchar(50);index;comment:操作方式" json:"operation_type"` // 如:入库成功、凭证分配等
|
||||
|
||||
// 操作人信息
|
||||
Operator string `gorm:"type:varchar(100);index;comment:操作账号" json:"operator"`
|
||||
OperatorUUID string `gorm:"type:varchar(36);index;comment:操作账号UUID" json:"operator_uuid"`
|
||||
|
||||
// 关联对象信息 (快照,防止关联对象被删除后无法查询)
|
||||
TransactionID string `gorm:"type:varchar(100);index;comment:交易ID" json:"transaction_id"`
|
||||
AppName string `gorm:"type:varchar(100);comment:应用名称" json:"app_name"`
|
||||
ProductName string `gorm:"type:varchar(100);comment:商品名称" json:"product_name"`
|
||||
Details string `gorm:"type:text;comment:操作详情" json:"details"`
|
||||
}
|
||||
Reference in New Issue
Block a user