mirror of
https://github.com/lejianwen/rustdesk-api.git
synced 2025-12-02 10:03:16 +00:00
add file conn log
This commit is contained in:
@@ -67,7 +67,7 @@ func (a *Audit) ConnDelete(c *gin.Context) {
|
||||
response.Fail(c, 101, errList[0])
|
||||
return
|
||||
}
|
||||
l := service.AllService.AuditService.InfoById(f.Id)
|
||||
l := service.AllService.AuditService.ConnInfoById(f.Id)
|
||||
if l.Id > 0 {
|
||||
err := service.AllService.AuditService.DeleteAuditConn(l)
|
||||
if err == nil {
|
||||
@@ -79,3 +79,70 @@ func (a *Audit) ConnDelete(c *gin.Context) {
|
||||
}
|
||||
response.Fail(c, 101, response.TranslateMsg(c, "ItemNotFound"))
|
||||
}
|
||||
|
||||
// FileList 列表
|
||||
// @Tags 文件日志
|
||||
// @Summary 文件日志列表
|
||||
// @Description 文件日志列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param page query int false "页码"
|
||||
// @Param page_size query int false "页大小"
|
||||
// @Param peer_id query int false "目标设备"
|
||||
// @Param from_peer query int false "来源设备"
|
||||
// @Success 200 {object} response.Response{data=model.AuditFileList}
|
||||
// @Failure 500 {object} response.Response
|
||||
// @Router /admin/audit_conn/list [get]
|
||||
// @Security token
|
||||
func (a *Audit) FileList(c *gin.Context) {
|
||||
query := &admin.AuditQuery{}
|
||||
if err := c.ShouldBindQuery(query); err != nil {
|
||||
response.Fail(c, 101, response.TranslateMsg(c, "ParamsError")+err.Error())
|
||||
return
|
||||
}
|
||||
res := service.AllService.AuditService.AuditFileList(query.Page, query.PageSize, func(tx *gorm.DB) {
|
||||
if query.PeerId != "" {
|
||||
tx.Where("peer_id like ?", "%"+query.PeerId+"%")
|
||||
}
|
||||
if query.FromPeer != "" {
|
||||
tx.Where("from_peer like ?", "%"+query.FromPeer+"%")
|
||||
}
|
||||
})
|
||||
response.Success(c, res)
|
||||
}
|
||||
|
||||
// FileDelete 删除
|
||||
// @Tags 文件日志
|
||||
// @Summary 文件日志删除
|
||||
// @Description 文件日志删除
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body model.AuditFile true "文件日志信息"
|
||||
// @Success 200 {object} response.Response
|
||||
// @Failure 500 {object} response.Response
|
||||
// @Router /admin/audit_conn/delete [post]
|
||||
// @Security token
|
||||
func (a *Audit) FileDelete(c *gin.Context) {
|
||||
f := &model.AuditFile{}
|
||||
if err := c.ShouldBindJSON(f); err != nil {
|
||||
response.Fail(c, 101, response.TranslateMsg(c, "ParamsError")+err.Error())
|
||||
return
|
||||
}
|
||||
id := f.Id
|
||||
errList := global.Validator.ValidVar(c, id, "required,gt=0")
|
||||
if len(errList) > 0 {
|
||||
response.Fail(c, 101, errList[0])
|
||||
return
|
||||
}
|
||||
l := service.AllService.AuditService.FileInfoById(f.Id)
|
||||
if l.Id > 0 {
|
||||
err := service.AllService.AuditService.DeleteAuditFile(l)
|
||||
if err == nil {
|
||||
response.Success(c, nil)
|
||||
return
|
||||
}
|
||||
response.Fail(c, 101, err.Error())
|
||||
return
|
||||
}
|
||||
response.Fail(c, 101, response.TranslateMsg(c, "ItemNotFound"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user