Forráskód Böngészése

feat: EK-856: 管理员增加“Country”属性.

kevinElken 10 hónapja
szülő
commit
e2e3ca0242
1 módosított fájl, 7 hozzáadás és 9 törlés
  1. 7 9
      backendApi/modules/v1/controllers/SiteController.php

+ 7 - 9
backendApi/modules/v1/controllers/SiteController.php

@@ -182,15 +182,13 @@ class SiteController extends BaseController
         // 国家
         $countries = Cache::getCountries();
 
-        if (\Yii::$app->request->hasProperty('filter')) {
-            $filter = \Yii::$app->request->get('filter');
-            if ($filter) {
-                $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);
-            }
+        $filter = \Yii::$app->request->get('filter', 0);
+        if ($filter) {
+            $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);
         }
 
         // 货币