mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
userdetails page show bonus table
This commit is contained in:
@@ -20,6 +20,7 @@ use App\Models\Tag;
|
||||
use App\Models\Torrent;
|
||||
use App\Models\TorrentOperationLog;
|
||||
use App\Models\User;
|
||||
use App\Models\UserBanLog;
|
||||
use App\Repositories\AgentAllowRepository;
|
||||
use App\Repositories\AttendanceRepository;
|
||||
use App\Repositories\ExamRepository;
|
||||
@@ -89,10 +90,7 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$rep = new \NexusPlugin\HitAndRun\HitAndRunRepository();
|
||||
$rep->initSectionHitAndRunSetting(SearchBox::SECTION_BROWSE . "_");
|
||||
$rep->initSectionHitAndRunSetting(SearchBox::SECTION_SPECIAL . "_");
|
||||
clear_setting_cache();
|
||||
UserBanLog::clearUserBanLogDuplicate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,4 +7,23 @@ class UserBanLog extends NexusModel
|
||||
protected $table = 'user_ban_logs';
|
||||
|
||||
protected $fillable = ['uid', 'username', 'operator', 'reason'];
|
||||
|
||||
public static function clearUserBanLogDuplicate()
|
||||
{
|
||||
$lists = UserBanLog::query()
|
||||
->selectRaw("min(id) as id, uid, count(*) as counts")
|
||||
->groupBy('uid')
|
||||
->having("counts", ">", 1)
|
||||
->get();
|
||||
if ($lists->isEmpty()) {
|
||||
do_log("sql: " . last_query() . ", no data to delete");
|
||||
return;
|
||||
}
|
||||
$idArr = $lists->pluck("id")->toArray();
|
||||
$uidArr = $lists->pluck('uid')->toArray();
|
||||
$result = UserBanLog::query()->whereIn("uid", $uidArr)->whereNotIn("id", $idArr)->delete();
|
||||
do_log("sql: " . last_query() . ", result: $result");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user