<?php
$lane=getenv('BC_LANE');$root=getenv('BC_ROOT');$base=getenv('BC_BASE');
if(!in_array($lane,['B','C'],true)||$root!==__DIR__.'/source'||is_link($root)){http_response_code(503);exit;}
$path=parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH);
if($path==='/__poc_boundary'){require $base.'/public/index.php';return;}
if($path!=='/p/bill/add'||$_SERVER['REQUEST_METHOD']!=='POST'){http_response_code(403);exit;}
require $root.'/env.php';
if(!function_exists('json')){function json($data=[],$code=200,array $header=[],$options=[]){return \think\Response::create($data,'json',$code,$header,$options);}}
if(getenv('POC_EXTERNAL_STUBS')!=='1'){http_response_code(503);exit;}
require $root.'/external_stubs.php';define('APP_PATH',$root.'/application/');require $root.'/thinkphp/base.php';
\think\App::initCommon();\think\Request::instance()->pathinfo();
$cfg=require $root.'/application/database.php';$cfg['debug']=true;$cfg['sql_explain']=false;\think\Config::set($cfg,'database');\think\Config::set('isSanmeiLiuyang',false);\think\Db::clear();
require __DIR__.'/SqlCoverageRecorder.php';$observer=new SqlCoverageRecorder(__DIR__.'/events-'.$lane.'.jsonl',$root,'PILOT_BILL_ADD');\think\Db::listen([$observer,'observe']);register_shutdown_function([$observer,'finish']);
\think\App::run()->send();
