v3计划内容上传

This commit is contained in:
2026-07-04 20:36:26 +08:00
parent def3ed5175
commit 743d242d52
23 changed files with 291 additions and 53 deletions
@@ -34,7 +34,7 @@ export class RedeemService {
});
if (!coupon) throw new NotFoundException('券不存在');
const balance = Number(coupon.balance);
const check = validateRedeemAmount(balance, body.amount);
const check = validateRedeemAmount(balance, body.amount, balance);
if (!check.ok) throw new BadRequestException(check.message);
allocations = [{ couponId: coupon.id.toString(), amount: body.amount }];
} else {
@@ -115,7 +115,7 @@ export class RedeemService {
where: { id: BigInt(alloc.couponId) },
});
if (!coupon) throw new BadRequestException('券不存在');
const check = validateRedeemAmount(Number(coupon.balance), alloc.amount);
const check = validateRedeemAmount(Number(coupon.balance), alloc.amount, Number(coupon.balance));
if (!check.ok) throw new BadRequestException(check.message);
}