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


PHP Billrun_Factory::plan方法代码示例

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


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

示例1: getBalancesVolume

 /**
  * method to receive the balances lines that over requested date usage
  * 
  * @return Mongodloid_Cursor Mongo cursor for iteration
  */
 public function getBalancesVolume($plan, $data_usage, $from_account_id, $to_account_id, $billrun)
 {
     $params = array('name' => $plan, 'time' => Billrun_Util::getStartTime($billrun));
     $plan_id = Billrun_Factory::plan($params);
     $id = $plan_id->get('_id')->getMongoID();
     $data_usage_bytes = Billrun_Util::megabytesToBytesFormat((int) $data_usage);
     $query = array('aid' => array('$gte' => (int) $from_account_id, '$lte' => (int) $to_account_id), 'billrun_month' => $billrun, 'balance.totals.data.usagev' => array('$gt' => (double) $data_usage_bytes), 'current_plan' => Billrun_Factory::db()->plansCollection()->createRef($id));
     //		print_R($query);die;
     return $this->collection->query($query)->cursor()->setReadPreference(Billrun_Factory::config()->getConfigValue('read_only_db_pref'))->hint(array('aid' => 1, 'billrun_month' => 1))->limit($this->size);
 }
开发者ID:ngchie,项目名称:system,代码行数:15,代码来源:Balances.php

示例2: getData

 /**
  * Get the data resource
  * 
  * @return Mongo Cursor
  */
 public function getData($filter_query = array(), $fields = false)
 {
     $cursor = $this->getRates($filter_query);
     $this->_count = $cursor->count();
     $resource = $cursor->sort($this->sort)->skip($this->offset())->limit($this->size);
     $ret = array();
     foreach ($resource as $item) {
         if ($fields) {
             foreach ($fields as $field) {
                 $row[$field] = $item->get($field);
             }
             if (isset($row['rates'])) {
                 // convert plan ref to plan name
                 foreach ($row['rates'] as &$rate) {
                     if (isset($rate['plans'])) {
                         $plans = array();
                         foreach ($rate['plans'] as $plan) {
                             $plan_id = $plan['$id'];
                             $plans[] = Billrun_Factory::plan(array('id' => $plan_id))->getName();
                         }
                         $rate['plans'] = $plans;
                     }
                 }
             }
             $ret[] = $row;
         } else {
             if ($item->get('rates') && !$this->showprefix) {
                 foreach ($item->get('rates') as $key => $rate) {
                     if (is_array($rate)) {
                         $added_columns = array('t' => $key, 'tprice' => $rate['rate'][0]['price'], 'taccess' => isset($rate['access']) ? $rate['access'] : 0);
                         if (strpos($key, 'call') !== FALSE) {
                             $added_columns['tduration'] = Billrun_Util::durationFormat($rate['rate'][0]['interval']);
                         } else {
                             if ($key == 'data') {
                                 $added_columns['tduration'] = Billrun_Util::byteFormat($rate['rate'][0]['interval'], '', 0, true);
                             } else {
                                 $added_columns['tduration'] = $rate['rate'][0]['interval'];
                             }
                         }
                         $ret[] = new Mongodloid_Entity(array_merge($item->getRawData(), $added_columns, $rate));
                     }
                 }
             } else {
                 if ($this->showprefix && (isset($filter_query['$and'][0]['key']) || isset($filter_query['$and'][0]['params.prefix']))) {
                     foreach ($item->get('params.prefix') as $prefix) {
                         $item_raw_data = $item->getRawData();
                         unset($item_raw_data['params']['prefix']);
                         // to prevent high memory usage
                         $entity = new Mongodloid_Entity(array_merge($item_raw_data, array('prefix' => $prefix)));
                         $ret[] = $entity;
                     }
                 } else {
                     $ret[] = $item;
                 }
             }
         }
     }
     return $ret;
 }
开发者ID:ngchie,项目名称:system,代码行数:64,代码来源:Rates.php

示例3: getFlatCosts

 /**
  * 
  * @param array $subscriber subscriber entry from billrun collection
  * @return array
  */
 protected function getFlatCosts($subscriber)
 {
     $plan_name = $this->getNextPlanName($subscriber);
     if (!$plan_name) {
         //@error
         return array();
     }
     $planObj = Billrun_Factory::plan(array('name' => $plan_name, 'time' => Billrun_Util::getStartTime(Billrun_Util::getFollowingBillrunKey($this->stamp))));
     if (!$planObj->get('_id')) {
         Billrun_Factory::log("Couldn't get plan {$plan_name} data", Zend_Log::ALERT);
         return array();
     }
     $plan_price = $planObj->get('price');
     return array('vatable' => $plan_price, 'vat_free' => 0);
 }
开发者ID:kalburgimanjunath,项目名称:system,代码行数:20,代码来源:Balance.php

示例4: addPlanRef

 /**
  * Add plan reference to line
  * @param Mongodloid_Entity $row
  * @param string $plan
  */
 protected function addPlanRef($row, $plan)
 {
     $planObj = Billrun_Factory::plan(array('name' => $plan, 'time' => $row['urt']->sec, 'disableCache' => true));
     if (!$planObj->get('_id')) {
         Billrun_Factory::log("Couldn't get plan for CDR line : {$row['stamp']} with plan {$plan}", Zend_Log::ALERT);
         return;
     }
     $row['plan_ref'] = $planObj->createRef();
     return $row->get('plan_ref', true);
 }
开发者ID:ngchie,项目名称:system,代码行数:15,代码来源:CustomerPricing.php


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