<?php
require_once __DIR__.'/Gate.php';$GLOBALS['ACT_BUDGET']=$budget;define('RUNTIME_PATH',__DIR__.'/runtime/');require $root.'/external_stubs.php';
if(!function_exists('json')){function json($data=[],$code=200,array $header=[],$options=[]){return \think\Response::create($data,'json',$code,$header,$options);}}
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'=>'CDXACT11W1'],'cache');\think\Config::set('redis',[]);\think\Config::set($cfg,'database');\think\Db::clear();
$effective=\think\Config::get('database');$aiCfg=$effective;foreach(['hostname','hostport','database','username','password','prefix']as $k)$aiCfg[$k]=$ai[$k];
foreach([['store',$effective],['ai',$aiCfg]]as $item){[$schema,$conf]=$item;$conn=$schema==='store'?\think\Db::connect():get_ai_db();$opts=$options;$opts[PDO::ATTR_STATEMENT_CLASS]=['ActStatement',[$schema]];$native=new ActPDO($dsn($conf),$conf['username'],$conf['password'],$opts);$native->schema=$schema;foreach(['links'=>[0=>$native],'linkID'=>$native,'attrCase'=>PDO::CASE_LOWER]as $name=>$value){$rp=new ReflectionProperty(\think\db\Connection::class,$name);$rp->setAccessible(true);$rp->setValue($conn,$value);}}
\think\Loader::addNamespace('Overtrue\\Pinyin',$root.'/vendor/overtrue/pinyin/src');
