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 GetRecord(ctx *gin.Context) { keyName := ctx.GetHeader("keyName") record := dao.GetRecord(keyName) if record.KeyName == "" { ctx.JSON(http.StatusOK, response.Response{ Code: http.StatusOK, Message: "没有数据", Data: nil, }) return } var data response.Data data.KeyName = record.KeyName data.Size = record.Size data.CreateTime = record.CreateTime data.UploadTime = record.UploadTime data.Line = record.Line data.Machine = record.Machine data.Url = util.GetUrl(record.KeyName) data.Tags = util.GetTags(record.KeyName) ctx.JSON(http.StatusOK, response.GetResponse{ Code: 200, Message: "success", Data: data, }) }