增加操作日志查看界面

This commit is contained in:
刘祥超
2020-11-10 20:30:55 +08:00
parent d7fb936003
commit ea10e2e3c1
7 changed files with 129 additions and 19 deletions

View File

@@ -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
}