Пример #1
0
 /**
  * 获取房源点击量
  * @param array $proIds 房源ID,支持传入一个ID或者一维ID数组
  * @param array $planIds 计划ID数组,可不传,也支持传入一个ID或者一维ID数组,如果传入,只能为一个计划ID或者一维计划ID数组
  * @param string $date 日期
  * @param int $planType 计划类型
  * @return array|int 返回值为多为数组,array(0 => array(点击量,房源ID),1 => array(点击量,房源ID))
  */
 public function getProClicks($proIds = array(), $planIds = array(), $date = '', $planType = 1)
 {
     return Model_Plan_HzPlanBilling::getProClicks($proIds, $planIds, $date, $planType);
 }
Пример #2
0
 /**
  * 获取经纪人某段时间内房源平均点击
  * @param $brokerId
  * @param $start 20140715
  * @param $end 20140715
  * @return array|bool|string
  */
 public static function getAverageClickByBrokerId($brokerId, $start, $end)
 {
     $key = sprintf('%s_%s_%d_%d_%d', __CLASS__, __METHOD__, $brokerId, $start, $end);
     $cacheObj = APF_Cache_Factory::get_instance()->get_memcache();
     $averageClick = $cacheObj->get($key);
     if ($averageClick) {
         return $averageClick;
     }
     $clickNums = Model_Plan_HzPlanBilling::getClickNumByBrokerId($brokerId, $start, $end);
     $clickNum = 0;
     $proNum = 0;
     foreach ($clickNums as $item) {
         $clickNum += $item['cnt'];
         $proNum++;
     }
     $averageClick = (int) ($clickNum / $proNum);
     $cacheObj->set($key, $averageClick, 0, self::EXPIRE_TIME);
     return $averageClick;
 }
Пример #3
0
 /**
  * 获取定价消费信息
  *  注意: 竞价不能走这个方法。此处读取的billing表
  *        而竞价只有最后一笔扣费才会记录billing表
  *        应该取hzstats_db.propclick_stats_hour_oth
  * @param $planIds
  * @param $day
  * @return array
  */
 public static function getBidPlanConsumeAndClickInfos($planIds, $day = '')
 {
     if (!$day) {
         $day = date('Ymd');
     }
     $result = array();
     $data = Model_Plan_HzPlanBilling::getConsumeAndClickInfo(array('planId' => $planIds, 'planType' => 2, 'day' => $day));
     foreach ($data as $item) {
         $result[$item['plan_id']] = $item;
     }
     return $result;
 }
Пример #4
0
 public static function get_plan_fee($broker_id, $plan_ids, $date, $plan_type)
 {
     if (empty($broker_id) || empty($plan_ids) || empty($plan_type)) {
         return array();
     }
     $plan_ids = is_array($plan_ids) ? $plan_ids : array($plan_ids);
     $date = empty($date) ? date('Ymd') : $date;
     $lists = Model_Plan_HzPlanBilling::data_access()->filter('user_id', $broker_id)->filter_by_op('plan_id', 'in', $plan_ids)->filter('plan_type', $plan_type)->filter_by_op('error_code', 'in', array(-1, 1, -2))->filter('current_day', $date)->get_all();
     $arr_return = array();
     if (count($lists) > 0) {
         foreach ($lists as $list_tmp) {
             $arr_return[$list_tmp['plan_id']]['total_cost'] += $list_tmp['charge_price'];
             $arr_return[$list_tmp['plan_id']]['total_click']++;
             // TODO 这个数据和直接读取propclick_stats_hour_xxx得到的数据不一致
             $arr_return[$list_tmp['plan_id']]['total_unit'] += $list_tmp['unit_price'];
         }
     }
     return $arr_return;
 }