From eb44b6e3b6e9a2e3f757076d0d4438163e7d1f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=9C=E4=BA=91?= Date: Fri, 19 Sep 2025 15:35:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(product):=20=E4=BF=AE=E5=A4=8D=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E5=88=97=E8=A1=A8=E4=B8=AD=E7=82=B9=E6=95=B0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 RechargeProductsDto 类中,修改了 bonus_rate_pct 的计算方式 - 使用 round 函数对结果进行四舍五入,提高精度 - 调整 scale 参数为3,增加小数位数- 这些修改提高了点数计算的准确性,解决了产品列表中的点数显示问题 --- .../Dto/Product/RechargeProductsDto.php | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Application/Dto/Product/RechargeProductsDto.php b/src/Application/Dto/Product/RechargeProductsDto.php index 287826d..9e3e684 100644 --- a/src/Application/Dto/Product/RechargeProductsDto.php +++ b/src/Application/Dto/Product/RechargeProductsDto.php @@ -54,17 +54,19 @@ final class RechargeProductsDto extends AbstractDto if (!$is_ftai) { $result += [ 'total_points' => $effect->getPointTotal(), - 'bonus_rate_pct' => (float)(bcmul( - num1: $effect->getPointTotal() == 0 - ? '0' - : bcdiv( - (string)$effect->pointBonus, - (string)$effect->getPointTotal(), - 3, - ), - num2: '100', - scale: 0, - )), + 'bonus_rate_pct' => round( + (float)(bcmul( + num1: $effect->getPointTotal() == 0 + ? '0' + : bcdiv( + (string)$effect->pointBonus, + (string)$effect->getPointTotal(), + 3, + ), + num2: '100', + scale: 3, + )), + ), 'point' => [ 'total' => $effect->getPointTotal(), 'number' => $effect->pointBasic,