Browse Source

调整hash 计算方式

master
453530270@qq.com 2 years ago
parent
commit
4c72fc5ac3
  1. 20
      fssc/internal/handler/webconsole.go
  2. 2
      fssc/web/wbconsole.tmpl

20
fssc/internal/handler/webconsole.go

@ -3,7 +3,6 @@ package handler
import (
"fmt"
"fssc/config"
"fssc/internal/db"
"fssc/internal/util"
"fssc/web"
"html/template"
@ -19,7 +18,7 @@ func WebConsole(w http.ResponseWriter, r *http.Request) {
// 路径
urlpath := r.URL.Query().Get("p")
if urlpath == "Li4=" {
urlpath = ""
urlpath = "."
}
//文件名
@ -43,7 +42,7 @@ func WebConsole(w http.ResponseWriter, r *http.Request) {
realFilePath := filepath.Join(config.G.FilePath, abupath)
downloadPath := filepath.Join(filepath.Base(config.G.FilePath), abupath)
// 相对路径
relpath := filepath.Join(abupath, "../")
relpath := filepath.Join(abupath, ".")
fmt.Printf("relpath is %s\n", relpath)
//
fileInfo, err := os.Stat(realFilePath)
@ -81,21 +80,6 @@ func WebConsole(w http.ResponseWriter, r *http.Request) {
return
}
data.Files = files
// 计算文件的hash和其他信息
for _, f := range files {
// 结构体信息
tf := db.StFileInfo{}
tf.Fname = f.Name()
tf.Fpath = filepath.Join(relpath, f.Name())
// 文件的hash
tf.Fhash = util.CalacHash(f.Name())
//add
ret := db.Sqlite_add(tf)
fmt.Printf("add ST-FileInfo is:%d\n", ret)
//log.Fatalln("add ST-FileInfo is:%d\n",ret)
}
} else {
data.FileName = filepath.Base(realFilePath)
}

2
fssc/web/wbconsole.tmpl

@ -211,7 +211,7 @@
}
if(v.isbackup==1){
html+="<div class=\"col-md-2\"><a href=\"javascript:void(0);\" class=\"btn btn-warning btn-sm recbtn\"></a></div>";
html+="<div class=\"col-md-2\"></div>";
}else {
html+="<div class=\"col-md-2\"></div>";
}

Loading…
Cancel
Save