profitRate/service/profitRate_svc.go
timerzz ba83361243
Some checks are pending
Build image / build (push) Waiting to run
feat 版本用latest
2024-09-13 21:23:03 +08:00

31 lines
606 B
Go

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"))
}