From 2547ea25b45dec27fe855204ec787ca82a6920bf Mon Sep 17 00:00:00 2001 From: hellcat Date: Sat, 17 Oct 2026 15:32:51 +0800 Subject: [PATCH] DPL operations snapshot Source commit: e26b5bc6cad9fc6f884e279fe567e7a08ff5f2ee --- panel-acceptance.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/panel-acceptance.php b/panel-acceptance.php index b09b86f..f922cdf 100644 --- a/panel-acceptance.php +++ b/panel-acceptance.php @@ -33,7 +33,13 @@ final class Acceptance { $j['id']=$u->id;$j['state']='active';if($apply)writeJson($path,$j); return ['state'=>'ready','id'=>$u->id,'owned'=>$j['owned']]; } - $u=User::where('group_id',$group)->where('banned',0)->whereRaw('u+dwhere(fn($q)=>$q->whereNull('expired_at')->orWhere('expired_at','>=',time()))->where('email','not like','node-qa-%')->where('email','not like','batch-acceptance-%')->orderBy('id')->first(); + $u=null; + $candidates=User::where('group_id',$group)->where('banned',0)->whereRaw('u+dwhere(fn($q)=>$q->whereNull('expired_at')->orWhere('expired_at','>=',time()))->where('email','not like','node-qa-%')->where('email','not like','batch-acceptance-%')->orderByDesc('is_admin')->orderBy('id')->limit(20)->get(); + foreach($candidates as $candidate){ + $effective=true; + foreach(ServerService::getAvailableServers($candidate) as $s)if(!ServerService::getAvailableUsers(Server::findOrFail($s['id']))->contains('id',$candidate->id)){$effective=false;break;} + if($effective){$u=$candidate;break;} + } if(!$apply)return ['state'=>$u?'existing':'would_create']; $j=['group'=>$group,'state'=>'prepared','owned'=>!$u,'email'=>$u?->email??'batch-acceptance-'.substr(hash('sha256',$dir),0,12).'-'.Str::lower(Str::random(8)).'@example.invalid','uuid'=>$u?->uuid??(string)Str::uuid(),'token'=>$u?->token??Str::random(32),'quota'=>104857600,'expires_at'=>time()+3600]; // Persist identity before commit. A lost response resumes the same row, never another user.