health-go/handlers/RecordHandler.go
2024-10-20 16:31:37 +08:00

34 lines
625 B
Go

package handlers
import (
"github.com/gin-gonic/gin"
"health-go/config"
"health-go/models"
"net/http"
)
// FetchAllRecords 每个用户全部化验记录
func FetchAllRecords(c *gin.Context) {
var records []models.Check
result := config.DB.Where("user_id = ?", c.Query("user_id")).Find(&records)
if result.Error != nil {
c.JSON(http.StatusInternalServerError, gin.H{
"code": 500,
"msg": "内部服务器错误",
"data": nil,
})
return
}
c.JSON(http.StatusOK, gin.H{
"code": 200,
"msg": "ok",
"data": records,
})
}
func InsertRecord(c *gin.Context) {
//var aNewRecord models.CheckItem
}