核销代码
This commit is contained in:
@@ -100,7 +100,10 @@ export class BenefitService {
|
||||
const coupon = await tx.benefitCoupon.findUniqueOrThrow({
|
||||
where: { id: BigInt(alloc.couponId) },
|
||||
});
|
||||
const allocAmount = alloc.amount;
|
||||
const allocAmount = Number(alloc.amount);
|
||||
if (!Number.isFinite(allocAmount) || allocAmount <= 0) {
|
||||
throw new Error('BENEFIT_ALLOC_INVALID');
|
||||
}
|
||||
const updated = await tx.benefitCoupon.updateMany({
|
||||
where: { id: coupon.id, version: coupon.version, balance: { gte: allocAmount } },
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user