Example #1
0
 /**
  * app 租房推广情况
  */
 public static function get_broker_plans($broker_id, $city_id)
 {
     if (empty($broker_id) || empty($city_id)) {
         return array();
     }
     $bid_num = Bll_HzBidPlan::get_broker_bidprop_count($broker_id);
     $plannings = Dao_Broker_HzPlan::get_broker_planning($broker_id);
     $fix_array = $fix_return = array();
     foreach ($plannings as $planning) {
         if ($planning['plan_type'] == 1) {
             $fix_array[$planning['plan_id']]++;
         }
     }
     $broker_fix_plans = Dao_Broker_HzPlan::get_broker_plan($broker_id);
     $sataus_arr = array(1 => '有效', 2 => '计划上限', 3 => '手工结束', 4 => '暂停', 5 => '待推广', 6 => '删除', 7 => '余额上限', 9 => '手动暂停');
     foreach ($broker_fix_plans as $fix) {
         $plan = array();
         if ($fix['status'] == 1) {
             $status = 1;
             $desStatus = "计划推广中";
         } elseif ($fix['status'] == 4 || $fix['status'] == 9) {
             $status = 2;
             $desStatus = "手动暂停";
         } else {
             $status = 2;
             $desStatus = "暂停";
         }
         $plan['fixPlanId'] = $fix['id'];
         $plan['fixPlanName'] = $fix['plan_title'];
         $plan['fixPlanPropNum'] = intval($fix_array[$fix['id']]);
         $plan['fixPlanState'] = $status;
         $plan['fixPlanStateDesc'] = $desStatus;
         $fix_return[] = $plan;
     }
     $outline_num = self::get_outline_list($broker_id, $city_id, 0);
     return array('bidPlan' => array('bidPlanPropNum' => $bid_num), 'fixPlan' => $fix_return, 'unRecommendPropNum' => $outline_num);
 }
Example #2
0
 /**
  * 获取经纪人可竞价的房源,定价房源中去除非多图和已竞价
  */
 public static function get_canbid_props($broker_id)
 {
     if (empty($broker_id)) {
         return array();
     }
     $plannings = Dao_Broker_HzPlan::get_broker_planning($broker_id, '1,2', '1,2,3,5,7,8,9');
     $fix_planning = $bid_planning = array();
     foreach ($plannings as $planning) {
         if ($planning['plan_type'] == 1) {
             $fix_planning[$planning['proid']] = $planning['proid'];
         } else {
             if ($planning['plan_type'] == 2) {
                 $bid_plan = Dao_Broker_HzPlan::get_plan($planning['plan_id']);
                 if ($bid_plan) {
                     $bid_planning[$planning['proid']] = $planning['proid'];
                 }
             }
         }
     }
     foreach ($fix_planning as $key => $value) {
         //过滤已竞价
         if (in_array($value, $bid_planning)) {
             unset($fix_planning[$key]);
         }
     }
     $props = Dao_Broker_HzProp::get_prop($fix_planning);
     foreach ($props as $key => $prop) {
         //过滤非多图
         if (!$prop['content_basic']['quality']) {
             unset($props[$key]);
             continue;
         }
         //过滤userid
         if ($prop['content_basic']['userid'] != $broker_id) {
             unset($props[$key]);
             continue;
         }
     }
     return $props;
 }
