Files
miniapi/tests/order_source_self_check.php
gaofeng e0aeff2af7 提交
2026-09-01 11:07:13 +08:00

35 lines
1.1 KiB
PHP

<?php
if (!function_exists('env')) {
function env(string $name, $default = null)
{
return $default;
}
}
$config = require __DIR__ . '/../config/miniapp.php';
$apps = (array)($config['apps'] ?? []);
if (($apps['evus_jn_app']['order_source'] ?? '') !== 'jnandroid') {
throw new RuntimeException('Android EVUS orders must use source jnandroid.');
}
if (($apps['jiuzhouqian-android']['order_source'] ?? '') !== 'jnandroid') {
throw new RuntimeException('Legacy Android clients must use source jnandroid.');
}
foreach (['evus_jn_mp', 'evus_bj_mp'] as $miniAppCode) {
if (($apps[$miniAppCode]['order_source'] ?? '') !== 'qlwxmini') {
throw new RuntimeException($miniAppCode . ' must keep source qlwxmini.');
}
}
foreach (['Evus.php', 'Esta.php'] as $controllerFile) {
$controller = file_get_contents(__DIR__ . '/../app/miniapi/controller/' . $controllerFile);
if (!is_string($controller) || !str_contains($controller, "['order_source'] ?? 'qlwxmini'")) {
throw new RuntimeException($controllerFile . ' must read source from the current mini app config.');
}
}
echo "order source self-check passed\n";