enterprise/server/controller/staff.go

33 lines
619 B
Go
Raw Normal View History

2023-09-04 21:59:27 +08:00
package controller
import (
"enterprise/server/service"
"github.com/gin-gonic/gin"
"strings"
"time"
)
type Staff struct {
}
func (s *Staff) Salary(ctx *gin.Context) {
month := ctx.Query("month")
tp := ctx.Query("type")
if month == "" {
month = time.Now().AddDate(0, -1, 0).Format("200601")
}
month = strings.ReplaceAll(month, "-", "")
if tp == "" {
tp = service.StaffSalaryTypeSummary
}
serv := new(service.StaffSalary)
if tp == service.StaffSalaryTypeAgent {
serv.Agent(month, ctx)
} else if tp == service.StaffSalaryTypeBank {
serv.Bank(month, ctx)
} else {
serv.Summary(month, ctx)
}
}