From 54dfc300c0f0f4d1a3b5bf0f316c6c447f4eeded Mon Sep 17 00:00:00 2001 From: jiangyong Date: Sun, 9 Mar 2025 22:11:07 +0800 Subject: [PATCH] nockechin --- qyweixin/app_checkin.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qyweixin/app_checkin.go b/qyweixin/app_checkin.go index 9d0341b..87c8411 100644 --- a/qyweixin/app_checkin.go +++ b/qyweixin/app_checkin.go @@ -9,6 +9,7 @@ import ( "github.com/smbrave/goutil" "github.com/spf13/cast" "gorm.io/gorm/utils" + "strings" "time" ) @@ -118,6 +119,7 @@ func (q *AppCheckin) GetCheckinData(startDay, endDay string, userIds []string) ( key := fmt.Sprintf("%s_%s", userid, checkDay) var userData *UserCheckIn = nil var ok bool + if userData, ok = checkData[key]; !ok { userData = new(UserCheckIn) userData.UserId = userid @@ -129,11 +131,14 @@ func (q *AppCheckin) GetCheckinData(startDay, endDay string, userIds []string) ( userData.Exception += goutil.If(userData.Exception != "", ",", "") userData.Exception += checkinType + ":" + exceptionType } - userData.Rawdata = goutil.If(userData.Rawdata == "", "", "\n") + goutil.EncodeJSON(dat) + + userData.Rawdata += goutil.If(userData.Rawdata == "", "", "\n") + goutil.EncodeJSON(dat) if checkinType == "上班打卡" { userData.StartTime = goutil.If(userData.StartTime == 0 || checkinTime < userData.StartTime, checkinTime, userData.StartTime) + userData.StartTime = goutil.If(strings.Contains(exceptionType, "未打卡"), 0, userData.StartTime) } else if checkinType == "下班打卡" { userData.EndTime = goutil.If(checkinTime > userData.EndTime, checkinTime, userData.EndTime) + userData.EndTime = goutil.If(strings.Contains(exceptionType, "未打卡"), 0, userData.EndTime) } else { log.Errorf("不支持的打卡类型:%s %s", checkinType, goutil.EncodeJSON(dat)) }