修复下单时配送插件编码报错
This commit is contained in:
parent
96577ab1d6
commit
28c9e44ef9
|
|
@ -15,6 +15,7 @@ use Beike\Models\Plugin;
|
|||
use Beike\Plugin\Plugin as BPlugin;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Beike\Shop\Services\TotalServices\ShippingService;
|
||||
|
||||
class PluginRepo
|
||||
{
|
||||
|
|
@ -180,6 +181,7 @@ class PluginRepo
|
|||
*/
|
||||
public static function shippingEnabled($code): bool
|
||||
{
|
||||
$code = ShippingService::parseShippingPluginCode($code);
|
||||
$shippingMethods = self::getShippingMethods();
|
||||
return $shippingMethods->where('code', $code)->count() > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ class ShippingService
|
|||
return null;
|
||||
}
|
||||
|
||||
$methodArray = explode('.', $shippingMethod);
|
||||
$shippingPluginCode = $methodArray[0];
|
||||
$shippingPluginCode = self::parseShippingPluginCode($shippingMethod);
|
||||
$pluginCode = Str::studly($shippingPluginCode);
|
||||
|
||||
$plugin = app('plugin')->getPlugin($shippingPluginCode);
|
||||
|
|
@ -59,4 +58,17 @@ class ShippingService
|
|||
|
||||
return $totalData;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过配送方式获取插件编码
|
||||
*
|
||||
* @param $shippingMethod
|
||||
* @return string
|
||||
*/
|
||||
public static function parseShippingPluginCode($shippingMethod): string
|
||||
{
|
||||
$methodArray = explode('.', $shippingMethod);
|
||||
return $methodArray[0];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue