<?php
declare(strict_types=1);

// Deliberately dormant. No execution approval exists at the time of writing.
$lane = (string)getenv('CDX_USER_QR_LANE');
$mode = $argv[1] ?? '';
$approved = in_array($lane, ['A', 'B', 'C'], true)
    && count($argv) === 2
    && in_array($mode, ['--execute', '--audit-zero'], true)
    && (string)getenv('CDX_USER_QR_RUN') === 'ROOT_APPROVED_DB_ONLY_QRCODE_V1'
    && hash_equals((string)hash_file('sha256', __FILE__),
        (string)getenv('CDX_USER_QR_RUN_SHA'));
if (!$approved) {
    echo json_encode(['status' => 'default-deny', 'db_connected' => false,
        'business_http_sent' => false, 'dml_sent' => false,
        'image_created' => false]), PHP_EOL;
    exit(78);
}
// The current POC external_stubs.php intercepts Serve/UserApi, not the OSS
// storage engine. Until an enforceable isolated OSS/no-egress stub is reviewed,
// even matching approval variables and SHA cannot start this write harness.
const QR_STORAGE_ISOLATION_VERIFIED = false;
if (!QR_STORAGE_ISOLATION_VERIFIED) {
    echo json_encode(['status' => 'storage-isolation-blocked',
        'db_connected' => false, 'business_http_sent' => false,
        'dml_sent' => false, 'image_created' => false]), PHP_EOL;
    exit(78);
}
$stage = 'bootstrap';
$businessHttpSent = false;
set_exception_handler(static function (Throwable $error) use (&$stage, &$businessHttpSent): void {
    echo json_encode(['status' => 'stopped', 'stage' => $stage,
        'error_class' => get_class($error), 'code' => (string)$error->getCode(),
        'business_http_sent' => $businessHttpSent,
        'recovery' => 'retain_private_journal_and_inspect; never_blind_retry'],
        JSON_UNESCAPED_SLASHES), PHP_EOL;
    exit(2);
});
set_error_handler(static function (int $severity): bool {
    if (!(error_reporting() & $severity)) return false;
    throw new ErrorException('redacted warning', 0, $severity);
});
$stage = 'approved_source_and_select_only_preflight';
$preflight = __DIR__ . '/preflight_user_qrcode.php';
if (!hash_equals('4b49a4741e7c2fa4a87d6877013b7fdbb07af6e288b0ad28e8f6567004e80fa4',
    (string)hash_file('sha256', $preflight))) {
    throw new RuntimeException('Preflight source drift');
}
putenv('CDX_USER_QR_PREFLIGHT=ROOT_APPROVED_QR_SOURCE_READ_V1');
putenv('CDX_USER_QR_SHA=4b49a4741e7c2fa4a87d6877013b7fdbb07af6e288b0ad28e8f6567004e80fa4');
$outerArgv = $argv;
$argv[1] = '--preflight-only';
ob_start();
require $preflight;
$preflightText = (string)ob_get_clean();
$argv = $outerArgv;
restore_exception_handler();
restore_error_handler();
$preflightResult = json_decode(trim($preflightText), true);
if (!is_array($preflightResult)
    || ($preflightResult['status'] ?? '') !== 'select_only_pass'
    || ($preflightResult['lane'] ?? '') !== $lane
    || (string)($preflightResult['paycode_file'] ?? '') !== '2'
    || (string)($preflightResult['paycode_expires_in'] ?? '') !== '60'
    || (string)($preflightResult['ai_storage_default'] ?? '') !== 'aliyun') {
    throw new RuntimeException('Current paycode_file=2/no-image boundary not proven');
}
// Source SHA above fixes the only createQrcode call behind paycode_file == 1.
// Thus this approved branch cannot call Upload/OSS or write uploads/temp.
$ai->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
$store->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
$root = ['A' => '/private/tmp/zhct-http-ai-macos.zjaU8h',
    'B' => '/private/tmp/zhct-http-ai-macos.x2CCZX',
    'C' => '/tmp/zhct-ai-http-20260929.3XDj3w'][$lane];
