GetSkillFileTree godoc @Summary 获取技能文件树 @Description 获取技能包内的完整文件目录结构 @Tags 技能库-后台 @Accept json @Produce json @Security BearerAuth @Param id path int true "技能ID" @Success 200 {object} model.CommonResponse{data=controller.SkillFileTreeResponse} @Router /api/admin/skill-library/{id}/files [get]
(c *gin.Context)
| 592 | // @Success 200 {object} model.CommonResponse{data=controller.SkillFileTreeResponse} |
| 593 | // @Router /api/admin/skill-library/{id}/files [get] |
| 594 | func GetSkillFileTree(c *gin.Context) { |
| 595 | skillID, err := strconv.ParseInt(c.Param("id"), 10, 64) |
| 596 | if err != nil || skillID <= 0 { |
| 597 | c.JSON(http.StatusBadRequest, model.ParamError.ToResponse(nil)) |
| 598 | return |
| 599 | } |
| 600 | |
| 601 | eid := config.GetEID(c) |
| 602 | svc := service.NewSkillLibraryService() |
| 603 | |
| 604 | files, err := svc.GetSkillFileTree(c.Request.Context(), eid, skillID) |
| 605 | if err != nil { |
| 606 | toSkillAdminErrorResponse(c, err) |
| 607 | return |
| 608 | } |
| 609 | |
| 610 | c.JSON(http.StatusOK, model.Success.ToResponse(&SkillFileTreeResponse{ |
| 611 | Files: files, |
| 612 | })) |
| 613 | } |
| 614 | |
| 615 | // SkillFileContentResponse represents the response for file content |
| 616 | type SkillFileContentResponse struct { |
nothing calls this directly
no test coverage detected