mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
improve IP Search getRecords()
This commit is contained in:
@@ -126,13 +126,12 @@ class IpSearch extends Page implements HasTable
|
||||
->whereRaw("iplog.ip = '{$filters['ip']['ip']}'")
|
||||
;
|
||||
$total = $query->clone()->distinct()->count('iplog.userid');
|
||||
$records = $query->groupBy('iplog.userid')
|
||||
->orderByDesc('ip_last_access')
|
||||
->forPage($page, $recordsPerPage)
|
||||
->get()
|
||||
;
|
||||
|
||||
if ($records->isNotEmpty()) {
|
||||
if ($total > 0) {
|
||||
$records = $query->groupBy('iplog.userid')
|
||||
->orderByDesc('ip_last_access')
|
||||
->forPage($page, $recordsPerPage)
|
||||
->get()
|
||||
;
|
||||
$userIdArr = $records->pluck('userid')->toArray();
|
||||
$ipCountResult = IpLog::query()
|
||||
->whereIn('userid', $userIdArr)
|
||||
|
||||
Reference in New Issue
Block a user