修改固定运费计算
This commit is contained in:
parent
fc496aa4dd
commit
9451ab57a6
|
|
@ -35,9 +35,9 @@ class ShippingService
|
|||
$className = "Plugin\\{$pluginCode}\\Bootstrap";
|
||||
|
||||
if (!method_exists($className, 'getShippingFee')) {
|
||||
throw new \Exception("请在插件 {$className} 实现方法: public function getShippingFee(\$totalService)");
|
||||
throw new \Exception("请在插件 {$className} 实现方法: public function getShippingFee(CheckoutService \$checkout)");
|
||||
}
|
||||
$amount = (float)(new $className)->getShippingFee($totalService);
|
||||
$amount = (float)(new $className)->getShippingFee($checkout);
|
||||
$totalData = [
|
||||
'code' => 'shipping',
|
||||
'title' => trans('shop/carts.shipping_fee'),
|
||||
|
|
|
|||
|
|
@ -41,11 +41,12 @@ class Bootstrap
|
|||
/**
|
||||
* 计算固定运费
|
||||
*
|
||||
* @param $totalService
|
||||
* @param CheckoutService $checkout
|
||||
* @return float|int
|
||||
*/
|
||||
public function getShippingFee($totalService): float|int
|
||||
public function getShippingFee(CheckoutService $checkout): float|int
|
||||
{
|
||||
$totalService = $checkout->totalService;
|
||||
$amount = $totalService->amount;
|
||||
$shippingType = plugin_setting('flat_shipping.type', 'fixed');
|
||||
$shippingValue = plugin_setting('flat_shipping.value', 0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue