<?php
$lane=getenv('MR3_LANE');$root=getenv('MR3_ROOT');$path=parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH);$actions=['lists','select','detail','create','update','delete','changeStatus'];$action=substr((string)$path,strlen('/api/marketingStrategy/'));
if(!($path==='/__poc_boundary'||(strpos((string)$path,'/api/marketingStrategy/')===0&&in_array($action,$actions,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);}}
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'=>'MS10_'],'cache');\think\Config::set('redis',[]);$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(['allowlist'=>'owned-expired-marketing-only','external_stubs'=>class_exists(\app\common\Serve::class,false),'original_debug'=>$database['debug']??null]);exit;}
if(in_array($action,['create','update'],true)){$post=\think\Request::instance()->post();$stall=$lane==='B'?77:12;if(strpos((string)($post['strategyName']??''),'CDXMS10')!==0||($post['effectiveType']??0)!=2||($post['effectiveRange']??[])!==['2010-01-01','2010-01-02']||array_map('intval',(array)($post['restaurantIds']??[]))!==[$stall]){http_response_code(403);exit;}}
\think\App::run()->send();
