api.go 588 B

12345678910111213141516171819202122232425
  1. package report
  2. import (
  3. "strconv"
  4. "github.com/gin-gonic/gin"
  5. "wails-app/internal/model/common/response"
  6. "wails-app/internal/modules/report/service"
  7. )
  8. var reportSvc = service.ReportService{}
  9. func RevenueReport(c *gin.Context) {
  10. lotID, _ := strconv.Atoi(c.Query("parking_lot_id"))
  11. items, err := reportSvc.RevenueReport(c.Query("start_date"), c.Query("end_date"), uint(lotID))
  12. if err != nil {
  13. response.FailWithMessage(err.Error(), c)
  14. return
  15. }
  16. response.OkWithData(items, c)
  17. }
  18. func SetupReportRouter(router *gin.RouterGroup) {
  19. router.GET("/report/revenue", RevenueReport)
  20. }