$port = ['A' => 18105, 'B' => 18101, 'C' => 18102][$lane];
$base = 'http://127.0.0.1:' . $port;
$cachePath = realpath($root . '/runtime/cache');
if (realpath($root) !== $root || $cachePath !== $root . '/runtime/cache'
    || (((int)fileperms($root) & 0077) !== 0)
    || !hash_equals('ccf1c56eb4178f3eaad8775e26a27742b2cacf662b46fb058cbb91d23783b8c6',
        (string)hash_file('sha256', $root . '/config/cache.php'))
    || is_file($root . '/.env') || is_file($root . '/.env.poc')
    || getenv('CACHE_DRIVER') !== false || getenv('cache.driver') !== false) {
    throw new RuntimeException('Private File-cache boundary drift');
}
$envEvidence = $lane === 'C' ? ($raw ?? '') : ($cmd ?? '');
if (preg_match('/(?:^|[\s\x00])(?:CACHE_DRIVER|cache\.driver)=/i',
    (string)$envEvidence) === 1) {
    throw new RuntimeException('HTTP cache override detected');
}
$table = static function (string $base, bool $aiTable = true) use ($dialect): string {
    $prefix = $aiTable ? 'yoshop_' : 'ydy_';
    $name = $prefix . $base;
    return $dialect === 'dm' ? strtoupper($name) : $name;
};
$fetch = static function (PDO $db, string $sql, array $values = []): array {
    $statement = $db->prepare($sql);
    $statement->execute($values);
    return array_map(static function (array $row): array {
        return array_change_key_case($row, CASE_LOWER);
    }, $statement->fetchAll(PDO::FETCH_ASSOC));
};
$scalar = static function (PDO $db, string $sql, array $values = []) use ($fetch): int {
    $rows = $fetch($db, $sql, $values);
    return (int)($rows[0]['n'] ?? 0);
};
$marker = (string)getenv('CDX_USER_QR_MARKER');
$userIdForAudit = (int)getenv('CDX_USER_QR_AI_ID');
$storeIdForAudit = (int)getenv('CDX_USER_QR_STORE_ID');
if ($mode === '--audit-zero') {
    if (preg_match('/^CDXQR[A-F0-9]{12}$/D', $marker) !== 1
        || $userIdForAudit <= 0 || $storeIdForAudit <= 0
        || (string)getenv('CDX_USER_QR_AUDIT') !== 'ROOT_APPROVED_INDEPENDENT_ZERO_V1') {
        throw new RuntimeException('Independent audit scope invalid');
    }
    $checks = [
        'ai_user' => $scalar($ai, 'SELECT COUNT(*) AS n FROM ' . $table('user')
            . ' WHERE USER_ID=? AND NICK_NAME=?', [$userIdForAudit, $marker]),
        'store_user' => $scalar($store, 'SELECT COUNT(*) AS n FROM ' . $table('user', false)
            . ' WHERE ID=? AND ACCOUNT=? AND AI_USER_ID=?',
            [$storeIdForAudit, $marker, $userIdForAudit]),
        'user_code' => $scalar($store, 'SELECT COUNT(*) AS n FROM ' . $table('user_code', false)
            . ' WHERE USER_ID=? AND TYPE=4', [$storeIdForAudit]),
    ];
    if ($checks !== ['ai_user' => 0, 'store_user' => 0, 'user_code' => 0]) {
        throw new RuntimeException('Independent owned-row zero audit failed');
    }
    echo json_encode(['status' => 'independent_zero', 'lane' => $lane,
        'owned_rows' => $checks, 'business_http_sent' => false,
        'dml_sent' => false]), PHP_EOL;
    exit(0);
}
$stage = 'exclusive_and_fixture_boundary';
if ($marker !== '' || $userIdForAudit !== 0 || $storeIdForAudit !== 0) {
    throw new RuntimeException('Execute mode must generate its own identity');
}
$lockName = $lane === 'C' ? 'cdx-user-qr-c.lock' : 'cdx-user-qr-dev-mysql.lock';
$lock = fopen(sys_get_temp_dir() . '/' . $lockName, 'c');
if ($lock === false || !flock($lock, LOCK_EX | LOCK_NB)) {
    throw new RuntimeException('Exclusive A/B/C writer lock unavailable');
}
$marker = 'CDXQR' . strtoupper(bin2hex(random_bytes(6)));
$uuid = strtoupper(bin2hex(random_bytes(16)));
$token = 'CDXQRT' . strtoupper(bin2hex(random_bytes(18)));
$aiTable = $table('user');
$storeTable = $table('user', false);
$codeTable = $table('user_code', false);
$uploadTable = $table('upload_file');
$configTable = $table('config', false);
$globalCounts = static function () use ($ai, $store, $scalar,
    $uploadTable, $codeTable): array {
    return [
        'ai_upload' => $scalar($ai, 'SELECT COUNT(*) AS n FROM ' . $uploadTable),
        'store_type4' => $scalar($store,
            'SELECT COUNT(*) AS n FROM ' . $codeTable . ' WHERE TYPE=4'),
    ];
};
$fileInventory = static function () use ($root): string {
    $dir = $root . '/public/uploads';
    if (!file_exists($dir)) return hash('sha256', 'absent');
    if (!is_dir($dir) || is_link($dir)) throw new RuntimeException('Upload root unsafe');
    $items = [];
    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir,
        FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST);
    foreach ($iterator as $info) {
        if ($info->isLink() || count($items) >= 5000) {
            throw new RuntimeException('Upload inventory unsafe or unbounded');
        }
        $items[] = [substr($info->getPathname(), strlen($dir)),
            $info->isDir() ? 'd' : 'f', $info->getSize(), $info->getMTime()];
    }
    sort($items);
    return hash('sha256', json_encode($items, JSON_UNESCAPED_SLASHES));
};
$cacheInventory = static function () use ($cachePath): string {
    $items = [];
    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($cachePath,
        FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST);
    foreach ($iterator as $info) {
        if ($info->isLink() || count($items) >= 5000) {
            throw new RuntimeException('Private cache inventory unsafe or unbounded');
        }
        $items[] = [substr($info->getPathname(), strlen($cachePath)),
            $info->isDir() ? 'd' : 'f', $info->getSize(), $info->getMTime()];
    }
    sort($items);
    return hash('sha256', json_encode($items, JSON_UNESCAPED_SLASHES));
};
if ($scalar($ai, 'SELECT COUNT(*) AS n FROM ' . $aiTable
        . ' WHERE NICK_NAME=? AND STORE_ID=10001', [$marker]) !== 0
    || $scalar($store, 'SELECT COUNT(*) AS n FROM ' . $storeTable
        . ' WHERE ACCOUNT=? OR UUID=?', [$marker, $uuid]) !== 0) {
    throw new RuntimeException('Synthetic marker collision');
}
$beforeCounts = $globalCounts();
$beforeFiles = $fileInventory();
$journalDir = sys_get_temp_dir() . '/cdx-user-qr-' . strtolower($marker);
if (file_exists($journalDir) || !mkdir($journalDir, 0700)) {
    throw new RuntimeException('Private recovery journal collision');
}
chmod($journalDir, 0700);
$journalPath = $journalDir . '/recovery.json';
$journal = ['lane' => $lane, 'marker' => $marker, 'ai_id' => 0,
    'store_id' => 0, 'code_id' => 0, 'phase' => 'prepared',
    'token' => $token, 'created_at' => time()];
$record = static function (array $change) use (&$journal, $journalPath): void {
    $journal = array_merge($journal, $change);
    $text = json_encode($journal, JSON_UNESCAPED_SLASHES);
    if (!is_string($text) || file_put_contents($journalPath, $text, LOCK_EX) === false
        || !chmod($journalPath, 0600)) {
        throw new RuntimeException('Private recovery journal write failed');
    }
};
$record([]);
$stage = 'insert_owned_ai_user';
$now = time();
$ai->prepare('INSERT INTO ' . $aiTable
    . ' (STORE_ID,MOBILE,NICK_NAME,BALANCE,GIFT_BALANCE,IS_DELETE,CREATE_TIME)'
    . ' VALUES (10001,?,?,?,?,0,?)')
    ->execute(['', $marker, '0.00', '0.00', $now]);
$aiRows = $fetch($make('POC_AI_'), 'SELECT USER_ID FROM ' . $aiTable
    . ' WHERE NICK_NAME=? AND STORE_ID=10001', [$marker]);
if (count($aiRows) !== 1 || (int)$aiRows[0]['user_id'] <= 0) {
    throw new RuntimeException('Owned AI insert ambiguous');
}
$aiId = (int)$aiRows[0]['user_id'];
$record(['phase' => 'ai_created', 'ai_id' => $aiId]);
$stage = 'insert_owned_store_user';
$store->prepare('INSERT INTO ' . $storeTable
    . ' (UUID,ACCOUNT,PWD,SALT,NAME,TYPE,STATUS,AI_USER_ID,PASSWORD_VERSION,'
    . ' CREATE_TIME,CREATE_BY,IS_DELETE)'
    . ' VALUES (?,?,?,?,?,0,0,?,0,?,?,0)')
    ->execute([$uuid, $marker, 'DISABLED', strtoupper(bin2hex(random_bytes(8))),
        $marker, $aiId, date('Y-m-d H:i:s'), $marker]);
