重构架构

This commit is contained in:
2026-02-20 18:44:43 +08:00
parent aba7b68439
commit cc71248ef4
52 changed files with 1404 additions and 2360 deletions

View File

@@ -1,8 +1,11 @@
package utils
import (
"crypto/rand"
"encoding/hex"
"os"
"os/exec"
"time"
)
// CommandExists 检查命令是否存在
@@ -16,3 +19,15 @@ func FileExists(path string) bool {
_, err := os.Stat(path)
return err == nil || !os.IsNotExist(err)
}
func GenerateID() (string, error) {
bytes := make([]byte, 16)
if _, err := rand.Read(bytes); err != nil {
return "", err
}
return hex.EncodeToString(bytes), nil
}
func GetTimestamp() string {
return time.Now().Format("2006-01-02 15:04:05")
}