Преглед изворни кода

feat: NG-15: 新会员注册时增加国家与语言选项.

zhangl пре 1 година
родитељ
комит
e682e7821e

+ 1 - 0
backendApi/config/urlManagerRules.php

@@ -21,6 +21,7 @@ return [
             'GET send-notify' => 'send-notify',
             'GET languages' => 'languages',
             'GET countries' => 'countries',
+            'GET banks' => 'banks',
         ],
     ],
     [

+ 17 - 0
backendApi/modules/v1/controllers/SiteController.php

@@ -204,4 +204,21 @@ class SiteController extends BaseController
 
         return static::notice(['data' => $data]);
     }
+
+    public function actionBanks()
+    {
+        // 默认国家
+        $countryId = \Yii::$app->request->get('countryId');
+        if (!$countryId) {
+            return static::notice(Yii::t('app', 'countryDoesNotSelect'), 400);
+        }
+
+        $data = OpenBank::find()
+            ->where('STATUS=:STATUS AND COUNTRY_ID=:COUNTRY_ID', [':STATUS' => 1, ':COUNTRY_ID' => $countryId])
+            ->orderBy('LIST_ORDER ASC')
+            ->asArray()
+            ->all();
+
+        return static::notice(['data' => $data]);
+    }
 }

+ 1 - 0
frontendApi/config/urlManagerRules.php

@@ -25,6 +25,7 @@ return [
             'GET get-instance' => 'get-instance',
             'GET languages' => 'languages',
             'GET countries' => 'countries',
+            'GET banks' => 'banks',
         ],
     ],
     [

+ 18 - 0
frontendApi/modules/v1/controllers/SiteController.php

@@ -18,6 +18,7 @@ use common\models\ArticleCategory;
 use common\models\BaUser;
 use common\models\DecOrder;
 use common\models\DecRole;
+use common\models\OpenBank;
 use common\models\Order;
 use common\models\OrderGoods;
 use common\models\PerfPeriod;
@@ -412,4 +413,21 @@ class SiteController extends BaseController
 
         return static::notice(['data' => $data]);
     }
+
+    public function actionBanks()
+    {
+        // 默认国家
+        $countryId = \Yii::$app->request->get('countryId');
+        if (!$countryId) {
+            return static::notice(Yii::t('app', 'countryDoesNotSelect'), 400);
+        }
+
+        $data = OpenBank::find()
+            ->where('STATUS=:STATUS AND COUNTRY_ID=:COUNTRY_ID', [':STATUS' => 1, ':COUNTRY_ID' => $countryId])
+            ->orderBy('LIST_ORDER ASC')
+            ->asArray()
+            ->all();
+
+        return static::notice(['data' => $data]);
+    }
 }