From 96e68e967523758a6205d6306974a150d1225eda Mon Sep 17 00:00:00 2001 From: jiangyong Date: Sun, 2 Jun 2024 01:21:45 +0800 Subject: [PATCH] totalDays --- worker/staff.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/worker/staff.go b/worker/staff.go index dabdf2a..2e74bf0 100644 --- a/worker/staff.go +++ b/worker/staff.go @@ -110,7 +110,7 @@ func (s *Staff) SyncStaffSalary(month string) { month = time.Now().AddDate(0, -1, 0).Format("2006-01") } month = strings.ReplaceAll(month, "-", "") - totalDays := s.getTotalWorkDay(month) + //totalDays := s.getTotalWorkDay(month) monthTime, _ := time.ParseInLocation("200601", month, time.Local) startDate := cast.ToInt(monthTime.Format("20060102")) endDate := cast.ToInt(monthTime.AddDate(0, 1, -1).Format("20060102")) @@ -177,6 +177,7 @@ func (s *Staff) SyncStaffSalary(month string) { } // 打卡正常天数+补卡天数 为正常出勤天数 + totalDays := s.getTotalWorkDay(staff.Username, month) realWorkDays := s.getRealWorkDay(staff.Username, month) approvalCheckinDay := s.getApprovalCheckinDay(staff.Username, month) extra := make(map[string]interface{}) @@ -284,7 +285,11 @@ func (s *Staff) getRealWorkDay(username, month string) float64 { return realWorkdays } -func (s *Staff) getTotalWorkDay(month string) int64 { +func (s *Staff) getTotalWorkDay(username, month string) int64 { + checkins, _ := dao.NewCheckinDao().Query(username, month, false) + return int64(len(checkins)) +} +func (s *Staff) getTotalWorkDay_bak(month string) int64 { // 最多人数的应出勤天数 为真正的出勤天数 userCounts, err := dao.NewCheckinDao().CountUsername(month) if err != nil {