Kaynağa Gözat

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

kevinElken 9 ay önce
ebeveyn
işleme
188eb856ab

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

@@ -415,15 +415,14 @@ class SiteController extends BaseController
 
 
     public function actionCountries()
     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()
     public function actionLanguages()
     {
     {
-        // 语言列表
         $data = Cache::getLanguages();
         $data = Cache::getLanguages();
 
 
         return static::notice(['data' => $data]);
         return static::notice(['data' => $data]);