webadmin系统设置

This commit is contained in:
2026-07-12 22:52:40 +08:00
parent 236a2a87a5
commit 1bd152073a
41 changed files with 1413 additions and 151 deletions
@@ -8,7 +8,6 @@ import type { IPayProvider, PayOrderResult } from './pay.interface';
@Injectable()
export class PayWechatProvider implements IPayProvider {
private readonly logger = new Logger(PayWechatProvider.name);
private readonly config = loadAppConfig();
constructor(
private readonly prisma: PrismaService,
@@ -16,11 +15,11 @@ export class PayWechatProvider implements IPayProvider {
) {}
async payOrder(orderId: bigint, openId?: string): Promise<PayOrderResult> {
if (this.config.mockPay) {
if (loadAppConfig().mockPay) {
return { mode: 'mock', externalNo: `MOCK-${Date.now()}` };
}
if (!this.wechat.isPayEnabled()) {
throw new Error('微信支付未配置:请设置 WECHAT_PAY_ENABLED=true 与 WX_MCH_ID 等商户参数');
throw new Error('微信支付未配置:请关闭 MOCK_PAY 并配置 WX_MCH_ID 等商户参数');
}
if (!openId) {
throw new Error('微信支付需要用户 openId,请先完成微信授权登录');