<?php
$lane=getenv('MR3_LANE');$root=getenv('MR3_ROOT');$expected=$lane==='B'?'/tmp/zhct-http-store-mysql.dQTTBP':'/tmp/zhct-dm-poc-20260928.fcpiiN/store';
if(!in_array($lane,['B','C'],true)||$root!==$expected||is_link($root)){http_response_code(503);exit;}
$path=parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH);
$get=['/api/order/list','/api/order/detail'];$post=[];
if(!((in_array($path,$get,true)&&$_SERVER['REQUEST_METHOD']==='GET')||(in_array($path,$post,true)&&$_SERVER['REQUEST_METHOD']==='POST'))){http_response_code(403);exit;}
$_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);}}
if(getenv('POC_EXTERNAL_STUBS')!=='1'){http_response_code(503);exit;}require $root.'/external_stubs.php';
$sourceRoot=__DIR__.'/source';if(!is_dir($sourceRoot.'/application')||is_link($sourceRoot.'/application')){http_response_code(503);exit;}
define('APP_PATH',$sourceRoot.'/application/');define('RUNTIME_PATH',__DIR__.'/runtime/');require $root.'/thinkphp/base.php';
\think\App::initCommon();\think\Request::instance()->pathinfo();\think\Log::init(['type'=>'File','path'=>__DIR__.'/runtime/safe-log/','level'=>['no_raw_application_log']]);
\think\Config::set(['type'=>'File','path'=>__DIR__.'/cache/','prefix'=>'MR3_'],'cache');
$database=require $root.'/application/database.php';\think\Config::set($database,'database');\think\Db::clear();\think\App::run()->send();
