parent
f6c2ce45c1
commit
2bf423b42f
|
@ -1,4 +1,3 @@
|
||||||
.idea/
|
|
||||||
/web/node_modules
|
/web/node_modules
|
||||||
/web/dist
|
/web/dist
|
||||||
|
|
||||||
|
@ -33,3 +32,11 @@ server/uploads/
|
||||||
*.iml
|
*.iml
|
||||||
web/.pnpm-debug.log
|
web/.pnpm-debug.log
|
||||||
web/pnpm-lock.yaml
|
web/pnpm-lock.yaml
|
||||||
|
|
||||||
|
# binary files
|
||||||
|
*.exe
|
||||||
|
|
||||||
|
# SQLite database files
|
||||||
|
*.db
|
||||||
|
*.sqlite
|
||||||
|
*.sqlite3
|
||||||
|
|
|
@ -87,12 +87,12 @@ func (casbinService *CasbinService) UpdateCasbinApi(oldPath string, newPath stri
|
||||||
"v1": newPath,
|
"v1": newPath,
|
||||||
"v2": newMethod,
|
"v2": newMethod,
|
||||||
}).Error
|
}).Error
|
||||||
e := casbinService.Casbin()
|
|
||||||
err = e.LoadPolicy()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return err
|
|
||||||
|
e := casbinService.Casbin()
|
||||||
|
return e.LoadPolicy()
|
||||||
}
|
}
|
||||||
|
|
||||||
//@author: [piexlmax](https://github.com/piexlmax)
|
//@author: [piexlmax](https://github.com/piexlmax)
|
||||||
|
|
|
@ -67,7 +67,6 @@ func (m *Minio) UploadFile(file *multipart.FileHeader) (filePathres, key string,
|
||||||
}
|
}
|
||||||
f.Close() // 创建文件 defer 关闭
|
f.Close() // 创建文件 defer 关闭
|
||||||
|
|
||||||
|
|
||||||
// 对文件名进行加密存储
|
// 对文件名进行加密存储
|
||||||
ext := filepath.Ext(file.Filename)
|
ext := filepath.Ext(file.Filename)
|
||||||
filename := utils.MD5V([]byte(strings.TrimSuffix(file.Filename, ext))) + ext
|
filename := utils.MD5V([]byte(strings.TrimSuffix(file.Filename, ext))) + ext
|
||||||
|
@ -91,8 +90,10 @@ func (m *Minio) UploadFile(file *multipart.FileHeader) (filePathres, key string,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Minio) DeleteFile(key string) error {
|
func (m *Minio) DeleteFile(key string) error {
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
// Delete the object from MinIO
|
// Delete the object from MinIO
|
||||||
ctx, _ := context.WithTimeout(context.Background(), time.Second*5)
|
|
||||||
err := m.Client.RemoveObject(ctx, m.bucket, key, minio.RemoveObjectOptions{})
|
err := m.Client.RemoveObject(ctx, m.bucket, key, minio.RemoveObjectOptions{})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue