35 lines
1.1 KiB
PHP
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";
|