add file conn log
This commit is contained in:
@@ -44,9 +44,44 @@ func (as *AuditService) InfoByPeerIdAndConnId(peerId string, connId int64) (res
|
||||
return
|
||||
}
|
||||
|
||||
// InfoById
|
||||
func (as *AuditService) InfoById(id uint) (res *model.AuditConn) {
|
||||
// ConnInfoById
|
||||
func (as *AuditService) ConnInfoById(id uint) (res *model.AuditConn) {
|
||||
res = &model.AuditConn{}
|
||||
global.DB.Where("id = ?", id).First(res)
|
||||
return
|
||||
}
|
||||
|
||||
// FileInfoById
|
||||
func (as *AuditService) FileInfoById(id uint) (res *model.AuditFile) {
|
||||
res = &model.AuditFile{}
|
||||
global.DB.Where("id = ?", id).First(res)
|
||||
return
|
||||
}
|
||||
|
||||
func (as *AuditService) AuditFileList(page, pageSize uint, where func(tx *gorm.DB)) (res *model.AuditFileList) {
|
||||
res = &model.AuditFileList{}
|
||||
res.Page = int64(page)
|
||||
res.PageSize = int64(pageSize)
|
||||
tx := global.DB.Model(&model.AuditFile{})
|
||||
if where != nil {
|
||||
where(tx)
|
||||
}
|
||||
tx.Count(&res.Total)
|
||||
tx.Scopes(Paginate(page, pageSize))
|
||||
tx.Find(&res.AuditFiles)
|
||||
return
|
||||
}
|
||||
|
||||
// CreateAuditFile
|
||||
func (as *AuditService) CreateAuditFile(u *model.AuditFile) error {
|
||||
res := global.DB.Create(u).Error
|
||||
return res
|
||||
}
|
||||
func (as *AuditService) DeleteAuditFile(u *model.AuditFile) error {
|
||||
return global.DB.Delete(u).Error
|
||||
}
|
||||
|
||||
// Update 更新
|
||||
func (as *AuditService) UpdateAuditFile(u *model.AuditFile) error {
|
||||
return global.DB.Model(u).Updates(u).Error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user