|
@@ -886,10 +886,21 @@ class ConfigController extends BaseController {
|
|
|
$countries = $this->countiesModelClass::getFromCache();
|
|
$countries = $this->countiesModelClass::getFromCache();
|
|
|
// 运费列表
|
|
// 运费列表
|
|
|
$transportation = $this->freeTemplateModelClass::getFromCache();
|
|
$transportation = $this->freeTemplateModelClass::getFromCache();
|
|
|
|
|
+
|
|
|
|
|
+ $isSuper = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
|
|
|
|
|
+ if (!$isSuper) {
|
|
|
|
|
+ $adminId = Yii::$app->getUser()->getUserInfo()['id'];
|
|
|
|
|
+ $adminCountry = AdminCountry::getCountry($adminId);
|
|
|
|
|
+
|
|
|
|
|
+ $countries = array_filter($countries, fn($country) => in_array($country['ID'], $adminCountry));
|
|
|
|
|
+ $countries = array_values($countries);
|
|
|
|
|
+ $countriesId = array_column($countries, 'ID');
|
|
|
|
|
+
|
|
|
|
|
+ $transportation = array_filter($transportation, fn($item) => in_array($item['country_id'], $countriesId));
|
|
|
|
|
+ $transportation = array_values($transportation);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$transportation = array_column($transportation, NULL, 'country_id');
|
|
$transportation = array_column($transportation, NULL, 'country_id');
|
|
|
- // 货币列表
|
|
|
|
|
- $currencies = $this->currencyModelClass::getFromCache();
|
|
|
|
|
- $currencies = array_column($currencies, NULL, 'ID');
|
|
|
|
|
|
|
|
|
|
foreach ($countries as &$country) {
|
|
foreach ($countries as &$country) {
|
|
|
$country['freight'] = $transportation[$country['ID']]['freight'] ?? 0;
|
|
$country['freight'] = $transportation[$country['ID']]['freight'] ?? 0;
|