Commit 9b4245db by lzzzzl

新增登录校验

parent b08ea6b2
Showing with 23 additions and 1 deletions
package utils
import "os"
import (
"encoding/json"
"io/ioutil"
"os"
)
func PathExists(path string) (bool, error) {
_, err := os.Stat(path)
......@@ -12,3 +16,21 @@ func PathExists(path string) (bool, error) {
}
return false, err
}
// (fileSize string, lastTime string)
func PathFileInfo(path string) string {
files, _ := ioutil.ReadDir(path)
var index int
var infos = make([]map[string]interface{}, len(files))
for _, file := range files {
infos[index] = make(map[string]interface{})
infos[index]["file_size"] = file.Size()
infos[index]["last_modify"] = file.ModTime().Unix()
infos[index]["file_name"] = file.Name()
index++
}
data, _ := json.Marshal(infos)
return string(data)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment