diff --git a/.gitignore b/.gitignore index 5f7b8d3809..a25df7bb36 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -.idea/ /web/node_modules /web/dist @@ -33,3 +32,11 @@ server/uploads/ *.iml web/.pnpm-debug.log web/pnpm-lock.yaml + +# binary files +*.exe + +# SQLite database files +*.db +*.sqlite +*.sqlite3 diff --git a/server/plugin/announcement/model/info.go b/server/plugin/announcement/model/info.go index fcaa11f59d..42d62fe0aa 100644 --- a/server/plugin/announcement/model/info.go +++ b/server/plugin/announcement/model/info.go @@ -8,10 +8,10 @@ import ( // Info 公告 结构体 type Info struct { global.GVA_MODEL - Title string `json:"title" form:"title" gorm:"column:title;comment:公告标题;"` //标题 - Content string `json:"content" form:"content" gorm:"column:content;comment:公告内容;type:text;"` //内容 - 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"` //附件 + Title string `json:"title" form:"title" gorm:"column:title;comment:公告标题;"` //标题 + Content string `json:"content" form:"content" gorm:"column:content;comment:公告内容;type:text;"` //内容 + 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"` //附件 } // TableName 公告 Info自定义表名 gva_announcements_info diff --git a/server/service/system/sys_casbin.go b/server/service/system/sys_casbin.go index 3a315efbaa..6b54904c0e 100644 --- a/server/service/system/sys_casbin.go +++ b/server/service/system/sys_casbin.go @@ -87,12 +87,12 @@ func (casbinService *CasbinService) UpdateCasbinApi(oldPath string, newPath stri "v1": newPath, "v2": newMethod, }).Error - e := casbinService.Casbin() - err = e.LoadPolicy() if err != nil { return err } - return err + + e := casbinService.Casbin() + return e.LoadPolicy() } //@author: [piexlmax](https://github.com/piexlmax) diff --git a/server/utils/upload/minio_oss.go b/server/utils/upload/minio_oss.go index 3a6af72ce1..7ad5008cea 100644 --- a/server/utils/upload/minio_oss.go +++ b/server/utils/upload/minio_oss.go @@ -67,7 +67,6 @@ func (m *Minio) UploadFile(file *multipart.FileHeader) (filePathres, key string, } f.Close() // 创建文件 defer 关闭 - // 对文件名进行加密存储 ext := filepath.Ext(file.Filename) 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 { + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) + defer cancel() + // Delete the object from MinIO - ctx, _ := context.WithTimeout(context.Background(), time.Second*5) err := m.Client.RemoveObject(ctx, m.bucket, key, minio.RemoveObjectOptions{}) return err }