|
@@ -822,7 +822,7 @@ class ConfigController extends BaseController {
|
|
|
$countries = Cache::getCountries();
|
|
$countries = Cache::getCountries();
|
|
|
// 货币
|
|
// 货币
|
|
|
$currencies = $this->currencyModelClass::getFromCache();
|
|
$currencies = $this->currencyModelClass::getFromCache();
|
|
|
- // 汇率配置
|
|
|
|
|
|
|
+ // 汇率
|
|
|
$currencyConversion = $this->currencyConversionsModelClass::getFromCache();
|
|
$currencyConversion = $this->currencyConversionsModelClass::getFromCache();
|
|
|
|
|
|
|
|
$isSuper = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
|
|
$isSuper = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
|
|
@@ -832,21 +832,15 @@ class ConfigController extends BaseController {
|
|
|
|
|
|
|
|
$countries = array_filter($countries, fn($country) => in_array($country['ID'], $adminCountry));
|
|
$countries = array_filter($countries, fn($country) => in_array($country['ID'], $adminCountry));
|
|
|
$countries = array_values($countries);
|
|
$countries = array_values($countries);
|
|
|
- $countriesId = array_column($countries, 'ID');
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- $currencies = array_filter($currencies, fn($currency) => in_array($currency['ID'], $countriesId));
|
|
|
|
|
- $currencies = array_values($currencies);
|
|
|
|
|
- $currenciesId = array_column($currencies, 'ID');
|
|
|
|
|
-
|
|
|
|
|
- $currencyConversion = array_filter($currencyConversion, fn($conversion) => in_array($conversion['TO_CURRENCY_ID'], $currenciesId));
|
|
|
|
|
- $currencyConversion = array_values($currencyConversion);
|
|
|
|
|
-
|
|
|
|
|
- LoggerTool::debug([$countries, $countriesId, $currencies, $currenciesId, $currencyConversion]);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $currencyConversion = array_column($currencyConversion, NULL, 'TO_CURRENCY_ID');
|
|
|
|
|
|
|
+ $countriesCurrencyIds = array_column($countries, 'LOCAL_CURRENCY_ID');
|
|
|
|
|
+ $currencyConversion = array_filter($currencyConversion, fn($item) => in_array($item['TO_CURRENCY_ID'], $countriesCurrencyIds));
|
|
|
|
|
+ $currencyConversion = array_values($currencyConversion);
|
|
|
|
|
+ $currencyConversion = array_column($currencyConversion, null, 'TO_CURRENCY_ID');
|
|
|
|
|
+
|
|
|
|
|
+ $currencies = array_filter($currencies, fn($item) => in_array($item['ID'], $countriesCurrencyIds));
|
|
|
|
|
+ $currencies = array_values($currencies);
|
|
|
|
|
|
|
|
foreach ($currencies as &$currency) {
|
|
foreach ($currencies as &$currency) {
|
|
|
$currency['PRODUCT_RATE'] = $currencyConversion[$currency['ID']]['PRODUCT_RATE'] ?? 0;
|
|
$currency['PRODUCT_RATE'] = $currencyConversion[$currency['ID']]['PRODUCT_RATE'] ?? 0;
|