mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-15 15:16:34 +08:00
增加操作日志查看界面
This commit is contained in:
@@ -28,10 +28,28 @@ func init() {
|
||||
}
|
||||
|
||||
// 创建管理员日志
|
||||
func (this *LogDAO) CreateAdminLog(adminId int64, level string, description string, action string, ip string) error {
|
||||
func (this *LogDAO) CreateLog(adminType string, adminId int64, level string, description string, action string, ip string) error {
|
||||
op := NewLogOperator()
|
||||
op.Type = adminType
|
||||
op.AdminId, op.Level, op.Description, op.Action, op.Ip = adminId, level, description, action, ip
|
||||
op.Type = LogTypeAdmin
|
||||
_, err := this.Save(op)
|
||||
return err
|
||||
}
|
||||
|
||||
// 计算所有日志数量
|
||||
func (this *LogDAO) CountAllLogs() (int64, error) {
|
||||
return this.Query().
|
||||
Count()
|
||||
}
|
||||
|
||||
// 列出单页日志
|
||||
func (this *LogDAO) ListLogs(offset int64, size int64) (result []*Log, err error) {
|
||||
_, err = this.Query().
|
||||
Offset(offset).
|
||||
Limit(size).
|
||||
Slice(&result).
|
||||
DescPk().
|
||||
FindAll()
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user