fix(server-go): 健康画像 handler 读取 roomId 参数(此前取空导致 404)
This commit is contained in:
@@ -29,7 +29,7 @@ func RegisterHealthProfileRoutes(rg *gin.RouterGroup, db *gorm.DB) {
|
|||||||
// roomHealthProfile 单蚕房健康画像:巡检风险/检测结果/事件聚合 → 综合健康分
|
// roomHealthProfile 单蚕房健康画像:巡检风险/检测结果/事件聚合 → 综合健康分
|
||||||
func roomHealthProfile(db *gorm.DB) gin.HandlerFunc {
|
func roomHealthProfile(db *gorm.DB) gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
id := c.Param("id")
|
id := c.Param("roomId")
|
||||||
var room model.Room
|
var room model.Room
|
||||||
if db.Where("id = ?", id).First(&room).Error != nil {
|
if db.Where("id = ?", id).First(&room).Error != nil {
|
||||||
c.JSON(http.StatusNotFound, gin.H{"error": "room not found"})
|
c.JSON(http.StatusNotFound, gin.H{"error": "room not found"})
|
||||||
|
|||||||
Reference in New Issue
Block a user