对文档进行操作,type类型的值包括remove(移入回收站),del(删除文档记录),clear(清空通用户的内容),deepdel(深度删除,在删除文档记录的同时删除文档文件),forbidden(禁止文档,把文档md5标记为禁止上传,只要文档的md5是这个,则该文档禁止被上传)
()
| 186 | |
| 187 | //对文档进行操作,type类型的值包括remove(移入回收站),del(删除文档记录),clear(清空通用户的内容),deepdel(深度删除,在删除文档记录的同时删除文档文件),forbidden(禁止文档,把文档md5标记为禁止上传,只要文档的md5是这个,则该文档禁止被上传) |
| 188 | func (this *DocController) Action() { |
| 189 | var errs []string |
| 190 | ActionType := strings.ToLower(this.GetString("type")) |
| 191 | ids := helper.StringSliceToInterfaceSlice(strings.Split(this.GetString("id"), ",")) |
| 192 | recycle := models.NewDocumentRecycle() |
| 193 | switch ActionType { |
| 194 | case "deepdel": //彻底删除文档:删除文档记录的同时也删除文档 |
| 195 | if err := recycle.DeepDel(ids...); err != nil { |
| 196 | errs = append(errs, err.Error()) |
| 197 | } |
| 198 | case "del-row": //只是删除该文档的文档记录 |
| 199 | if err := recycle.DelRows(ids...); err != nil { |
| 200 | errs = append(errs, err.Error()) |
| 201 | } |
| 202 | case "recover": //恢复文档,只有文档状态是-1时,才可以进行恢复【OK】 |
| 203 | if err := recycle.RecoverFromRecycle(ids...); err != nil { |
| 204 | errs = append(errs, err.Error()) |
| 205 | } |
| 206 | case "illegal": //将文档标记为非法文档【OK】 |
| 207 | if err := models.NewDocument().SetIllegal(ids...); err != nil { |
| 208 | errs = append(errs, err.Error()) |
| 209 | } |
| 210 | case "remove": //将文档移入回收站【OK】 |
| 211 | if err := recycle.RemoveToRecycle(this.AdminId, false, ids...); err != nil { |
| 212 | errs = append(errs, err.Error()) |
| 213 | } |
| 214 | } |
| 215 | if len(errs) > 0 { |
| 216 | this.ResponseJson(false, fmt.Sprintf("操作失败:%v", strings.Join(errs, "; "))) |
| 217 | } |
| 218 | this.ResponseJson(true, "操作成功") |
| 219 | } |
| 220 | |
| 221 | //获取文档备注模板 |
| 222 | func (this *DocController) RemarkTpl() { |
nothing calls this directly
no test coverage detected