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


PHP L::getBalance方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:bogiesoft,项目名称:Slim_PHP_Project,代码行数:46,代码来源:flexiload_library.php


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