获取当前货币ID
This commit is contained in:
parent
4441ad5fec
commit
9bec24b2cb
|
|
@ -456,6 +456,18 @@ function current_currency_code(): string
|
|||
return Session::get('currency') ?? system_setting('base.currency');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前货币
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function current_currency_id(): string
|
||||
{
|
||||
$currencyCode = current_currency_code();
|
||||
$currency = \Beike\Models\Currency::query()->where('code', $currencyCode)->first();
|
||||
return $currency->id ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数量格式化, 用于商品、订单统计
|
||||
*
|
||||
|
|
|
|||
|
|
@ -108,6 +108,22 @@ class CheckoutService
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算当前选中商品总重量
|
||||
* @todo
|
||||
* @return int
|
||||
*/
|
||||
public function getCartWeight(): int
|
||||
{
|
||||
$weight = 0;
|
||||
$selectedProducts = $this->selectedProducts;
|
||||
foreach ($selectedProducts as $product) {
|
||||
$weight += $this->weight->convert($product['weight'], $product['weight_class_id'], $this->config->get('config_weight_class_id'));
|
||||
}
|
||||
return $weight;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue