fix(uploader): 修复上传器逻辑和UI提示问题
构建上传工具 / build (push) Successful in 1m23s

- 修复目录选择为空时不更改配置的逻辑
- 将警告提示改为错误提示以提高用户体验
- 优化停止运行时的成功提示
- 增加进度列表的最大高度以显示更多内容
- 调整定时器逻辑顺序避免提前退出
- 移除重复的任务等待错误处理
- 优化代码结构和空行格式
This commit is contained in:
2026-04-30 21:24:30 +08:00
parent 6bd82024d9
commit 03e4e6f45b
2 changed files with 13 additions and 11 deletions
+4 -6
View File
@@ -72,9 +72,9 @@ func StartUpload(ctx context.Context, logChan *chan string) {
for {
uploadData(ctx, logChan)
select {
case <-time.After(time.Minute):
case <-ctx.Done():
return
case <-time.After(time.Minute):
}
}
}
@@ -136,6 +136,7 @@ func uploadData(ctx context.Context, logChan *chan string) {
}
progress.Clear()
//添加文件上传任务参数(文件路径,文件行数)
var tasks []Task
for fileName, lines := range fileLines {
@@ -182,12 +183,9 @@ func uploadData(ctx context.Context, logChan *chan string) {
return
default:
// 等待所有任务完成
if err := g.Wait(); err != nil {
AddLog(logChan, fmt.Sprintf("任务执行出错: %v", err))
} else {
AddLog(logChan, "所有任务执行完成!")
}
g.Wait()
AddLog(logChan, "所有任务执行完成!")
AddLog(logChan, fmt.Sprintf("上传完成,耗时:%s", time.Since(start).String()))
}
}