|
|
@@ -140,11 +140,24 @@ class ShopController extends BaseController {
|
|
|
return static::notice(Form::formatErrorsForApi($formModel->getErrors()),400);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ $countries = Cache::getCountries();
|
|
|
+
|
|
|
+ $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);
|
|
|
+ }
|
|
|
+
|
|
|
return static::notice([
|
|
|
'sellType' => ShopGoods::getSaleType(),
|
|
|
'goodsType' => ShopGoods::getGoodType(),
|
|
|
'giftType' => ShopGoods::getGiftType(),
|
|
|
'categoryType' => ShopGoods::getCategoryType(),
|
|
|
+ 'countries' => $countries,
|
|
|
]);
|
|
|
}
|
|
|
|