本文整理汇总了PHP中L::getBalance方法的典型用法代码示例。如果您正苦于以下问题:PHP L::getBalance方法的具体用法?PHP L::getBalance怎么用?PHP L::getBalance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类L
的用法示例。
在下文中一共展示了L::getBalance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
$this->amount = abs($this->amount);
if ($this->phone == "") {
$this->setError("Please Give number");
} elseif (strlen($this->phone) < 11) {
$this->setError("Phone number must be 11 digit");
} elseif ($this->amount < 10 || $this->amount > 1000) {
$this->setError("Amount not valid");
} elseif ($this->restrictDublicateLoad($this->phone) == 1) {
$this->setError("You can not request same number within 15 minute.");
} else {
R::begin();
try {
foreach ($this->cut_balance_from_id as $boss_id) {
$current_balance = L::getBalance($boss_id, "flexiload");
if ($current_balance < $this->amount) {
$this->setError("You do not have sufficient amount in your account");
} else {
R::exec("UPDATE user SET {$this->balance_field}={$this->balance_field}-{$this->amount} where id='{$boss_id}'");
R::exec("CALL preparestatement({$boss_id},{$this->amount},{$current_balance},{$this->user_id},'credit','{$this->comments}')");
}
}
$flexiload = R::dispense("flexiload");
$flexiload->phone = $this->phone;
$flexiload->balance = $this->amount;
$flexiload->load_type = $this->type;
$flexiload->user_id = $this->user_id;
$flexiload->s_date = CURRENT_DT;
$flexiload->status = 'pending';
$flexiload->s_time = time();
$flexiload->submitted_date = CURRENT_DTT;
$flexiload->operator = $this->getOperatorName($this->phone);
R::store($flexiload);
R::commit();
} catch (Exception $e) {
R::rollback();
$this->setError("" . $e->getMessage());
}
}
if ($this->getError() == "") {
$this->fails = FALSE;
} else {
$this->fails = TRUE;
}
}