package service import ( "gitea.timerzz.com/kedaya_haitao/common/pkg/web" "gitea.timerzz.com/kedaya_haitao/profitRate/rate" "github.com/gofiber/fiber/v3" ) type ProfitRate struct { ctl *rate.Controller } func NewProfitRate(ctl *rate.Controller) *ProfitRate { return &ProfitRate{ ctl: ctl, } } func (s *ProfitRate) Registry(r fiber.Router) { api := r.Group("/api/v2") api.Post("article/profit_rate/:id", s.Rate) } func (s *ProfitRate) Rate(c fiber.Ctx) error { id := c.Params("id") if err := s.ctl.Rate(c.Context(), id); err != nil { return err } return c.JSON(web.NewResponse("ok")) }