|
|
@@ -63,9 +63,10 @@ class Language extends \common\components\ActiveRecord
|
|
|
public static function getFromCache()
|
|
|
{
|
|
|
$data = Yii::$app->cache->get(Cache::LANGUAGE_KEY);
|
|
|
+ Yii::$app->cache->delete(Cache::LANGUAGE_KEY);
|
|
|
if (!$data) {
|
|
|
// 获取信息
|
|
|
- $data = static::find()->orderBy('ORDER DESC, ACTIVE ASC')->indexBy('ID')->asArray()->all();
|
|
|
+ $data = self::getAllData();
|
|
|
Yii::$app->cache->set(Cache::LANGUAGE_KEY, $data);
|
|
|
}
|
|
|
// i18n转换
|
|
|
@@ -81,7 +82,7 @@ class Language extends \common\components\ActiveRecord
|
|
|
*/
|
|
|
public static function getAllData()
|
|
|
{
|
|
|
- return static::find()->where('1=1')->indexBy('ID')->orderBy('ORDER DESC, ACTIVE ASC')->asArray()->all();
|
|
|
+ return static::find()->where('ACTIVE=1')->indexBy('ID')->orderBy('ORDER DESC, ACTIVE ASC')->asArray()->all();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -91,7 +92,7 @@ class Language extends \common\components\ActiveRecord
|
|
|
public static function updateToCache()
|
|
|
{
|
|
|
// 获取配置
|
|
|
- $data = static::find()->where('1=1')->orderBy('ORDER DESC, ACTIVE ASC')->asArray()->indexBy('ID')->all();
|
|
|
+ $data = self::getAllData();
|
|
|
Yii::$app->cache->set(Cache::LANGUAGE_KEY, $data);
|
|
|
return $data;
|
|
|
}
|