feat: meta readme

This commit is contained in:
Xhofe 2022-04-05 20:17:16 +08:00
parent c413c22201
commit 1428d90361
2 changed files with 7 additions and 2 deletions

View File

@ -12,6 +12,7 @@ type Meta struct {
Hide string `json:"hide"` Hide string `json:"hide"`
Upload bool `json:"upload"` Upload bool `json:"upload"`
OnlyShows string `json:"only_shows"` OnlyShows string `json:"only_shows"`
Readme string `json:"readme"`
} }
func GetMetaByPath(path string) (*Meta, error) { func GetMetaByPath(path string) (*Meta, error) {

View File

@ -60,6 +60,7 @@ type Meta struct {
Driver string `json:"driver"` Driver string `json:"driver"`
Upload bool `json:"upload"` Upload bool `json:"upload"`
Total int `json:"total"` Total int `json:"total"`
Readme string `json:"readme"`
//Pages int `json:"pages"` //Pages int `json:"pages"`
} }
@ -75,8 +76,10 @@ func Path(c *gin.Context) {
_, ok := c.Get("admin") _, ok := c.Get("admin")
meta, _ := model.GetMetaByPath(req.Path) meta, _ := model.GetMetaByPath(req.Path)
upload := false upload := false
if meta != nil && meta.Upload { readme := ""
upload = true if meta != nil {
upload = meta.Upload
readme = meta.Readme
} }
err := CheckPagination(&req) err := CheckPagination(&req)
if err != nil { if err != nil {
@ -137,6 +140,7 @@ func Path(c *gin.Context) {
Driver: driverName, Driver: driverName,
Upload: upload, Upload: upload,
Total: total, Total: total,
Readme: readme,
}, },
Files: files, Files: files,
}, },