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
|
||||||
|
|
|
@ -8,10 +8,10 @@ import (
|
||||||
// Info 公告 结构体
|
// Info 公告 结构体
|
||||||
type Info struct {
|
type Info struct {
|
||||||
global.GVA_MODEL
|
global.GVA_MODEL
|
||||||
Title string `json:"title" form:"title" gorm:"column:title;comment:公告标题;"` //标题
|
Title string `json:"title" form:"title" gorm:"column:title;comment:公告标题;"` //标题
|
||||||
Content string `json:"content" form:"content" gorm:"column:content;comment:公告内容;type:text;"` //内容
|
Content string `json:"content" form:"content" gorm:"column:content;comment:公告内容;type:text;"` //内容
|
||||||
UserID *int `json:"userID" form:"userID" gorm:"column:user_id;comment:发布者;"` //作者
|
UserID *int `json:"userID" form:"userID" gorm:"column:user_id;comment:发布者;"` //作者
|
||||||
Attachments datatypes.JSON `json:"attachments" form:"attachments" gorm:"column:attachments;comment:相关附件;"swaggertype:"array,object"` //附件
|
Attachments datatypes.JSON `json:"attachments" form:"attachments" gorm:"column:attachments;comment:相关附件;" swaggertype:"array,object"` //附件
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName 公告 Info自定义表名 gva_announcements_info
|
// TableName 公告 Info自定义表名 gva_announcements_info
|
||||||
|
|
|
@ -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