From 9ec19f946763c5bd000d7b0131d5d79372a1db78 Mon Sep 17 00:00:00 2001 From: jiangyong27 Date: Fri, 4 Aug 2023 18:56:44 +0800 Subject: [PATCH] check data is nil --- common/qyweixin/qyweixin.go | 3 +++ worker/checkin.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/common/qyweixin/qyweixin.go b/common/qyweixin/qyweixin.go index c7fca9f..bd673e6 100644 --- a/common/qyweixin/qyweixin.go +++ b/common/qyweixin/qyweixin.go @@ -131,5 +131,8 @@ func (q *QyWeixin) GetCheckinData(day, userId string) (*UserCheckIn, error) { userData.EndTime = cast.ToInt64(c["checkin_time"]) } } + if userData.EndTime == 0 && userData.StartTime == 0 { + return nil, nil + } return userData, nil } diff --git a/worker/checkin.go b/worker/checkin.go index 41e6146..98aea64 100644 --- a/worker/checkin.go +++ b/worker/checkin.go @@ -37,6 +37,9 @@ func SyncCheckin(day string) error { log.Errorf("qyweixin get checkin error :%s", err.Error()) continue } + if realCheckin == nil { + continue + } if realCheckin.StartTime != 0 { checkin.StartTime = realCheckin.StartTime }