$storeRows = $fetch($make('POC_'), 'SELECT ID,PASSWORD_VERSION FROM ' . $storeTable
    . ' WHERE ACCOUNT=? AND AI_USER_ID=?', [$marker, $aiId]);
if (count($storeRows) !== 1 || (int)$storeRows[0]['id'] <= 0
    || (int)$storeRows[0]['password_version'] !== 0) {
    throw new RuntimeException('Owned Store mapping ambiguous');
}
$storeId = (int)$storeRows[0]['id'];
$record(['phase' => 'store_created', 'store_id' => $storeId]);
if ($scalar($store, 'SELECT COUNT(*) AS n FROM ' . $codeTable
        . ' WHERE USER_ID=? AND TYPE=4', [$storeId]) !== 0) {
    throw new RuntimeException('Owned code precondition failed');
}
$stage = 'private_file_cache_token';
foreach ($config as $key => $value) {
    if (strpos($key, 'POC_') === 0) putenv($key . '=' . $value);
}
define('TP_ENV', 'poc');
define('BUSINESS', 'aizhct');
define('ENTERPRISE_NO', '10001');
require $root . '/vendor/autoload.php';
(new \think\App($root))->setEnvName('poc')->initialize();
if (strtolower((string)\think\facade\Config::get('cache.default')) !== 'file'
    || realpath((string)\think\facade\Config::get('cache.stores.file.path')) !== $cachePath
    || (string)\think\facade\Config::get('cache.stores.file.prefix') !== '') {
    throw new RuntimeException('Effective private cache mismatch');
}
if (!\think\facade\Cache::has('setting_10001')) {
    throw new RuntimeException('Login-setting File cache not prewarmed; no business HTTP');
}
$beforeCache = $cacheInventory();
if (!\think\facade\Cache::set($token, [
        'user' => ['user_id' => $aiId], 'password_version' => 0,
        'login_type' => 'thirdparty'], 300)) {
    throw new RuntimeException('Private token cache write failed');
}
$record(['phase' => 'token_created']);
$withTokenCache = $cacheInventory();
$stage = 'configuration_last_moment';
$configRows = $fetch($make('POC_'), 'SELECT CONFIG_VALUE FROM ' . $configTable
    . " WHERE CONFIG_KEY='paycode_file'");
if (count($configRows) !== 1 || (string)$configRows[0]['config_value'] !== '2'
    || $fileInventory() !== $beforeFiles || $globalCounts() !== $beforeCounts) {
    throw new RuntimeException('No-image/zero-other-side-effects precondition drift');
}
$stage = 'single_http_post';
$record(['phase' => 'http_started']);
$businessHttpSent = true;
$context = stream_context_create(['http' => [
    'method' => 'POST', 'timeout' => 12, 'ignore_errors' => true,
    'header' => 'Access-Token: ' . $token . "\r\n"
        . "platform: MP-WEIXIN\r\nversion: 2.0.51\r\n"
        . "env-version: develop\r\nenterprise-no: 10001\r\n"
        . "Content-Type: application/x-www-form-urlencoded\r\n",
    'content' => '',
]]);
$stream = @fopen($base . '/api/user/qrcode?storeId=10001', 'rb', false, $context);
$rawResponse = $stream === false ? false : stream_get_contents($stream, 1048577);
$businessHttpCode = isset($http_response_header[0])
    && preg_match('/HTTP\/\S+\s+(\d+)/', $http_response_header[0], $businessMatch)
        ? (int)$businessMatch[1] : 0;
