<?php
declare(strict_types=1);require_once __DIR__.'/native.php';
function coreApp($scenario){global $root,$runtime;sourceProof();if(!defined('TP_ENV')){define('TP_ENV','poc');define('BUSINESS','aizhct');define('ENTERPRISE_NO','10001');require $root.'/vendor/autoload.php';spl_autoload_register(static function($class)use($root){if(preg_match('/printer|MQTT|BaiduDishes|\\\\Face$|storage\\\\Driver|QwRobot|GuzzleHttp\\\\Client|Alipay\\\\|OSS\\\\|EasyWeChat\\\\/i',$class))throw new RuntimeException('External HTTP/SDK denied');foreach(['app\\'=>'app/','cores\\'=>'cores/'] as $p=>$d)if(strpos($class,$p)===0){$file=$root.'/'.$d.str_replace('\\','/',substr($class,strlen($p))).'.php';if(is_file($file))require $file;}},true,true);}$app=new \think\App($root);$app->setEnvName('poc');$app->setRuntimePath($runtime.'/runtime/');$app->initialize();$app->config->set(['default'=>'file','stores'=>['file'=>['type'=>'File','path'=>$runtime.'/cache/','prefix'=>'CDXCUSTOMER_WEIGHT_RETEST','expire'=>0]]],'cache');$app->instance('cache',new \think\Cache($app));$log=$app->config->get('log');$log['close']=true;foreach($log['channels'] as &$c)$c['close']=true;unset($c);$app->config->set($log,'log');$app->instance('log',new \think\Log($app));$app->log->channel()->close();require_once __DIR__.'/NativePdo.php';CoreGate::$scenario=$scenario;CoreGate::$ids=json_decode(file_get_contents($runtime.'/prepared.json'),true)['ids'];CoreGate::$started=time();$cfg=$app->config->get('database');$connections=[];foreach(['mysql'=>'AI','mysql_zhct'=>'ZHCT'] as $name=>$db){$c=$cfg['connections'][$name];$c['type']=getenv('POC_DIALECT')==='dm'?'\\'.CoreDm::class:'\\'.CoreMysql::class;foreach(['HOST'=>'hostname','PORT'=>'hostport','SCHEMA'=>'database','USER'=>'username','PASSWORD'=>'password','CHARSET'=>'charset','PREFIX'=>'prefix'] as $k=>$to)$c[$to]=getenv('POC_'.$db.'_'.$k);$c['debug']=false;$c['trigger_sql']=true;$c['break_reconnect']=false;$c['fields_cache']=false;$c['dsn']='';$c['params']=[];$connections[$name]=$c;}$cfg['default']='mysql';$cfg['connections']=$connections;$app->config->set($cfg,'database');$app->db->setConfig($app->config);$app->env->set('store.host',['customer.read.invalid'=>10001]);$app->env->set('redis.hostname','');return $app;}
