修复swagger

This commit is contained in:
2025-09-19 23:51:13 +08:00
parent 88e0fbfb64
commit cb63437e0e
8 changed files with 446 additions and 94 deletions

View File

@@ -117,7 +117,6 @@ func NewController(logger *logs.Logger, planRepo repository.PlanRepository, anal
// @Produce json
// @Param plan body CreatePlanRequest true "计划信息"
// @Success 200 {object} controller.Response{data=plan.PlanResponse} "业务码为201代表创建成功"
// @Failure 200 {object} controller.Response "业务失败具体错误码和信息见响应体例如400, 500"
// @Router /api/v1/plans [post]
func (c *Controller) CreatePlan(ctx *gin.Context) {
var req CreatePlanRequest
@@ -159,7 +158,6 @@ func (c *Controller) CreatePlan(ctx *gin.Context) {
// @Produce json
// @Param id path int true "计划ID"
// @Success 200 {object} controller.Response{data=plan.PlanResponse} "业务码为200代表成功获取"
// @Failure 200 {object} controller.Response "业务失败具体错误码和信息见响应体例如400, 404, 500"
// @Router /api/v1/plans/{id} [get]
func (c *Controller) GetPlan(ctx *gin.Context) {
// 1. 从 URL 路径中获取 ID
@@ -197,7 +195,6 @@ func (c *Controller) GetPlan(ctx *gin.Context) {
// @Tags 计划管理
// @Produce json
// @Success 200 {object} controller.Response{data=plan.ListPlansResponse} "业务码为200代表成功获取列表"
// @Failure 200 {object} controller.Response "业务失败具体错误码和信息见响应体例如400, 500"
// @Router /api/v1/plans [get]
func (c *Controller) ListPlans(ctx *gin.Context) {
// 1. 调用仓库层获取所有计划
@@ -231,7 +228,6 @@ func (c *Controller) ListPlans(ctx *gin.Context) {
// @Param id path int true "计划ID"
// @Param plan body UpdatePlanRequest true "更新后的计划信息"
// @Success 200 {object} controller.Response{data=plan.PlanResponse} "业务码为200代表更新成功"
// @Failure 200 {object} controller.Response "业务失败具体错误码和信息见响应体例如400, 404, 500"
// @Router /api/v1/plans/{id} [put]
func (c *Controller) UpdatePlan(ctx *gin.Context) {
// 1. 从 URL 路径中获取 ID
@@ -303,7 +299,6 @@ func (c *Controller) UpdatePlan(ctx *gin.Context) {
// @Produce json
// @Param id path int true "计划ID"
// @Success 200 {object} controller.Response "业务码为200代表删除成功"
// @Failure 200 {object} controller.Response "业务失败具体错误码和信息见响应体例如400, 404, 500"
// @Router /api/v1/plans/{id} [delete]
func (c *Controller) DeletePlan(ctx *gin.Context) {
// 1. 从 URL 路径中获取 ID
@@ -332,7 +327,6 @@ func (c *Controller) DeletePlan(ctx *gin.Context) {
// @Produce json
// @Param id path int true "计划ID"
// @Success 200 {object} controller.Response "业务码为200代表成功启动计划"
// @Failure 200 {object} controller.Response "业务失败具体错误码和信息见响应体例如400, 404, 500"
// @Router /api/v1/plans/{id}/start [post]
func (c *Controller) StartPlan(ctx *gin.Context) {
// 占位符:此处应调用服务层或仓库层来启动计划
@@ -347,7 +341,6 @@ func (c *Controller) StartPlan(ctx *gin.Context) {
// @Produce json
// @Param id path int true "计划ID"
// @Success 200 {object} controller.Response "业务码为200代表成功停止计划"
// @Failure 200 {object} controller.Response "业务失败具体错误码和信息见响应体例如400, 404, 500"
// @Router /api/v1/plans/{id}/stop [post]
func (c *Controller) StopPlan(ctx *gin.Context) {
// 占位符:此处应调用服务层或仓库层来停止计划