package api import ( "github.com/gin-gonic/gin" "net/http" "zggsong.cn/sandstone/server/dao" "zggsong.cn/sandstone/server/response" "zggsong.cn/sandstone/server/util" ) func ListAttachments(ctx *gin.Context) { var datas []response.Data var data response.Data var arrayData = dao.ListAttach() for _, i := range arrayData { data.CreateTime = i.CreateTime data.UploadTime = i.UploadTime data.Line = i.Line data.Machine = i.Machine data.KeyName = i.KeyName data.Size = i.Size data.Url = util.GetUrl(i.KeyName) data.Tags = util.GetTags(i.KeyName) datas = append(datas, data) } ctx.JSON(http.StatusOK, response.Response{ Code: http.StatusOK, Message: "success", Data: datas, }) }