diff --git a/beike/Shop/Services/TotalServices/ShippingService.php b/beike/Shop/Services/TotalServices/ShippingService.php index f14d1c94..427448c6 100644 --- a/beike/Shop/Services/TotalServices/ShippingService.php +++ b/beike/Shop/Services/TotalServices/ShippingService.php @@ -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'), diff --git a/plugins/FlatShipping/Bootstrap.php b/plugins/FlatShipping/Bootstrap.php index 7bd3ae9e..58b9c3fc 100644 --- a/plugins/FlatShipping/Bootstrap.php +++ b/plugins/FlatShipping/Bootstrap.php @@ -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);