<?php
$lane=getenv('MR3_LANE');$root=getenv('MR3_ROOT');$path=parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH);
if(!preg_match('~^/p/billingrecord/(list|lists|statistics|detail|logs|export)$~',$path)||!in_array($_SERVER['REQUEST_METHOD'],['GET','POST'],true)){http_response_code(403);exit;}
ob_start();register_shutdown_function(static function():void{$raw=(string)ob_get_contents();$entry=['method'=>$_SERVER['REQUEST_METHOD'],'url'=>$_SERVER['REQUEST_URI'],'status'=>http_response_code(),'response'=>$raw];file_put_contents(__DIR__.'/private-wire.jsonl',json_encode($entry,JSON_UNESCAPED_UNICODE)."\n",FILE_APPEND);chmod(__DIR__.'/private-wire.jsonl',0600);});
$_SERVER['PATH_INFO']=$path;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);}}
require $root.'/external_stubs.php';define('APP_PATH',__DIR__.'/source/application/');define('RUNTIME_PATH',__DIR__.'/runtime/');require $root.'/thinkphp/base.php';\think\App::initCommon();
\think\Log::init(['type'=>'File','path'=>__DIR__.'/runtime/safe-log/','level'=>['no_raw_application_log']]);\think\Config::set(['type'=>'File','path'=>__DIR__.'/cache/','prefix'=>'BILLGET10_'],'cache');\think\Config::set('redis',[]);
$database=require $root.'/application/database.php';\think\Config::set($database,'database');\think\Db::clear();
\think\App::run()->send();
