本文整理汇总了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) . ' ';
}
示例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);
}