👷添加ci
Some checks reported errors
continuous-integration/drone/tag Build was killed

This commit is contained in:
coward
2024-05-08 14:21:49 +08:00
parent 8bcd3266d6
commit e1902ad176
4 changed files with 47 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package utils
import (
"fmt"
"gitee.ltd/lxh/logger/log"
"os"
"time"
"wireguard-dashboard/client"
@@ -31,6 +32,11 @@ func (fileSystem) UploadFile(file []byte, suffix string) (filePath string, err e
return ossObj.LongPath, nil
case "local":
filePath = fmt.Sprintf("%v/%d-avatar%s", config.Config.File.Path, time.Now().Unix(), suffix)
// 创建目录
if err = os.MkdirAll(filePath, os.FileMode(0777)); err != nil {
log.Errorf("本地存储目录创建失败: %v", err)
return "", err
}
if err = os.WriteFile(filePath, file, os.FileMode(0777)); err != nil {
return "", err
}