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()
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)})

View File

@ -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)