提交
This commit is contained in:
34
tests/order_source_self_check.php
Normal file
34
tests/order_source_self_check.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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";
|
||||
Reference in New Issue
Block a user