enterprise/server/controller/staff.go

42 lines
806 B
Go
Raw Normal View History

2023-09-04 21:59:27 +08:00
package controller
import (
"enterprise/server/service"
2023-10-07 14:18:46 +08:00
"enterprise/worker"
2023-09-04 21:59:27 +08:00
"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)
}
}
2023-10-07 14:18:46 +08:00
func (s *Staff) SyncStaffInfo(ctx *gin.Context) {
go worker.SyncStaffInfo()
}
func (s *Staff) SyncStaffSalary(ctx *gin.Context) {
go worker.SyncStaffSalary("")
}