chore: 同步本地 v9 整改与运营能力

This commit is contained in:
weijuesen
2026-08-17 21:43:26 +08:00
parent 9a426039b7
commit d205d4845b
58 changed files with 4042 additions and 115 deletions
+5 -1
View File
@@ -123,6 +123,10 @@ func createInspection(db *gorm.DB, s3 *service.S3Service, ai *service.AIClient,
c.JSON(http.StatusBadRequest, gin.H{"error": "roomId 不是合法的 UUID"})
return
}
if !canAccessRoom(db, c, &roomID) {
c.JSON(http.StatusForbidden, gin.H{"error": "无权在该蚕房下发起巡检"})
return
}
rec.RoomID = &roomID
}
if idemKey != "" {
@@ -283,7 +287,7 @@ func loadRoomRisk(db *gorm.DB, roomID string) (*float64, *float64) {
// listInspections 巡检记录列表(roomId/limit 过滤)
func listInspections(db *gorm.DB) gin.HandlerFunc {
return func(c *gin.Context) {
q := db.Model(&model.InspectionRecord{})
q := applyRoomScope(db.Model(&model.InspectionRecord{}), c, "room_id")
if room := c.Query("roomId"); room != "" {
q = q.Where("room_id = ?", room)
}