if (is_resource($stream)) fclose($stream);
$stage = 'single_worker_completion_barrier';
$socket = @stream_socket_client('tcp://127.0.0.1:' . $port, $errno, $errstr, 5);
if ($socket === false) throw new RuntimeException('Listener socket barrier unavailable');
fclose($socket);
$barrier = json_decode((string)@file_get_contents($base . '/__poc_boundary', false,
    stream_context_create(['http' => ['timeout' => 8]])), true);
if (!is_array($barrier) || ($barrier['external_stubs'] ?? null) !== true) {
    throw new RuntimeException('Completion barrier unavailable; no cleanup');
}
if ($lane === 'C') {
    $cmdlineAfter = (string)file_get_contents('/proc/53772/cmdline');
    if (strpos($cmdlineAfter, '127.0.0.1:18102') === false
        || strpos($cmdlineAfter, $root . '/public') === false) {
        throw new RuntimeException('C listener changed before cleanup');
    }
} else {
    $listenerAfter = trim((string)shell_exec('/usr/sbin/lsof -t -nP -iTCP:'
        . $port . ' -sTCP:LISTEN 2>/dev/null'));
    if ($listenerAfter !== (string)['A' => 13109, 'B' => 13127][$lane]) {
        throw new RuntimeException('A/B listener changed before cleanup');
    }
}
$record(['phase' => 'http_completed']);
$stage = 'independent_response_and_db_readback';
if ($businessHttpCode !== 200 || !is_string($rawResponse)
    || strlen($rawResponse) > 1048576) {
    throw new RuntimeException('Bounded positive HTTP failed; retain journal');
}
$body = json_decode($rawResponse, true);
$data = is_array($body) ? ($body['data'] ?? null) : null;
if (!is_array($body) || (int)($body['status'] ?? 0) !== 200
    || !is_array($data) || array_keys($data) !== ['expires_in', 'file_path', 'paycode']
    || (string)($data['expires_in'] ?? '') !== '60'
    || !is_string($data['paycode'] ?? null)
    || preg_match('/^C[0-9a-f]{13}$/D', $data['paycode']) !== 1
    || ($data['file_path'] ?? null) !== '') {
    throw new RuntimeException('Positive response contract failed; retain journal');
}
$newStore = $make('POC_');
$newAi = $make('POC_AI_');
$newStore->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
$newAi->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
$codes = $fetch($newStore, 'SELECT ID,TYPE,PAYCODE,USER_ID,FILE_ID,FILE_PATH,'
    . ' EXPIRES_IN,START_TIME,END_TIME FROM ' . $codeTable
    . ' WHERE USER_ID=? AND TYPE=4', [$storeId]);
if (count($codes) !== 1 || (int)$codes[0]['id'] <= 0
    || 'C' . (string)$codes[0]['paycode'] !== $data['paycode']
    || (int)$codes[0]['file_id'] !== 0
    || (string)$codes[0]['file_path'] !== ''
    || (int)$codes[0]['expires_in'] !== 60
    || abs(strtotime((string)$codes[0]['end_time'])
        - strtotime((string)$codes[0]['start_time']) - 90) > 2) {
    throw new RuntimeException('Owned Store code row differs from HTTP contract');
}
$codeId = (int)$codes[0]['id'];
$record(['phase' => 'code_verified', 'code_id' => $codeId]);
if ($scalar($newAi, 'SELECT COUNT(*) AS n FROM ' . $uploadTable)
        !== $beforeCounts['ai_upload']
    || $fileInventory() !== $beforeFiles
    || $cacheInventory() !== $withTokenCache
    || $scalar($newStore, 'SELECT COUNT(*) AS n FROM ' . $codeTable
        . ' WHERE TYPE=4') !== $beforeCounts['store_type4'] + 1) {
    throw new RuntimeException('Unexpected upload/file/other-code side effect');
}
$afterConfig = $fetch($newStore, 'SELECT CONFIG_VALUE FROM ' . $configTable
    . " WHERE CONFIG_KEY='paycode_file'");
