Skip to content

Commit

Permalink
修复 跨天补签导致连续天数不累加的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
liufei-ereach committed Sep 25, 2024
1 parent 1c43ea1 commit 90253d7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Api/Controller/PostCheckinHistoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ protected function data(ServerRequestInterface $request, Document $document)
throw new ValidationException(['message' => $this->translator->trans('mattoid-daily-check-in-history.api.error.span-day-checkin', ['date' => $checkinDate])]);
}
$yesterday = date('Y-m-d',strtotime("-1 days",strtotime($checkinDate)));
$historyResult = UserCheckinHistory::query()->where('user_id', $userId)->where('last_checkin_date', $yesterday)->first();
if ($historyResult && $signedinCount >= $diffDay) {
# 补签的数据不累加连续天数,只计算当前不填的天数,即连续天数+1
$historyResult = UserCheckinHistory::query()->where('user_id', $userId)->where('last_checkin_date', $yesterday)->where('type', 0)->first();
if ($historyResult) {
$totalContinuousCheckinCountHistory = $historyResult->total_continuous_checkin_count;
}

Expand Down

0 comments on commit 90253d7

Please sign in to comment.