package service import ( "os" "path" "path/filepath" "time" "gat1400Exchange/config" "gat1400Exchange/models" ) func CleanExpireData() { var pos models.Positions pos.Clean() var cache models.Cache cache.Clean() if config.ClientConf.UploadType == "url" { imagePath := path.Join(config.LogConf.Path, "gat1400_face_images") deleteOldFolders(imagePath) } } func deleteOldFolders(root string) error { return filepath.Walk(root, func(path string, info os.FileInfo, err error) error { if err != nil { return err } if info.IsDir() && time.Now().Sub(info.ModTime()) > 24*time.Hour { return os.RemoveAll(path) } return nil }) }