<?php
$lane=getenv('DCW_LANE');$root=getenv('DCW_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);$action=substr($path,strlen('/api/dining_config/'));
$allowed=['areaCreate','areaUpdate','areaStatus','restaurantCreate','restaurantUpdate','restaurantStatus','areaDetail','restaurantDetail','restaurantList','restaurantOptions','stallOptions'];
if(!(($path==='/__poc_boundary'&&$_SERVER['REQUEST_METHOD']==='GET')||(strpos($path,'/api/dining_config/')===0&&in_array($action,$allowed,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'=>'DCW10_'],'cache');
$database=require $root.'/application/database.php';\think\Config::set($database,'database');\think\Db::clear();
if($path==='/__poc_boundary'){header('Content-Type: application/json');echo json_encode(['business'=>(string)\think\Config::get('business'),'business_constant'=>defined('BUSINESS')?BUSINESS:null,'school_feature'=>strtolower(trim((string)\think\Config::get('business')))==='zhct_stzc','external_stubs'=>class_exists(\app\common\Serve::class,false),'original_debug'=>$database['debug']??null]);exit;}
\think\App::run()->send();
