refactor(App): 移除服务器地址和自动启动配置功能
- 注释掉 serverUrl 相关的响应式变量定义 - 注释掉 autoStart 相关的响应式变量定义 - 移除进度列表中的测试数据注释 - 注释掉服务器地址验证逻辑 - 注释掉服务器地址和自动启动的写入配置函数 - 注释掉配置加载中的相关字段赋值 - 在模板中隐藏服务器地址输入框和自动启动复选框组件
This commit is contained in:
@@ -20,8 +20,6 @@ import (
|
||||
"golang.org/x/sync/errgroup"
|
||||
)
|
||||
|
||||
var progress sync.Map
|
||||
|
||||
type Task struct {
|
||||
FilePath string
|
||||
FileLines int
|
||||
@@ -34,7 +32,9 @@ type Progress struct {
|
||||
Percentage int `json:"percentage"`
|
||||
}
|
||||
|
||||
func StartUpload(ctx context.Context, logChan *chan string, lookingPath string) {
|
||||
var progress sync.Map
|
||||
|
||||
func StartUpload(ctx context.Context, logChan *chan string) {
|
||||
AddLog(logChan, "===============================================")
|
||||
AddLog(logChan, `服务器: `+config.APPConfig.Url)
|
||||
AddLog(logChan, `Token: `+config.APPConfig.Token)
|
||||
@@ -70,7 +70,7 @@ func StartUpload(ctx context.Context, logChan *chan string, lookingPath string)
|
||||
|
||||
//开启上传程序
|
||||
for {
|
||||
uploadData(ctx, logChan, lookingPath)
|
||||
uploadData(ctx, logChan)
|
||||
select {
|
||||
case <-time.After(time.Minute):
|
||||
case <-ctx.Done():
|
||||
@@ -79,11 +79,11 @@ func StartUpload(ctx context.Context, logChan *chan string, lookingPath string)
|
||||
}
|
||||
}
|
||||
|
||||
func uploadData(ctx context.Context, logChan *chan string, lookingPath string) {
|
||||
|
||||
func uploadData(ctx context.Context, logChan *chan string) {
|
||||
// 获取检测目录
|
||||
var path = "./"
|
||||
if lookingPath != "" {
|
||||
path = lookingPath
|
||||
if config.APPConfig.CheckDir != "" {
|
||||
path = config.APPConfig.CheckDir
|
||||
}
|
||||
|
||||
//获取文件列表
|
||||
@@ -97,6 +97,7 @@ func uploadData(ctx context.Context, logChan *chan string, lookingPath string) {
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
|
||||
//检测到文件
|
||||
//统计文件行数
|
||||
fileLines := make(map[string]int)
|
||||
@@ -111,6 +112,7 @@ func uploadData(ctx context.Context, logChan *chan string, lookingPath string) {
|
||||
if err != nil {
|
||||
AddLog(logChan, "打开文件失败:"+err.Error())
|
||||
}
|
||||
|
||||
// 使用 bufio.Scanner 逐行读取
|
||||
scanner := bufio.NewScanner(file)
|
||||
lineCount := 0
|
||||
@@ -127,6 +129,7 @@ func uploadData(ctx context.Context, logChan *chan string, lookingPath string) {
|
||||
AddLog(logChan, fmt.Sprintf("%s 文件行数:%v", filepath.Base(filePath), lineCount))
|
||||
}
|
||||
}
|
||||
|
||||
if isAllEmpty {
|
||||
AddLog(logChan, "所有文件都为空,不进行上传")
|
||||
return
|
||||
@@ -196,7 +199,7 @@ func getTxtFiles(dir string) (txtFiles []string, err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
// 只处理普通文件,跳过目录
|
||||
// 跳过目录,只处理普通文件
|
||||
if !info.Mode().IsRegular() {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user