Accept isolated WORKSHOP-RESOURCE-RECORD-v1 delivery
Record explicit workshop acceptance and preserve subsequent synthetic work without accepting receivables. Keep 080000/070000 unapplied, real workshop grants pending and operational issuance blocks intact. Exclude local credentials and real-data preservation reports.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
$app=require __DIR__.'/../bootstrap/app.php'; $app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
||||
\App\Modules\Services\ServiceReceivables::guard();
|
||||
$in=json_decode(stream_get_contents(STDIN),true,32,JSON_THROW_ON_ERROR);
|
||||
app(\App\Shared\Context\CompanyContext::class)->selectFor($in['actor'],$in['tenant'],$in['company'],$in['unit']);
|
||||
if($in['pause']??false) {
|
||||
$paused=false; \Illuminate\Support\Facades\DB::listen(function($q)use(&$paused){
|
||||
if(!$paused && str_contains($q->sql,'"companies"') && str_contains($q->sql,'for update')) { $paused=true; echo "LOCK_HELD\n"; flush(); usleep(1200000); }
|
||||
});
|
||||
}
|
||||
try {
|
||||
$s=app(\App\Modules\Services\ServiceReceivables::class);
|
||||
if($in['method']==='sql_allocate') {
|
||||
$result=\Illuminate\Support\Facades\DB::transaction(function()use($in) {
|
||||
if($in['pause']??false) { \Illuminate\Support\Facades\DB::table('companies')->where('id',$in['company'])->lockForUpdate()->firstOrFail(); }
|
||||
$id=\Illuminate\Support\Facades\DB::table('sr_effects')->insertGetId($in['sql']); return ['id'=>$id];
|
||||
});
|
||||
} else $result=$s->{$in['method']}($in['id'],$in['actor'],$in['input'],$in['key']);
|
||||
echo json_encode(['status'=>200,'result'=>$result],JSON_THROW_ON_ERROR).PHP_EOL;
|
||||
} catch(\Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $e) {
|
||||
echo json_encode(['status'=>$e->getStatusCode()],JSON_THROW_ON_ERROR).PHP_EOL;
|
||||
} catch(\Illuminate\Database\QueryException $e) {
|
||||
if(!str_contains($e->getMessage(),'SGF_SR_')) throw $e;
|
||||
echo json_encode(['status'=>409,'database_guard'=>true],JSON_THROW_ON_ERROR).PHP_EOL;
|
||||
}
|
||||
Reference in New Issue
Block a user