Ejemplo n.º 1
0
 /**
  * 获取单个定价组的房源列表,可批量(房源信息)
  * 单个计划ID或计划ID数组
  */
 public static function get_plan_props($plan_ids, $city_id)
 {
     $plannings = Dao_Broker_HzPlan::get_planning($plan_ids);
     $props = array();
     foreach ($plannings as $planning) {
         $props[$planning['plan_id']]['proids'][$planning['proid']] = $planning['proid'];
     }
     foreach ($props as $key => $plan) {
         $props[$key]['props'] = Dao_Broker_HzProp::get_prop($plan['proids']);
     }
     $bid_proids = Bll_HzBidPlan::get_broker_bidprop_count($plannings[0]['user_id'], true);
     foreach ($props as $key => $value) {
         $all_click_info = Dao_Broker_HzProp::get_prop_clicks($value['proids'], $city_id);
         $all_total_click_info = Dao_Broker_HzProp::get_prop_total_clicks($value['proids'], $city_id);
         foreach ($value['props'] as $proid_key => $prop_value) {
             $props[$key]['props'][$proid_key]['fix_click'] = intval($all_click_info[$proid_key]['fix_cnum']);
             $props[$key]['props'][$proid_key]['fix_total_click'] = intval($all_total_click_info[$proid_key]['fix_total_cnum']);
             $props[$key]['props'][$proid_key]['is_bid'] = empty($bid_proids[$proid_key]) ? 0 : 1;
         }
     }
     return $props;
 }
Ejemplo n.º 2
0
 /**
  * 获得经纪人已竞价房源列表
  */
 public static function get_broker_bidprop($broker_id, $city_id)
 {
     $plans = Dao_Broker_HzPlan::get_broker_plan($broker_id, '1,3,7', Const_HzPlan::BID_TYPE);
     $plan_info = array();
     $planids = $proids = array();
     if ($plans) {
         foreach ($plans as $plan) {
             $plan_info[$plan['id']]['plan'] = $plan;
             //计划信息
             $planids[] = $plan['id'];
         }
     } else {
         return array();
     }
     $plannings = Dao_Broker_HzPlan::get_planning($planids, Const_HzPlan::BID_TYPE);
     if ($plannings) {
         foreach ($plannings as $planning) {
             $proids[$planning['proid']] = $planning['proid'];
             $plan_info[$planning['plan_id']]['proid'] = $planning['proid'];
             //房源ID
             $plan_info[$planning['plan_id']]['offer'] = $planning['unit_price'];
         }
     } else {
         return array();
     }
     $proinfo = Dao_Broker_HzProp::get_prop($proids);
     $clicks = Dao_Broker_HzProp::get_prop_clicks($proids, $city_id);
     foreach ($plan_info as $key => $value) {
         $prop = $proinfo[$value['proid']];
         if (empty($prop)) {
             unset($plan_info[$key]);
             continue;
         }
         $plan_info[$key]['prop'] = $prop;
         //房源信息
         $plan_info[$key]['clicks'] = intval($clicks[$value['proid']]['bid_cnum']);
         //当天点击量
         $plan_info[$key]['reconsume'] = $plan_info[$key]['plan']['status'] == 1 ? round($plan_info[$key]['plan']['amount'] - $plan_info[$key]['plan']['total_consume'], 2) : 0;
         //预算余额
         $plan_info[$key]['consume'] = $plan_info[$key]['plan']['status'] == 1 ? round($plan_info[$key]['plan']['amount'], 2) : 0;
         //预算
         if ($value['plan']['status'] == 1) {
             $prop["content_basic"]['proid'] = $prop['proid'];
             $prop["content_basic"]['unit_price'] = $value['offer'];
             $rank = self::get_bid_rank($prop["content_basic"], $city_id);
             if ($rank < 5) {
                 $plan_info[$key]['rank'] = $rank;
             } else {
                 $plan_info[$key]['rank'] = '排队中';
             }
         } else {
             $plan_info[$key]['rank'] = '已暂停';
         }
     }
     return empty($plan_info) ? array() : $plan_info;
 }