Beispiel #1
0
 public static function getCurs($valute)
 {
     $param = Setup::find()->where(['param_name' => $valute . date("d-m-Y", time())])->one();
     if ($param) {
         return $param->param_value;
     } else {
         $rates = new Exchange(time());
         $curs = $rates->GetRate($valute);
         // Обновить курс
         $model = new Setup();
         $model->param_name = (string) $valute . date("d-m-Y", time());
         $model->param_value = (string) $curs;
         //$model->validate();
         //vd($model->getErrors());
         $model->save();
         return $curs;
     }
 }
Beispiel #2
0
 public function init()
 {
     parent::init();
     $countPostOnPage = Setup::find()->where(['param_name' => 'countPostOnPage'])->one();
 }