ExecutableNodes handles retrieving executable nodes in a map
(c *gin.Context)
| 317 | |
| 318 | // ExecutableNodes handles retrieving executable nodes in a map |
| 319 | func (h *NodeHandler) ExecutableNodes(c *gin.Context) { |
| 320 | mapID := c.Param("mapID") |
| 321 | if mapID == "" { |
| 322 | c.JSON(http.StatusBadRequest, dto.Response{ |
| 323 | Code: http.StatusBadRequest, |
| 324 | Message: "map ID is required", |
| 325 | Data: nil, |
| 326 | Timestamp: time.Now(), |
| 327 | RequestID: uuid.New().String(), |
| 328 | }) |
| 329 | return |
| 330 | } |
| 331 | |
| 332 | // 获取当前节点ID(可选参数) |
| 333 | nodeID := c.Query("nodeID") |
| 334 | |
| 335 | // 调用service层获取可执行节点 |
| 336 | resp, err := h.NodeService.ExecutableNodes(c.Request.Context(), mapID, nodeID) |
| 337 | if err != nil { |
| 338 | c.JSON(http.StatusInternalServerError, dto.Response{ |
| 339 | Code: http.StatusInternalServerError, |
| 340 | Message: err.Error(), |
| 341 | Data: nil, |
| 342 | Timestamp: time.Now(), |
| 343 | RequestID: uuid.New().String(), |
| 344 | }) |
| 345 | return |
| 346 | } |
| 347 | |
| 348 | c.JSON(http.StatusOK, dto.Response{ |
| 349 | Code: http.StatusOK, |
| 350 | Message: "success", |
| 351 | Data: resp, |
| 352 | Timestamp: time.Now(), |
| 353 | RequestID: uuid.New().String(), |
| 354 | }) |
| 355 | } |
| 356 | |
| 357 | // ResetDecomposition handles resetting a decomposition |
| 358 | func (h *NodeHandler) ResetDecomposition(c *gin.Context) { |