fix(product): 修复产品列表中点数显示问题

- 在 RechargeProductsDto 类中,修改了 bonus_rate_pct 的计算方式
- 使用 round 函数对结果进行四舍五入,提高精度
- 调整 scale 参数为3,增加小数位数- 这些修改提高了点数计算的准确性,解决了产品列表中的点数显示问题
This commit is contained in:
李东云
2025-09-19 15:35:27 +08:00
parent 3af39e4254
commit eb44b6e3b6

View File

@@ -54,7 +54,8 @@ final class RechargeProductsDto extends AbstractDto
if (!$is_ftai) {
$result += [
'total_points' => $effect->getPointTotal(),
'bonus_rate_pct' => (float)(bcmul(
'bonus_rate_pct' => round(
(float)(bcmul(
num1: $effect->getPointTotal() == 0
? '0'
: bcdiv(
@@ -63,8 +64,9 @@ final class RechargeProductsDto extends AbstractDto
3,
),
num2: '100',
scale: 0,
scale: 3,
)),
),
'point' => [
'total' => $effect->getPointTotal(),
'number' => $effect->pointBasic,