短信验证调试成功

This commit is contained in:
2026-07-06 13:18:56 +08:00
parent 5ba69eb935
commit 1c978b8adc
62 changed files with 2491 additions and 354 deletions
@@ -14,6 +14,7 @@ import {
import { loadAppConfig, WECHAT_AUTH_REQUIRED } from '@dukang/shared-types';
import { PrismaService } from '../../common/prisma/prisma.module';
import { serializeBigInt } from '../../common/decorators/current-user.decorator';
import { AnalyticsService } from '../analytics/analytics.service';
import { CatalogService } from '../catalog/catalog.service';
import { BenefitService } from '../benefit/benefit.service';
import { TicketService } from '../common/ticket.service';
@@ -37,6 +38,7 @@ export class TradeService {
private readonly ipGeoService: IpGeoService,
@Inject(PAY_PROVIDER) private readonly payProvider: IPayProvider,
@Inject(DELIVERY_PROVIDER) private readonly deliveryProvider: IDeliveryProvider,
private readonly analyticsService: AnalyticsService,
) {}
async preview(userId: bigint, body: { productId: string; quantity: number; addressId?: string }) {
@@ -158,6 +160,17 @@ export class TradeService {
include: { product: true, imageResource: true },
});
this.analyticsService.trackOneSafe(userId, 'USER_H5', {
eventName: 'order_submit',
refType: 'ORDER',
refId: order.id,
extraJson: {
orderId: order.id.toString(),
productId: body.productId,
quantity: body.quantity,
},
});
return serializeBigInt(mapOrderCompat(order));
}
@@ -226,6 +239,13 @@ export class TradeService {
await this.benefitService.grantOnOrderPaid(order.id);
await this.deliveryProvider.scheduleAutoAdvance(order.id);
this.analyticsService.trackOneSafe(userId, 'USER_H5', {
eventName: 'pay_success',
refType: 'ORDER',
refId: order.id,
extraJson: { orderId: order.id.toString(), mode: 'mock' },
});
return this.getOrder(userId, orderId);
}
@@ -305,6 +325,12 @@ export class TradeService {
if (refreshed?.payStatus === 'PAID') {
await this.benefitService.grantOnOrderPaid(order.id);
await this.deliveryProvider.scheduleAutoAdvance(order.id);
this.analyticsService.trackOneSafe(order.userId, 'USER_H5', {
eventName: 'pay_success',
refType: 'ORDER',
refId: order.id,
extraJson: { orderId: order.id.toString(), mode: 'wechat_callback' },
});
}
return { orderId: order.id.toString(), alreadyPaid: false };