Browse Source

红包 四舍五入保留整数

shish 4 years ago
parent
commit
7cdae0a3ba

+ 1 - 1
app-ghs/controllers/RefundController.php

@@ -116,7 +116,7 @@ class RefundController extends BaseController
                 util::fail("退款金额不能小于0");
             }
             if (bccomp($post['price'], $order['realPrice'], 2) == 1) {
-                util::fail("退款金额不能大于订单金额");
+                util::fail("退款金额超过订单金额");
             }
 
             $post['shopId'] = $this->shopId;

+ 2 - 0
biz-ghs/product/classes/ProductClass.php

@@ -131,6 +131,8 @@ class ProductClass extends BaseClass
             $customDiscount = isset(Yii::$app->params['customDiscount']) ? Yii::$app->params['customDiscount'] : 1;
             if ($customDiscount < 1 && $customDiscount > 0) {
                 $price = bcmul($price, $customDiscount, 2);
+                //四舍五入保留整数
+                $price = round($price, 0);
             }
 
             $list[$k]['price'] = $price;