feat(ops): WeCom webhook alerts for pay/redeem anomalies

Add outbound group-bot alerts, rate/amount rules, stuck-order cron, HQ test button, and health db/redis checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-02 16:01:30 +08:00
parent cb6ecaaba6
commit 3328c52cb4
27 changed files with 1036 additions and 103 deletions
@@ -1,9 +1,35 @@
import { Controller, Get } from '@nestjs/common';
import { PrismaService } from '../../common/prisma/prisma.module';
import { RedisService } from '../../common/redis/redis.service';
@Controller('health')
export class HealthController {
constructor(
private readonly prisma: PrismaService,
private readonly redis: RedisService,
) {}
@Get()
check() {
return { status: 'ok', service: 'dukang-api', version: 'prev1' };
async check() {
let db: 'ok' | 'error' = 'ok';
let redis: 'ok' | 'error' = 'ok';
try {
await this.prisma.$queryRaw`SELECT 1`;
} catch {
db = 'error';
}
try {
const pong = await this.redis.client.ping();
if (pong !== 'PONG') redis = 'error';
} catch {
redis = 'error';
}
const status = db === 'ok' && redis === 'ok' ? 'ok' : 'degraded';
return {
status,
service: 'dukang-api',
version: 'prev1',
checks: { db, redis },
};
}
}
@@ -1,5 +1,6 @@
import { Module } from '@nestjs/common';
import { HealthController } from './health.controller';
/** Prisma / Redis 已为 GlobalHealth 直接注入探活 */
@Module({ controllers: [HealthController] })
export class HealthModule {}