Merge branch 'main' into dev

This commit is contained in:
link 2022-06-08 19:30:42 +08:00 committed by GitHub
commit 4db4393ed4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -199,6 +199,7 @@ func GetDownloadFile(c *gin.Context) {
defer ar.Close() defer ar.Close()
commonDir := file.CommonPrefix(filepath.Separator, list...) commonDir := file.CommonPrefix(filepath.Separator, list...)
currentPath := filepath.Base(commonDir) currentPath := filepath.Base(commonDir)
name := "_" + currentPath name := "_" + currentPath
@ -515,7 +516,9 @@ func PostOperateFileOrDir(c *gin.Context) {
if len(service.OpStrArr) == 1 { if len(service.OpStrArr) == 1 {
go service.ExecOpFile() go service.ExecOpFile()
go service.CheckFileStatus() go service.CheckFileStatus()
go service.MyService.Notify().SendFileOperateNotify(false) go service.MyService.Notify().SendFileOperateNotify(false)
} }
c.JSON(http.StatusOK, model.Result{Success: oasis_err2.SUCCESS, Message: oasis_err2.GetMsg(oasis_err2.SUCCESS)}) c.JSON(http.StatusOK, model.Result{Success: oasis_err2.SUCCESS, Message: oasis_err2.GetMsg(oasis_err2.SUCCESS)})

View File

@ -47,11 +47,13 @@ type notifyServer struct {
func (i *notifyServer) SendFileOperateNotify(nowSend bool) { func (i *notifyServer) SendFileOperateNotify(nowSend bool) {
if nowSend { if nowSend {
len := 0 len := 0
FileQueue.Range(func(k, v interface{}) bool { FileQueue.Range(func(k, v interface{}) bool {
len++ len++
return true return true
}) })
model := notify.NotifyModel{} model := notify.NotifyModel{}
listMsg := make(map[string]interface{}) listMsg := make(map[string]interface{})
if len == 0 { if len == 0 {
@ -91,7 +93,9 @@ func (i *notifyServer) SendFileOperateNotify(nowSend bool) {
} else { } else {
task.Status = "PROCESSING" task.Status = "PROCESSING"
} }
if temp.ProcessedSize >= temp.TotalSize { if temp.ProcessedSize >= temp.TotalSize {
task.Finished = true task.Finished = true
task.Status = "FINISHED" task.Status = "FINISHED"
FileQueue.Delete(v) FileQueue.Delete(v)