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

@@ -12,6 +12,7 @@ use App\Models\SearchBox;
use App\Models\Snatch;
use App\Models\User;
use App\Repositories\ExamRepository;
use App\Repositories\HitAndRunRepository;
use App\Repositories\SearchBoxRepository;
use App\Repositories\TorrentRepository;
use App\Repositories\UserRepository;
@@ -57,7 +58,8 @@ class Test extends Command
*/
public function handle()
{
$r = User::query()->first()->seed_points;
$rep = new HitAndRunRepository();
$r = $rep->getStatusStats(1)->get(2);
dd($r);
}

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;
}
}