来源仓库:jxc/ai-fresh-delivery 来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d 快照树: 09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件) 按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据 (生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、 deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值), 整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。 供应商系统后续开发自本提交开始。
50 lines
1.9 KiB
Bash
50 lines
1.9 KiB
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
ENV=/opt/ai-fresh-delivery/server/.env
|
|
cd /opt/ai-fresh-delivery/server
|
|
|
|
echo "=== .env thresholds ==="
|
|
grep -E '^ARK_BALANCE_' "$ENV" || true
|
|
|
|
echo ""
|
|
echo "=== service vs .env mtime ==="
|
|
echo "service_started: $(systemctl show ai-fresh-api -p ActiveEnterTimestamp --value)"
|
|
echo "env_modified: $(stat -c '%y' "$ENV" | cut -d. -f1)"
|
|
|
|
echo ""
|
|
echo "=== effective thresholds (env + db) ==="
|
|
node <<'NODE'
|
|
require('./dist/env.js').loadEnv();
|
|
const { pool } = require('./dist/db.js').pool ? { pool: require('./dist/db.js').pool } : require('./dist/db.js');
|
|
const { getArkBalanceStatus } = require('./dist/services/arkBalanceService.js');
|
|
|
|
(async () => {
|
|
const envWarn = Number(process.env.ARK_BALANCE_WARN_YUAN) || 100;
|
|
const envCritical = Number(process.env.ARK_BALANCE_CRITICAL_YUAN) || 20;
|
|
console.log('env_warn_yuan:', envWarn);
|
|
console.log('env_critical_yuan:', envCritical);
|
|
|
|
const db = await pool.query(
|
|
`SELECT config_value FROM system_configs
|
|
WHERE config_key = 'ark_balance_alert' AND branch_code IS NULL LIMIT 1`
|
|
);
|
|
console.log('db_config:', JSON.stringify(db.rows[0]?.config_value || null));
|
|
|
|
const status = await getArkBalanceStatus({ forceRefresh: true });
|
|
console.log('effective_warn_yuan:', status.thresholds.warnYuan);
|
|
console.log('effective_critical_yuan:', status.thresholds.criticalYuan);
|
|
console.log('notify_interval_hours:', status.thresholds.notifyIntervalHours);
|
|
console.log('billing_configured:', status.billingConfigured);
|
|
console.log('query_ok:', status.queryOk);
|
|
console.log('available_balance_yuan:', status.availableBalanceYuan);
|
|
console.log('alert_level:', status.alertLevel);
|
|
console.log('alert_message:', status.alertMessage || '(none)');
|
|
if (status.error) console.log('error:', status.error);
|
|
|
|
await pool.end();
|
|
})().catch((e) => {
|
|
console.error('FAIL', e.message);
|
|
pool.end().finally(() => process.exit(1));
|
|
});
|
|
NODE
|