check data is nil

This commit is contained in:
jiangyong27 2023-08-04 18:56:44 +08:00
parent f2db7ceacf
commit 9ec19f9467
2 changed files with 6 additions and 0 deletions

View File

@ -131,5 +131,8 @@ func (q *QyWeixin) GetCheckinData(day, userId string) (*UserCheckIn, error) {
userData.EndTime = cast.ToInt64(c["checkin_time"]) userData.EndTime = cast.ToInt64(c["checkin_time"])
} }
} }
if userData.EndTime == 0 && userData.StartTime == 0 {
return nil, nil
}
return userData, nil return userData, nil
} }

View File

@ -37,6 +37,9 @@ func SyncCheckin(day string) error {
log.Errorf("qyweixin get checkin error :%s", err.Error()) log.Errorf("qyweixin get checkin error :%s", err.Error())
continue continue
} }
if realCheckin == nil {
continue
}
if realCheckin.StartTime != 0 { if realCheckin.StartTime != 0 {
checkin.StartTime = realCheckin.StartTime checkin.StartTime = realCheckin.StartTime
} }