webadmin端增加商铺日志
This commit is contained in:
@@ -2,6 +2,7 @@ import { BadRequestException, Injectable, NotFoundException } from '@nestjs/comm
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { PrismaService } from '../../common/prisma/prisma.module';
|
||||
import { serializeBigInt } from '../../common/decorators/current-user.decorator';
|
||||
import { AnalyticsService } from '../analytics/analytics.service';
|
||||
|
||||
function generateBillNo() {
|
||||
return `PB${Date.now()}${Math.floor(Math.random() * 900 + 100)}`;
|
||||
@@ -9,7 +10,10 @@ function generateBillNo() {
|
||||
|
||||
@Injectable()
|
||||
export class SettlementService {
|
||||
constructor(private readonly prisma: PrismaService) {}
|
||||
constructor(
|
||||
private readonly prisma: PrismaService,
|
||||
private readonly analyticsService: AnalyticsService,
|
||||
) {}
|
||||
|
||||
async createStorePayout(
|
||||
redeemRecordId: bigint,
|
||||
@@ -33,6 +37,18 @@ export class SettlementService {
|
||||
expectedPayAt,
|
||||
},
|
||||
});
|
||||
this.analyticsService.trackStoreOneSafe(undefined, 'SHOP_H5', {
|
||||
storeId,
|
||||
eventName: 'store_payout_created',
|
||||
refType: 'STORE_PAYOUT',
|
||||
refId: payout.id,
|
||||
extraJson: {
|
||||
redeemRecordId: redeemRecordId.toString(),
|
||||
payoutAmount,
|
||||
redeemAmount,
|
||||
settlementRate,
|
||||
},
|
||||
});
|
||||
return serializeBigInt(payout);
|
||||
}
|
||||
|
||||
@@ -108,6 +124,18 @@ export class SettlementService {
|
||||
},
|
||||
});
|
||||
|
||||
this.analyticsService.trackStoreOneSafe(undefined, 'HQ_WEB', {
|
||||
storeId: payout.storeId,
|
||||
eventName: 'store_payout_paid',
|
||||
refType: 'STORE_PAYOUT',
|
||||
refId: id,
|
||||
extraJson: {
|
||||
batchNo: dto.batchNo ?? payout.batchNo,
|
||||
paymentRef: dto.paymentRef,
|
||||
payoutAmount: Number(payout.payoutAmount),
|
||||
},
|
||||
});
|
||||
|
||||
return serializeBigInt(updated);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user