@@ -1,5 +0,0 @@
-<?php
-
-/* ********************【服务通用状态码】************************* */
-const SUCCESS_CODE = 200; // 成功
-const FAILED_CODE = 500; // 失败
@@ -72,6 +72,19 @@ class Tool {
}
+ /**
+ * 计算商品税额
+ * @param $amount
+ * @param $taxRate
+ * @param int $buyNo
+ * @return float
+ */
+ public static function calculateTax($amount, $taxRate, int $buyNo = 1): float
+ {
+ $taxAmount = $amount - $amount / (1 + $taxRate / 100) * $buyNo;
+ return floatval(self::formatPrice($taxAmount));
+ }
+
/**
* 前台业绩格式化
* @param $perf
@@ -49,8 +49,7 @@
},
"autoload": {
"files": [
- "common/helpers/LoggerTool.php",
- "common/helpers/Constant.php"
+ "common/helpers/LoggerTool.php"
]
"repositories": {