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

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

kevin пре 1 година
родитељ
комит
2dc9f8d1ae
2 измењених фајлова са 4 додато и 3 уклоњено
  1. 2 2
      common/models/Currency.php
  2. 2 1
      common/models/CurrencyConversions.php

+ 2 - 2
common/models/Currency.php

@@ -59,7 +59,7 @@ class Currency extends \common\components\ActiveRecord
         $data = Yii::$app->cache->get(Cache::CURRENCIES_KEY);
         if (!$data) {
             // 获取信息
-            $data = static::find()->where('ACTIVE=1')->orderBy('ACTIVE DESC, ID ASC')->indexBy('ID')->asArray()->all();
+            $data = static::find()->where('ACTIVE=1')->orderBy('ACTIVE DESC, ID ASC')->asArray()->all();
             Yii::$app->cache->set(Cache::CURRENCIES_KEY, $data);
         }
 
@@ -71,7 +71,7 @@ class Currency extends \common\components\ActiveRecord
      */
     public static function getAllData()
     {
-        return static::find()->where('1=1')->indexBy('ID')->orderBy('ACTIVE DESC, ID ASC')->asArray()->all();
+        return static::find()->where('1=1')->orderBy('ACTIVE DESC, ID ASC')->asArray()->all();
     }
 
     /**

+ 2 - 1
common/models/CurrencyConversions.php

@@ -67,6 +67,7 @@ class CurrencyConversions extends \common\components\ActiveRecord
     public static function getFromCache()
     {
         $records = Yii::$app->cache->get(Cache::CURRENCIES_CONVERSIONS_KEY);
+        Yii::$app->cache->delete(Cache::CURRENCIES_CONVERSIONS_KEY); // todo
         if (!$records) {
             // 获取信息
             $records = self::getAllData();
@@ -86,7 +87,7 @@ class CurrencyConversions extends \common\components\ActiveRecord
      */
     public static function getAllData()
     {
-        return static::find()->where('ACTIVE=1')->indexBy('ID')->orderBy('ID ASC')->asArray()->all();
+        return static::find()->where('ACTIVE=1')->orderBy('ID ASC')->asArray()->all();
     }
 
     /**