Explorar el Código

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

kevinElken hace 9 meses
padre
commit
188eb856ab
Se han modificado 1 ficheros con 3 adiciones y 4 borrados
  1. 3 4
      frontendApi/modules/v1/controllers/SiteController.php

+ 3 - 4
frontendApi/modules/v1/controllers/SiteController.php

@@ -415,15 +415,14 @@ class SiteController extends BaseController
 
     public function actionCountries()
     {
-        // 国家列表
-        $data = Cache::getCountries();
+        $countryId = User::getEnCodeInfo(\Yii::$app->user->id)['COUNTRY_ID'];
+        $countries = array_filter(Cache::getCountries(), fn($country) => $country['ID'] === $countryId);
 
-        return static::notice(['data' => $data]);
+        return static::notice(['data' => array_values($countries)]);
     }
 
     public function actionLanguages()
     {
-        // 语言列表
         $data = Cache::getLanguages();
 
         return static::notice(['data' => $data]);