From 28a99fef5d8e6dc586ebc769c5443d07e09891ca Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Wed, 23 Feb 2022 15:19:09 +0800 Subject: [PATCH] Readme add Telegram --- README-EN.md | 1 + README.md | 6 +----- app/Console/Commands/Test.php | 4 +++- app/Repositories/HitAndRunRepository.php | 19 +++++++++++++++++++ include/functions.php | 2 +- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/README-EN.md b/README-EN.md index d6b9608d..d98bcb55 100644 --- a/README-EN.md +++ b/README-EN.md @@ -27,3 +27,4 @@ Complete PT website building solution. Based on NexusPHP + Laravel Framework + E ## More information Blog:[https://nexusphp.org](https://nexusphp.org/) Documentation:[https://doc.nexusphp.org](https://doc.nexusphp.org/en/) +Telegram: [https://t.me/nexusphp](https://t.me/nexusphp) diff --git a/README.md b/README.md index 8f3aa942..0d9496d0 100644 --- a/README.md +++ b/README.md @@ -23,15 +23,11 @@ - Mysql: 5.7最新版或以上版本 - Redis:1.0.0或以上版本 -## 捐赠 -此程序由个人维护,如果对你有帮助,可以请我喝杯咖啡。感谢以下捐赠者: - -**初心、陌路つ** - ## 更多信息 博客:[https://nexusphp.org](http://nexusphp.org/) 论坛:[https://discuss.nexusphp.org](https://discuss.nexusphp.org/) 文档:[https://doc.nexusphp.org](http://doc.nexusphp.org/) +Telegram: [https://t.me/nexusphp](https://t.me/nexusphp) QQ群: [764452568](https://jq.qq.com/?_wv=1027&k=IbltZcIx) ![扫码加入](http://demo.nexusphp.org/attachments/202105/20210508190106ed3a3620fc34ab12660586652bc74e34.png) diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index 0667899f..267e76b5 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -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); } diff --git a/app/Repositories/HitAndRunRepository.php b/app/Repositories/HitAndRunRepository.php index 6213c638..fb5513a1 100644 --- a/app/Repositories/HitAndRunRepository.php +++ b/app/Repositories/HitAndRunRepository.php @@ -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; + + } } diff --git a/include/functions.php b/include/functions.php index 3514c248..f5b8c954 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2489,7 +2489,7 @@ else { Torrents seeding Torrents leeching   - H&R: %s/%s]', get_row_count('hit_and_runs', "where uid = {$CURUSER['id']} and status = 3"), get_setting('hr.ban_user_when_counts_reach'))?> + H&R: %s]', (new \App\Repositories\HitAndRunRepository())->getStatusStats($CURUSER['id']))?> = UC_SYSOP) { ?> []