diff --git a/route/v1/file.go b/route/v1/file.go index 4842215..d82ea0e 100644 --- a/route/v1/file.go +++ b/route/v1/file.go @@ -199,6 +199,7 @@ func GetDownloadFile(c *gin.Context) { defer ar.Close() commonDir := file.CommonPrefix(filepath.Separator, list...) + currentPath := filepath.Base(commonDir) name := "_" + currentPath @@ -515,7 +516,9 @@ func PostOperateFileOrDir(c *gin.Context) { if len(service.OpStrArr) == 1 { go service.ExecOpFile() go service.CheckFileStatus() + go service.MyService.Notify().SendFileOperateNotify(false) + } c.JSON(http.StatusOK, model.Result{Success: oasis_err2.SUCCESS, Message: oasis_err2.GetMsg(oasis_err2.SUCCESS)}) diff --git a/service/notify.go b/service/notify.go index ab52bc9..5eccf56 100644 --- a/service/notify.go +++ b/service/notify.go @@ -47,11 +47,13 @@ type notifyServer struct { func (i *notifyServer) SendFileOperateNotify(nowSend bool) { if nowSend { + len := 0 FileQueue.Range(func(k, v interface{}) bool { len++ return true }) + model := notify.NotifyModel{} listMsg := make(map[string]interface{}) if len == 0 { @@ -91,7 +93,9 @@ func (i *notifyServer) SendFileOperateNotify(nowSend bool) { } else { task.Status = "PROCESSING" } + if temp.ProcessedSize >= temp.TotalSize { + task.Finished = true task.Status = "FINISHED" FileQueue.Delete(v)