diff --git a/bots/bots.go b/bots/bots.go index 611a38f..f74c1e6 100644 --- a/bots/bots.go +++ b/bots/bots.go @@ -30,7 +30,7 @@ const ( func BotStart() { var err error - fmt.Println(logo) + fmt.Printf("%s\n", logo) //read config config.InitConfig() //Init Logger diff --git a/bots/handle.go b/bots/handle.go index ff976d7..c068981 100644 --- a/bots/handle.go +++ b/bots/handle.go @@ -189,7 +189,7 @@ func bExport(m *tb.Message) { MIME: "text/plain", } bot.Send(m.Chat, exportFile) - //不遗留本地文件 + if exportFile.InCloud() != true || os.Remove(fileName) != nil { zap.S().Errorw("failed to export files") } diff --git a/model/client.go b/model/client.go index eb9c239..b2ef1d9 100644 --- a/model/client.go +++ b/model/client.go @@ -182,7 +182,7 @@ func (c *Client) GetOutlookMails() error { if err != nil { return err } - //fmt.Println(string(content)) + //这里的.需要转义,否则会按路径的方式解析 if gjson.Get(string(content), "@odata\\.context").String() != "" { return nil diff --git a/util/util.go b/util/util.go index 5ac5572..1960b82 100644 --- a/util/util.go +++ b/util/util.go @@ -57,13 +57,12 @@ func GetPathFiles(path string) []string { return t } -// GetRecentLogs 输入文件夹路径,返回最近n个log的路径,不到n个返回所有 func GetRecentLogs(path string, n int) []string { var paths []string if !PathExists(path) { return paths } - //path末尾检查/ + if path[len(path)-1:] != "/" { path += "/" } @@ -71,7 +70,6 @@ func GetRecentLogs(path string, n int) []string { d, _ := time.ParseDuration("-24h") //不到n个返回所有 nt := Min(n, len(GetPathFiles(path))) - //fmt.Println(nt) for i := 1; i <= nt; { if PathExists(path + data.Format("2006-01-02") + ".log") { paths = append(paths, data.Format("2006-01-02")+".log")