This commit is contained in:
2023-08-31 17:35:43 +08:00
parent 4adba55e88
commit c0c4d333da
2 changed files with 30 additions and 6 deletions

View File

@@ -354,6 +354,18 @@ func PathExists(path string) (bool, error) {
return false, err
}
// PathExists check path is exist or no
func FilePathExists(filePath string) (bool, error) {
_, err := os.Stat(filePath)
if err == nil { //文件或者目录存在
return true, nil
}
if os.IsNotExist(err) {
return false, nil
}
return false, err
}
func GetDayDuration(d1, d2 string) int64 {
a, _ := time.Parse("2006-01-02", d1)
b, _ := time.Parse("2006-01-02", d2)