Skip to content

Commit

Permalink
修复 补签不会累计以前的签到天数的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
liufei-ereach committed Jul 31, 2024
1 parent 680ca82 commit a47d2fe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Api/Controller/PostCheckinHistoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Mattoid\CheckinHistory\Api\Controller;

use Carbon\Carbon;
use DateTime;
use Flarum\Api\Controller\AbstractCreateController;
use Flarum\Foundation\ValidationException;
Expand Down Expand Up @@ -132,7 +133,7 @@ protected function data(ServerRequestInterface $request, Document $document)
$totalContinuousCheckinCountHistory = 0;
// 需要确认是连续签到,并且补签的前一天和后一天都没有漏签
$tomorrow = date('Y-m-d',strtotime("1 days",strtotime($checkinDate)));
$signedinCount = UserCheckinHistory::query()->where('user_id', $userId)->where('last_checkin_date', $tomorrow)->count();
$signedinCount = UserCheckinHistory::query()->where('user_id', $userId)->where('last_checkin_date', '>=', $tomorrow)->count();
if (isset($spanDayCheckin) && !$spanDayCheckin && empty($signedinCount)) {
throw new ValidationException(['message' => $this->translator->trans('mattoid-daily-check-in-history.api.error.span-day-checkin', ['date' => $checkinDate])]);
}
Expand Down
2 changes: 0 additions & 2 deletions src/Api/Controller/PostGiveCheckinCardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ public function __construct(SettingsRepositoryInterface $settings, Dispatcher $e
*/
protected function data(ServerRequestInterface $request, Document $document)
{

app("log")->info(json_encode($request->getParsedBody()));
$actor = RequestUtil::getActor($request);
$userId = Arr::get($actor, 'id');
$username = Arr::get($request->getParsedBody(), 'username');
Expand Down

0 comments on commit a47d2fe

Please sign in to comment.