|
@@ -614,13 +614,13 @@ class GoodsController extends Curd
|
|
|
$params['order_discount_json'] = json_encode($this->discountRecord($couponUseJson, $params));
|
|
|
$orderAmountPay = $params['order_amount_pay'];
|
|
|
$constituteList = array_column($params['pay_category_constitute_list'], 'amount', 'category');
|
|
|
- // 验证金额
|
|
|
+
|
|
|
$constituteAmount = 0;
|
|
|
foreach ($params['pay_category_constitute_list'] as $item) {
|
|
|
- $constituteAmount = $constituteAmount + $item['amount'];
|
|
|
+ $constituteAmount = sprintf("%.2f", $constituteAmount) + sprintf("%.2f", $item['amount']);
|
|
|
}
|
|
|
- if ($params['order_amount_pay'] != $constituteAmount) {
|
|
|
- throw new BusinessException("组合支付金额与应付金额不一致");
|
|
|
+ if (sprintf("%.2f", $params['order_amount_pay']) != sprintf("%.2f", $constituteAmount)) {
|
|
|
+ throw new BusinessException('组合支付金额与应付金额不一致');
|
|
|
}
|
|
|
$params['goods_classify'] = $goodsClassifys[0];
|
|
|
// 验证库存
|
|
@@ -1526,9 +1526,9 @@ class GoodsController extends Curd
|
|
|
$constituteList = array_column($params['pay_category_constitute_list'], 'amount', 'category');// 验证金额
|
|
|
$constituteAmount = 0;
|
|
|
foreach ($params['pay_category_constitute_list'] as $item) {
|
|
|
- $constituteAmount = $constituteAmount + $item['amount'];
|
|
|
+ $constituteAmount = sprintf("%.2f", $constituteAmount) + sprintf("%.2f", $item['amount']);
|
|
|
}
|
|
|
- if ($params['order_amount_pay'] != $constituteAmount) {
|
|
|
+ if (sprintf("%.2f", $params['order_amount_pay']) != sprintf("%.2f", $constituteAmount)) {
|
|
|
throw new BusinessException('组合支付金额与应付金额不一致');
|
|
|
}
|
|
|
if (!empty($params['pay_category_constitute']) && in_array('OFFLINE', $params['pay_category_constitute'])) { //线下付款
|