Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
y-omicron committed Jul 29, 2022
1 parent b985a36 commit 2480bdb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func Success(cStr string, args ...any) {
if logContext.IsFile {
logContext.wg.Add(1)

fMsg := fmt.Sprintf("%s [ fatal ] %s", time.Now().Format(timeFormatLayout), cStr)
fMsg := fmt.Sprintf("%s [ success ] %s", time.Now().Format(timeFormatLayout), cStr)
logContext.fMsg <- fmt.Sprintf(fMsg, args...)
}
if LevelInfo < logContext.LogLevel {
Expand Down
18 changes: 18 additions & 0 deletions Util/func.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package Util

import (
"archive/zip"
"bytes"
"math/rand"
"os"
"time"
Expand Down Expand Up @@ -31,3 +33,19 @@ func OpenFileToWrite(filename string, date []byte) {
}
wf.Close()
}

// CreateZipFile 制作Zip文件
func CreateZipFile(FileName string, FileDate []byte) ([]byte, error) {
var buf bytes.Buffer
zipWriter := zip.NewWriter(&buf)
ioWriter, err := zipWriter.Create(FileName)
if err != nil {
return nil, err
}
_, err = ioWriter.Write(FileDate)
if err != nil {
return nil, err
}
zipWriter.Close()
return buf.Bytes(), nil
}

0 comments on commit 2480bdb

Please sign in to comment.