weizong song 1 year ago
parent 4c5665fcf8
commit c3e6e04273

@ -1565,11 +1565,11 @@ class OrdersController extends CommonController
$customer = $order->customer;
$currentBalance = (float)$customer->balance;
dd(gettype($totalPaid), gettype($currentBalance), $totalPaid == $currentBalance);
dd(gettype($totalPaid), gettype($currentBalance), float_equals($totalPaid, $currentBalance));
// 4. 如果支付总额等于用户余额,进行退款处理
if ($totalPaid > 0 && floatval($totalPaid) == floatval($currentBalance)) {
if ($totalPaid > 0 && float_equals($totalPaid, $currentBalance)) {
foreach ($recharges as $recharge) {
// 更新用户余额
$currentBalance -= $recharge->money;

@ -592,3 +592,8 @@ function add_work_day($date, $workdays, $return_timestamp = false)
return $return_timestamp ? $date : date("Y-m-d", $date);
}
function float_equals($a, $b, $epsilon = 0.00001)
{
return abs($a - $b) < $epsilon;
}

Loading…
Cancel
Save