Readme add Telegram

This commit is contained in:
xiaomlove
2022-02-23 15:19:09 +08:00
parent d8cc4dc972
commit 28a99fef5d
5 changed files with 25 additions and 7 deletions

View File

@@ -239,4 +239,23 @@ class HitAndRunRepository extends BaseRepository
return true;
}
public function getStatusStats($uid, $formatted = true)
{
$results = HitAndRun::query()->where('uid', $uid)
->selectRaw('status, count(*) as counts')
->groupBy('status')
->get()
->pluck('counts', 'status');
if ($formatted) {
return sprintf(
'%s/%s/%s',
$results->get(HitAndRun::STATUS_INSPECTING, 0),
$results->get(HitAndRun::STATUS_UNREACHED, 0),
Setting::get('hr.ban_user_when_counts_reach')
);
}
return $results;
}
}