Example #3
0
 public function getPpcPropsInOneComm($brokerId, $cityId, $commId = '')
 {
     //获取该经纪人下所有的房源列表(竞价、定价、待推广房源)
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     $plannings = Dao_Broker_HzPlan::get_broker_planning($hzBrokerId);
     $base_domain = APF::get_instance()->get_config('base_domain');
     $commProps = array();
     if (!empty($plannings)) {
         $planIds = array();
         foreach ($plannings as $arr) {
             $planIds[] = $arr['plan_id'];
         }
         //参与推广房源
         $plansProps = Bll_HzFixPlan::get_plan_props($planIds, $cityId);
         $propCommPair = array();
         foreach ($plansProps as $planProps) {
             foreach ($planProps['props'] as $propId => $prop) {
                 $contentBasic = $prop['content_basic'];
                 $row = array();
                 $row['id'] = $propId;
                 $row['title'] = $contentBasic['title'];
                 $row['commId'] = $contentBasic['commid'];
                 $row['commName'] = $contentBasic['commname'];
                 $row['roomNum'] = $contentBasic['roomnum'];
                 $row['hallNum'] = $contentBasic['hallnum'];
                 $row['toiletNum'] = $contentBasic['toilnetnum'];
                 $row['area'] = round($contentBasic['areanum']);
                 $row['price'] = round($contentBasic['pricenum']);
                 $row['priceUnit'] = '元/月';
                 $row['imgUrl'] = 'http://pages.haozu.ajkcdn.com/20120824/img/global/nopic2_100-75.gif';
                 $row['isMoreImg'] = $contentBasic['quality'] ? 1 : 0;
                 $row['renttype'] = $contentBasic['renttype'];
                 $row['propUrl'] = 'http://' . $base_domain . '/web/rent/x/' . $contentBasic['cityid'] . '/' . $propId . '-3';
                 $row['isBid'] = 0;
                 $row['isChoice'] = 0;
                 $row['isVisible'] = intval($contentBasic['status'] != 6);
                 $row['isPhonePub'] = intval(isset($contentBasic['from']) && $contentBasic['from'] == 'mobile-ajk-broker');
                 $row['publishDays'] = floor((time() - $contentBasic['created']) / 86400);
                 $row['publishDaysMsg'] = $row['publishDays'] > 0 ? "{$row['publishDays']}天前发布" : '今天发布';
                 $row['createTime'] = date('Y-m-d H:i:s', $contentBasic['created']);
                 $row['updateTime'] = date('Y-m-d H:i:s', $contentBasic['updated']);
                 $commProps[$contentBasic['commid']][$propId] = $row;
                 // 房源小区映射关系,用于添加房源的默认图片
                 $propCommPair[$propId] = $contentBasic['commid'];
             }
         }
         if ($propCommPair) {
             $propIds = array_keys($propCommPair);
             // 添加房源默认图
             $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds($propIds);
             foreach ($defaultImages as $defaultImage) {
                 $propId = $defaultImage['proid'];
                 $commProps[$propCommPair[$propId]][$propId]['imgUrl'] = $defaultImage->imageUrl();
             }
             $relations = Model_Plan_HzPlanning::getBidRelationsByHouseIds($propIds, array(Const_HzPlan::SPREAD, Const_HzPlan::WAITING));
             // 批量获取房源竞价计划
             $planIds = array();
             $planPropMap = array();
             foreach ($relations as $relation) {
                 $planIds[] = $relation['plan_id'];
                 $planPropMap[$relation['plan_id']] = $relation['proid'];
             }
             if ($planIds) {
                 $plans = Model_Plan_HzPlanBasic::getPlansByIds($planIds);
                 foreach ($plans as $plan) {
                     if ($plan->flag == 0) {
                         continue;
                     }
                     if ($plan->bid_version == 2) {
                         $propId = $planPropMap[$plan['id']];
                         $commProps[$propCommPair[$propId]][$propId]['isChoice'] = 1;
                     } else {
                         $propId = $planPropMap[$plan['id']];
                         $commProps[$propCommPair[$propId]][$propId]['isBid'] = 1;
                     }
                 }
             }
         }
     }
     $return = $commProps;
     // 如果是获取某单个小区房源列表
     if ($commId) {
         $ret['status'] = 'ok';
         $ret['data']['propertyList'] = $return[$commId] ? array_values($return[$commId]) : array();
     } else {
         $ret = $return;
     }
     return $ret;
 }