MCPcopy Index your code
hub / github.com/TruthHun/DocHub / SetIllegal

Method SetIllegal

models/DocumentModel.go:306–343  ·  view source on GitHub ↗

把文档标记为非法文档 @param ids 文档id @return err 错误,nil表示成功

(ids ...interface{})

Source from the content-addressed store, hash-verified

304//@param ids 文档id
305//@return err 错误,nil表示成功
306func (this *Document) SetIllegal(ids ...interface{}) (err error) {
307 if length := int64(len(ids)); length > 0 {
308 var (
309 docInfo []DocumentInfo
310 dsId []interface{} //document_store表中的id
311 did []interface{} //文档id
312 stores []DocumentStore
313 o = orm.NewOrm()
314 )
315
316 length, err = o.QueryTable(GetTableDocumentInfo()).Filter("Id__in", ids...).Limit(length).All(&docInfo)
317 if length > 0 {
318
319 for _, v := range docInfo {
320 dsId = append(dsId, v.DsId)
321 }
322
323 if docInfo, length, err = this.GetDocInfoByDsId(dsId...); length > 0 {
324 for _, v := range docInfo {
325 did = append(did, v.Id)
326 }
327
328 //将文档移入回收站,主要是避免之前文档没有被删除的情况
329 if err = NewDocumentRecycle().RemoveToRecycle(0, false, did...); err != nil {
330 helper.Logger.Error(err.Error())
331 }
332
333 //根据dsid查询文档md5,并把md5录入到非法文档表
334 if stores, length, err = this.GetDocStoreByDsId(dsId...); err == nil && length > 0 {
335 for _, store := range stores {
336 o.Insert(&DocumentIllegal{Md5: store.Md5})
337 }
338 }
339 }
340 }
341 }
342 return
343}
344
345//根据文档id获取文档,并根据ids参数的id顺序返回搜索结果【主要用于搜索】
346//@param ids 文档id

Callers 1

ActionMethod · 0.80

Calls 7

GetDocInfoByDsIdMethod · 0.95
GetDocStoreByDsIdMethod · 0.95
GetTableDocumentInfoFunction · 0.85
NewDocumentRecycleFunction · 0.85
AllMethod · 0.80
RemoveToRecycleMethod · 0.80
InsertMethod · 0.80

Tested by

no test coverage detected