if (count($afterConfig) !== 1 || (string)$afterConfig[0]['config_value'] !== '2') {
    throw new RuntimeException('No-image config changed during HTTP');
}
$stage = 'precise_owned_cleanup';
$record(['phase' => 'cleanup_started']);
if (!$newStore->beginTransaction() || !$newAi->beginTransaction()) {
    throw new RuntimeException('Scoped cleanup transactions unavailable');
}
foreach ([
    [$newStore, 'DELETE FROM ' . $codeTable
        . ' WHERE ID=? AND USER_ID=? AND TYPE=4', [$codeId, $storeId]],
    [$newStore, 'DELETE FROM ' . $storeTable
        . ' WHERE ID=? AND ACCOUNT=? AND AI_USER_ID=?', [$storeId, $marker, $aiId]],
    [$newAi, 'DELETE FROM ' . $aiTable
        . ' WHERE USER_ID=? AND NICK_NAME=? AND STORE_ID=10001', [$aiId, $marker]],
] as $owned) {
    [$db, $sql, $values] = $owned;
    $delete = $db->prepare($sql);
    $delete->execute($values);
    if ($delete->rowCount() !== 1) {
        throw new RuntimeException('Owned row cleanup count not one');
    }
}
$record(['phase' => 'cleanup_delete_prepared']);
if (!$newStore->commit()) throw new RuntimeException('Store cleanup commit uncertain');
$record(['phase' => 'store_cleanup_committed']);
if (!$newAi->commit()) throw new RuntimeException('AI cleanup commit uncertain');
$record(['phase' => 'both_cleanup_committed']);
if (!\think\facade\Cache::delete($token)
    || \think\facade\Cache::has($token)) {
    throw new RuntimeException('Private token cleanup failed');
}
$record(['phase' => 'owned_rows_and_token_deleted']);
if ($globalCounts() !== $beforeCounts || $fileInventory() !== $beforeFiles
    || $cacheInventory() !== $beforeCache) {
    throw new RuntimeException('Post-cleanup global counts/file inventory drift');
}
$stage = 'independent_second_process_zero';
putenv('CDX_USER_QR_MARKER=' . $marker);
putenv('CDX_USER_QR_AI_ID=' . $aiId);
putenv('CDX_USER_QR_STORE_ID=' . $storeId);
putenv('CDX_USER_QR_AUDIT=ROOT_APPROVED_INDEPENDENT_ZERO_V1');
$command = [PHP_BINARY];
if ($lane === 'C') {
    array_push($command,
        '-d', 'extension=/home/dmdba/dmdbms/drivers/php_pdo/libphp74_dm.so',
        '-d', 'extension=/home/dmdba/dmdbms/drivers/php_pdo/php74_pdo_dm.so');
}
array_push($command, __FILE__, '--audit-zero');
$audit = proc_open($command,
    [0 => ['pipe', 'r'], 1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes);
if (!is_resource($audit)) throw new RuntimeException('Second-process zero audit unavailable');
fclose($pipes[0]);
$auditOut = stream_get_contents($pipes[1], 4097);
$auditErr = stream_get_contents($pipes[2], 1025);
fclose($pipes[1]);
fclose($pipes[2]);
$auditExit = proc_close($audit);
$auditJson = is_string($auditOut) ? json_decode(trim($auditOut), true) : null;
if ($auditExit !== 0 || !is_array($auditJson)
    || ($auditJson['status'] ?? '') !== 'independent_zero'
    || ($auditJson['lane'] ?? '') !== $lane
    || $auditErr !== '') {
    throw new RuntimeException('Second-process zero audit failed');
}
if (!unlink($journalPath) || !rmdir($journalDir)) {
    throw new RuntimeException('Private recovery journal cleanup failed');
}
echo json_encode(['status' => 'db_only_qrcode_verified', 'lane' => $lane,
    'http' => 200, 'business_status' => 200,
    'response_keys' => ['expires_in', 'file_path', 'paycode'],
    'expires_in_type' => gettype($data['expires_in']),
    'paycode_type' => gettype($data['paycode']),
    'file_path_type' => gettype($data['file_path']),
    'owned_store_code_created_then_zero' => true,
    'ai_upload_file_unchanged' => true, 'upload_tree_unchanged' => true,
    'independent_zero' => true, 'oss_invoked_by_code_branch' => false],
    JSON_UNESCAPED_SLASHES), PHP_EOL;
