本文整理汇总了PHP中Billrun_Factory::subscriber方法的典型用法代码示例。如果您正苦于以下问题:PHP Billrun_Factory::subscriber方法的具体用法?PHP Billrun_Factory::subscriber怎么用?PHP Billrun_Factory::subscriber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Billrun_Factory
的用法示例。
在下文中一共展示了Billrun_Factory::subscriber方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: byimsitestAction
public function byimsitestAction()
{
$working_dir = "/home/shani/Documents/S.D.O.C/BillRun/Files/Docs/Tests/";
$row = 1;
if (($handle = fopen($working_dir . "billing_crm_diff_with_sid_and_imsi-1.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 0, "\t")) !== FALSE) {
error_log($row);
if ($row++ == 1) {
continue;
}
$this->subscriber = Billrun_Factory::subscriber();
$params['time'] = "2013-10-24 23:59:59";
$params['IMSI'] = $data[5];
$params_arr[] = array('time' => $params['time'], 'DATETIME' => $params['time'], 'IMSI' => $params['IMSI']);
$details = $this->subscriber->load($params);
$data['normal_plan'] = $details->plan;
$newCsvData[$data[4]] = $data;
}
fclose($handle);
$list = Subscriber_Golan::requestList($params_arr);
foreach ($list as $arr) {
$newCsvData[$arr['subscriber_id']]['bulk_plan'] = $arr['plan'];
}
$handle = fopen('/tmp/result.csv', 'w');
foreach ($newCsvData as $line) {
fputcsv($handle, $line);
}
fclose($handle);
}
}
示例2: indexAction
public function indexAction()
{
set_time_limit(3600);
$this->subscriber = Billrun_Factory::subscriber();
$this->initThings();
$this->compareParticipants();
die;
}
示例3: aggregate
/**
* execute aggregate
*/
public function aggregate()
{
// @TODO trigger before aggregate
Billrun_Factory::dispatcher()->trigger('beforeAggregate', array($this->data, &$this));
foreach ($this->data as $item) {
Billrun_Factory::dispatcher()->trigger('beforeAggregateLine', array(&$item, &$this));
$time = $item->get('call_start_dt');
// @TODO make it configurable
$previous_month = date("Ymt235959", strtotime("previous month"));
if ($time > $previous_month) {
Billrun_Factory::log()->log("time frame is not till the end of previous month " . $time . "; continue to the next line", Zend_Log::INFO);
continue;
}
// load subscriber
$phone_number = $item->get('caller_phone_no');
$subscriber = Billrun_Factory::subscriber()->load(array('NDC_SN' => $phone_number, 'time' => $time));
if (!$subscriber) {
Billrun_Factory::log()->log("subscriber not found. phone:" . $phone_number . " time: " . $time, Zend_Log::INFO);
continue;
}
$sid = $subscriber->id;
// update billing line with billrun stamp
if (!$this->updateBillingLine($subscriber, $item)) {
Billrun_Factory::log()->log("subscriber " . $sid . " cannot update billing line", Zend_Log::INFO);
continue;
}
if (isset($this->excludes['subscribers']) && in_array($sid, $this->excludes['subscribers'])) {
Billrun_Factory::log()->log("subscriber " . $sid . " is in the excluded list skipping billrun for him.", Zend_Log::INFO);
//mark line as excluded.
$item['billrun_excluded'] = true;
}
$save_data = array();
//if the subscriber should be excluded dont update the billrun.
if (!(isset($item['billrun_excluded']) && $item['billrun_excluded'])) {
// load the customer billrun line (aggregated collection)
$billrun = $this->loadSubscriberBillrun($subscriber);
if (!$billrun) {
Billrun_Factory::log()->log("subscriber " . $sid . " cannot load billrun", Zend_Log::INFO);
continue;
}
// update billrun subscriber with amount
if (!$this->updateBillrun($billrun, $item)) {
Billrun_Factory::log()->log("subscriber " . $sid . " cannot update billrun", Zend_Log::INFO);
continue;
}
$save_data[Billrun_Factory::db()->billrun] = $billrun;
}
$save_data[Billrun_Factory::db()->lines] = $item;
Billrun_Factory::dispatcher()->trigger('beforeAggregateSaveLine', array(&$save_data, &$this));
if (!$this->save($save_data)) {
Billrun_Factory::log()->log("subscriber " . $sid . " cannot save data", Zend_Log::INFO);
continue;
}
Billrun_Factory::log()->log("subscriber " . $sid . " saved successfully", Zend_Log::INFO);
}
// @TODO trigger after aggregate
Billrun_Factory::dispatcher()->trigger('afterAggregate', array($this->data, &$this));
}
示例4: load
/**
* load the data to aggregate
*/
public function load()
{
$billrun_key = $this->getStamp();
$subscriber = Billrun_Factory::subscriber();
$filename = $billrun_key . '_leftover_aggregator_input';
Billrun_Factory::log()->log("Loading file " . $filename, Zend_Log::INFO);
$billrun_end_time = Billrun_Util::getEndTime($billrun_key);
$this->data = $subscriber->getListFromFile('files/' . $filename, $billrun_end_time);
if (!count($this->data)) {
Billrun_Factory::log()->log("No accounts were found for leftover aggregator", Zend_Log::ALERT);
}
if (is_array($this->data)) {
$this->data = array_slice($this->data, $this->page * $this->size, $this->size, TRUE);
}
Billrun_Factory::log()->log("aggregator entities loaded: " . count($this->data), Zend_Log::INFO);
Billrun_Factory::dispatcher()->trigger('afterAggregatorLoadData', array('aggregator' => $this));
}
示例5: load
public function load()
{
$this->date = date(Billrun_Base::base_dateformat, $this->now);
$subscriber = Billrun_Factory::subscriber();
$this->account_data = array();
$res = $subscriber->getList(0, 1, $this->date, $this->aid);
if (!empty($res)) {
$this->account_data = current($res);
}
$billrun_params = array('aid' => $this->aid, 'billrun_key' => $this->stamp, 'autoload' => false);
$billrun = Billrun_Factory::billrun($billrun_params);
$manual_lines = array();
$deactivated_subscribers = array();
foreach ($this->account_data as $subscriber) {
if (!Billrun_Factory::db()->rebalance_queueCollection()->query(array('sid' => $subscriber->sid), array('sid' => 1))->cursor()->current()->isEmpty()) {
$subscriber_status = "REBALANCE";
$billrun->addSubscriber($subscriber, $subscriber_status);
continue;
}
if ($billrun->subscriberExists($subscriber->sid)) {
Billrun_Factory::log()->log("Billrun " . $this->stamp . " already exists for subscriber " . $subscriber->sid, Zend_Log::ALERT);
continue;
}
$next_plan_name = $subscriber->getNextPlanName();
if (is_null($next_plan_name) || $next_plan_name == "NULL") {
$subscriber_status = "closed";
$current_plan_name = $subscriber->getCurrentPlanName();
if (is_null($current_plan_name) || $current_plan_name == "NULL") {
$deactivated_subscribers[] = array("sid" => $subscriber->sid);
}
} else {
$subscriber_status = "open";
$flat_entry = $subscriber->getFlatEntry($this->stamp, true);
$manual_lines = array_merge($manual_lines, array($flat_entry['stamp'] => $flat_entry));
}
$manual_lines = array_merge($manual_lines, $subscriber->getCredits($this->stamp, true));
$billrun->addSubscriber($subscriber, $subscriber_status);
}
// print_R($manual_lines);die;
$this->lines = $billrun->addLines($manual_lines, $deactivated_subscribers);
$billrun->filter_disconected_subscribers($deactivated_subscribers);
$this->data = $billrun->getRawData();
}
示例6: load
public function load()
{
$this->date = date(Billrun_Base::base_dateformat, $this->now);
$subscriber = Billrun_Factory::subscriber();
$this->account_data = array();
$res = $subscriber->getList(0, 1, $this->date, $this->aid);
if (!empty($res)) {
$this->account_data = current($res);
}
$previous_billrun_key = Billrun_Util::getPreviousBillrunKey($this->stamp);
if (Billrun_Billrun::exists($this->aid, $previous_billrun_key)) {
$start_time = 0;
// maybe some lines are late (e.g. tap3)
} else {
$start_time = Billrun_Util::getStartTime($this->stamp);
// to avoid getting lines of previous billruns
}
$billrun_params = array('aid' => $this->aid, 'billrun_key' => $this->stamp, 'autoload' => false);
$billrun = Billrun_Factory::billrun($billrun_params);
$flat_lines = array();
foreach ($this->account_data as $subscriber) {
if ($billrun->subscriberExists($subscriber->sid)) {
Billrun_Factory::log()->log("Billrun " . $this->stamp . " already exists for subscriber " . $subscriber->sid, Zend_Log::ALERT);
continue;
}
$next_plan_name = $subscriber->getNextPlanName();
if (is_null($next_plan_name) || $next_plan_name == "NULL") {
$subscriber_status = "closed";
} else {
$subscriber_status = "open";
$flat_lines[] = new Mongodloid_Entity($subscriber->getFlatEntry($this->stamp));
}
$billrun->addSubscriber($subscriber, $subscriber_status);
}
$this->lines = $billrun->addLines(false, $start_time, $flat_lines);
$this->data = $billrun->getRawData();
}
示例7: writeLine
/**
* Override parent calculator to save changes with update (not save)
*/
public function writeLine($line, $dataKey)
{
Billrun_Factory::dispatcher()->trigger('beforeCalculatorWriteLine', array('data' => $line));
$save = array();
$saveProperties = array_keys(Billrun_Factory::subscriber()->getAvailableFields());
foreach ($saveProperties as $p) {
if (!is_null($val = $line->get($p, true))) {
$save['$set'][$p] = $val;
}
}
$where = array('stamp' => $line['stamp']);
Billrun_Factory::db()->linesCollection()->update($where, $save);
Billrun_Factory::dispatcher()->trigger('afterCalculatorWriteLine', array('data' => $line));
if (!isset($line['usagev']) || $line['usagev'] === 0) {
$this->removeLineFromQueue($line);
unset($this->data[$dataKey]);
}
}
示例8: subscriber
/**
* method to retrieve the subscriber instance
*
* @return Billrun_Subscriber
*/
public static function subscriber()
{
if (!self::$subscriber) {
$subscriberSettings = self::config()->getConfigValue('subscriber', array());
self::$subscriber = Billrun_Subscriber::getInstance($subscriberSettings);
}
return self::$subscriber;
}
示例9: load
/**
* load the data to aggregate
*/
public function load()
{
$billrun_key = $this->getStamp();
$date = date(Billrun_Base::base_dateformat, Billrun_Util::getEndTime($billrun_key));
$subscriber = Billrun_Factory::subscriber();
Billrun_Factory::log()->log("Loading page " . $this->page . " of size " . $this->size, Zend_Log::INFO);
if ($this->overrideAccountIds) {
$this->data = array();
foreach ($this->overrideAccountIds as $account_id) {
$this->data = $this->data + $subscriber->getList(0, 1, $date, $account_id);
}
} else {
$this->data = $subscriber->getList($this->page, $this->size, $date);
}
Billrun_Factory::log()->log("aggregator entities loaded: " . count($this->data), Zend_Log::INFO);
Billrun_Factory::dispatcher()->trigger('afterAggregatorLoadData', array('aggregator' => $this));
}