当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper::currencyAdapter方法代码示例

本文整理汇总了PHP中app\components\Helper::currencyAdapter方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::currencyAdapter方法的具体用法?PHP Helper::currencyAdapter怎么用?PHP Helper::currencyAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\components\Helper的用法示例。


在下文中一共展示了Helper::currencyAdapter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionGetCurrency

 /**
  * Вывод главных валют
  * @return string
  */
 function actionGetCurrency()
 {
     return '$' . round(Helper::currencyAdapter(1, 11), 2) . ' €' . round(Helper::currencyAdapter(1, 12), 2) . ' ';
 }
开发者ID:roman1970,项目名称:lis,代码行数:8,代码来源:DefaultController.php

示例2: actionSnapshot

 /**
  * Снимок дня
  * @throws \Exception
  */
 public function actionSnapshot()
 {
     //$data = $this->cut_content($this->get_page("http://redday.ru/moon/"),'maintext', '/sun/sunrise.asp');
     //var_dump($data); exit;
     $start_time = strtotime('now 00:00:00', time() + 7 * 60 * 60);
     $snapshot = new Snapshot();
     $today_mark = DiaryActs::find()->select('SUM(mark)')->where("user_id = 8 and time > " . $start_time)->scalar();
     if ($today_mark) {
         $snapshot->oz = $today_mark;
     } else {
         $snapshot->weight = 0;
     }
     $snapshot->doll = Helper::currencyAdapter(1, 11);
     $snapshot->euro = Helper::currencyAdapter(1, 12);
     if (DiaryRecDayParams::find()->where(['day_param_id' => 1])->orderBy('id DESC')->one()) {
         $snapshot->weight = (double) DiaryRecDayParams::find()->where(['day_param_id' => 1])->orderBy('id DESC')->one()->value;
     } else {
         $snapshot->weight = 0;
     }
     $mish_mark = DiaryActs::find()->select('SUM(mark)')->where("time > {$start_time} and user_id = 11")->scalar();
     if ($mish_mark) {
         $snapshot->mish_oz = $mish_mark;
     } else {
         $snapshot->mish_oz = 0;
     }
     $today_acts = implode(',', ArrayHelper::map(DiaryActs::find()->where("time > {$start_time} and user_id = 8 and model_id = 1")->all(), 'id', 'id'));
     $snapshot->kkal = DiaryAte::find()->select('SUM(kkal)')->where("act_id  IN (" . $today_acts . ")")->scalar();
     $not_curr_sum = Incomes::find()->select('SUM(money)')->where("income_id  IN (1,2,7,10)")->scalar();
     $dollar = Incomes::find()->select('SUM(money)')->where("income_id  = 8")->scalar();
     $euro = Incomes::find()->select('SUM(money)')->where("income_id  = 9")->scalar();
     $snapshot->useful_bal = (int) ($not_curr_sum + Helper::currencyAdapter($dollar, 11) + Helper::currencyAdapter($euro, 12));
     $snapshot->sun_rise = date_sunrise(time(), SUNFUNCS_RET_STRING, 55, 82, 90, 7);
     $snapshot->sun_set = date_sunset(time(), SUNFUNCS_RET_STRING, 55, 82, 90, 7);
     $today_acts_bought = implode(',', ArrayHelper::map(DiaryActs::find()->where("time > {$start_time} and user_id = 8 and model_id = 3")->all(), 'id', 'id'));
     $bought_today = [];
     $sum_spent = 0;
     if ($today_acts_bought) {
         try {
             //return var_dump($bought_today);
             $snapshot->spent = Bought::find()->select('SUM(spent)')->where("act_id  IN (" . $today_acts_bought . ")")->scalar();
         } catch (\ErrorException $e) {
             return $e->getMessage();
         }
         // return var_dump($sum_spent );
     }
     if ($snapshot->save()) {
         $act = new DiaryActs();
         $act->model_id = 12;
         $act->user_id = 8;
         $klavaro_balls = 0;
         $today_acts_of_day_params = implode(',', ArrayHelper::map(DiaryActs::find()->where("time > {$start_time} and user_id = 8 and model_id = 4")->all(), 'id', 'id'));
         if ($today_acts_of_day_params) {
             $klavaro_eng_today = DiaryRecDayParams::find()->where("act_id  IN (" . $today_acts_of_day_params . ") and day_param_id = 22")->one();
             $klavaro_ru_today = DiaryRecDayParams::find()->where("act_id  IN (" . $today_acts_of_day_params . ") and day_param_id = 23")->one();
         }
         if (isset($klavaro_eng_today) && $klavaro_eng_today->value > 95) {
             $klavaro_balls = 1;
         }
         if (isset($klavaro_ru_today) && $klavaro_ru_today->value > 95) {
             $klavaro_balls += 1;
         }
         //$klavaro_balls = ( isset($klavaro_eng_today) ? $klavaro_eng_today->value : 0 ) + ( isset($klavaro_ru_today) ? $klavaro_eng_today->value : 0 );
         //echo $klavaro_balls;
         if (DiaryRecDayParams::find()->where(['day_param_id' => 18])->orderBy('id DESC')->one()) {
             $act->mark = (int) round(DiaryRecDayParams::find()->where(['day_param_id' => 18])->orderBy('id DESC')->one()->value / 2000) + $klavaro_balls;
         } else {
             $act->mark = 0;
         }
         $snapshot->oz += $act->mark;
         $snapshot->update();
         // var_dump($act);
         if ($act->save(false)) {
             echo 'ok';
         }
     }
     //var_dump($snapshot);
 }
开发者ID:roman1970,项目名称:lis,代码行数:81,代码来源:ParsersController.php


注:本文中的app\components\Helper::currencyAdapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。