Browse Source

修改状态

Signed-off-by: zouap <zouap@pcl.ac.cn>
pull/1928/head
zouap 3 years ago
parent
commit
7705f82220
1 changed files with 16 additions and 10 deletions
  1. +16
    -10
      routers/repo/attachment.go

+ 16
- 10
routers/repo/attachment.go View File

@@ -78,7 +78,7 @@ func UploadAttachmentUI(ctx *context.Context) {
} }


func EditAttachmentUI(ctx *context.Context) { func EditAttachmentUI(ctx *context.Context) {
id, _ := strconv.ParseInt(ctx.Params(":id"), 10, 64) id, _ := strconv.ParseInt(ctx.Params(":id"), 10, 64)
ctx.Data["PageIsDataset"] = true ctx.Data["PageIsDataset"] = true
attachment, _ := models.GetAttachmentByID(id) attachment, _ := models.GetAttachmentByID(id)
@@ -986,23 +986,29 @@ func HandleUnDecompressAttachment() {
if attach.Type == models.TypeCloudBrainOne { if attach.Type == models.TypeCloudBrainOne {
err = worker.SendDecompressTask(contexExt.Background(), attach.UUID, attach.Name) err = worker.SendDecompressTask(contexExt.Background(), attach.UUID, attach.Name)
if err != nil { if err != nil {
log.Error("SendDecompressTask(%s) failed:%s", attach.UUID, err.Error())
log.Error("SendDecompressTask(%s) failed:%s", attach.UUID, err.Error())
} else { } else {
attach.DecompressState = models.DecompressStateIng
err = models.UpdateAttachment(attach)
if err != nil {
log.Error("UpdateAttachment state(%s) failed:%s", attach.UUID, err.Error())
}
updateAttachmentDecompressStateIng(attach)
} }
} else if attach.Type == models.TypeCloudBrainTwo { } else if attach.Type == models.TypeCloudBrainTwo {
attachjson, _ := json.Marshal(attach) attachjson, _ := json.Marshal(attach)
labelmsg.SendDecompressAttachToLabelOBS(string(attachjson))
err = labelmsg.SendDecompressAttachToLabelOBS(string(attachjson))
if err != nil {
log.Error("SendDecompressTask to labelsystem (%s) failed:%s", attach.UUID, err.Error())
} else {
updateAttachmentDecompressStateIng(attach)
}
} }

} }

return return
} }
func updateAttachmentDecompressStateIng(attach *models.Attachment) {
attach.DecompressState = models.DecompressStateIng
err := models.UpdateAttachment(attach)
if err != nil {
log.Error("UpdateAttachment state(%s) failed:%s", attach.UUID, err.Error())
}
}


func QueryAllPublicDataset(ctx *context.Context) { func QueryAllPublicDataset(ctx *context.Context) {
attachs, err := models.GetAllPublicAttachments() attachs, err := models.GetAllPublicAttachments()


Loading…
Cancel
Save