예제 #1
0
 function getComboPropsInOneComm($brokerId, $cityId, $commId = '')
 {
     $base_domain = APF::get_instance()->get_config('base_domain');
     //获取套餐推广信息
     $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
     if (empty($comboSpreadHouseList)) {
         return array();
     } else {
         //获取房源信息
         $propIds = array_keys($comboSpreadHouseList);
         $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
     }
     //房源计划形态(是精选还是竞价)
     $spreads = array();
     if ($propIds) {
         $spreads = Model_Plan_AjkPropspread::getAjkPropSpreadByIds($propIds);
     }
     if (!empty($spreads)) {
         foreach ($spreads as $row) {
             $spreadArr[$row['propId']]['bidVersion'] = $row['bidVersion'];
             $spreadArr[$row['propId']]['status'] = $row['status'];
         }
     }
     foreach ($propsInfo as $propArr) {
         $propId = $propArr['proId'];
         $commProps[$propArr['commId']][$propId]['id'] = $propId;
         $commProps[$propArr['commId']][$propId]['title'] = $propArr['proName'];
         $commProps[$propArr['commId']][$propId]['commId'] = $propArr['commId'];
         $commProps[$propArr['commId']][$propId]['commName'] = $propArr['commName'];
         $commProps[$propArr['commId']][$propId]['roomNum'] = $propArr['roomNum'];
         $commProps[$propArr['commId']][$propId]['hallNum'] = $propArr['hallNum'];
         $commProps[$propArr['commId']][$propId]['toiletNum'] = $propArr['toiletNum'];
         $commProps[$propArr['commId']][$propId]['area'] = $propArr['areaNum'];
         $commProps[$propArr['commId']][$propId]['price'] = $propArr['proPrice'];
         $commProps[$propArr['commId']][$propId]['priceUnit'] = '万';
         $commProps[$propArr['commId']][$propId]['isVisible'] = $propArr['isVisible'];
         $commProps[$propArr['commId']][$propId]['imgUrl'] = 'http://pages.anjukestatic.com/img/global/nopic_100x75.gif';
         $commProps[$propArr['commId']][$propId]['isMoreImg'] = $propArr['isHighQulity'] ? 1 : 0;
         $commProps[$propArr['commId']][$propId]['isPhonePub'] = $propArr['uriCode'] == 'mobile.asyn' || $propArr['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0;
         $commProps[$propArr['commId']][$propId]['propUrl'] = 'http://' . $base_domain . '/web/sale/x/' . $propArr['cityId'] . '/' . $propId;
         $commProps[$propArr['commId']][$propId]['createTime'] = date('Y-m-d H:i:s', $propArr['postDate']);
         $commProps[$propArr['commId']][$propId]['totalClicks'] = isset($proClickInfo[$propId]) ? $proClickInfo[$propId] : 0;
         $commProps[$propArr['commId']][$propId]['isBid'] = $commProps[$propArr['commId']][$propId]['isChoice'] = 0;
         if (isset($spreadArr) && isset($spreadArr[$propId])) {
             if ($spreadArr[$propId]['bidVersion'] == 1 && $spreadArr[$propId]['status'] == 1) {
                 $commProps[$propArr['commId']][$propId]['isBid'] = 1;
             } elseif ($spreadArr[$propId]['bidVersion'] == 2 && ($spreadArr[$propId]['status'] == 1 || $spreadArr[$propId]['status'] == 11)) {
                 $commProps[$propArr['commId']][$propId]['isChoice'] = 1;
             }
         }
         $imgBll = Bll_Image_EsfHouseImage::getInstance();
         $commProps[$propArr['commId']][$propId]['imgUrl'] = $imgBll->getThumbImageUrl($propId, $propArr['commId']);
     }
     $return = $commProps;
     if ($commId) {
         $ret['status'] = 'ok';
         $ret['data']['propertyList'] = $return[$commId] ? array_values($return[$commId]) : array();
     } else {
         $ret = $return;
     }
     return $ret;
 }
예제 #2
0
 public function handle_request_internal()
 {
     // TODO: Implement handle_request_internal() method.
     $result['status'] = 'ok';
     $cityId = $this->_params['cityId'];
     $brokerId = $this->_params['brokerId'];
     $relations = Model_Plan_AjkFixRelation::getRelationListByPlanId($this->_params['planId'], $cityId);
     $propertyList = array('newList' => array(), 'oldList' => array());
     if (!empty($relations)) {
         $propIds = array();
         foreach ($relations as $row) {
             $propIds[] = $row['proId'];
         }
         $houseInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId, array('postDate' => 'desc'));
         //房源点击量
         $proClickDao = new DAO_My_Ppc_PlanOpe();
         $proClickInfo = $proClickDao->getProClick($propIds, strtotime("20120901"));
         $spreads = Model_Plan_AjkPropspread::getAjkPropSpreadByIds($propIds);
         if (!empty($spreads)) {
             foreach ($spreads as $row) {
                 $spreadArr[$row['propId']]['bidVersion'] = $row['bidVersion'];
                 $spreadArr[$row['propId']]['status'] = $row['status'];
             }
         }
         foreach ($houseInfo as $row) {
             $propId = $row['proId'];
             $list['propId'] = $propId;
             $list['title'] = $row['proName'];
             $list['commId'] = $row['commId'];
             $list['commName'] = $row['commName'];
             $list['roomNum'] = $row['roomNum'];
             $list['hallNum'] = $row['hallNum'];
             $list['toiletNum'] = $row['toiletNum'];
             $list['area'] = round($row['areaNum']);
             $list['price'] = is_float($row['proPrice']) ? round($row['proPrice'], 1) : $row['proPrice'];
             $list['priceUnit'] = '万';
             $list['totalClicks'] = isset($proClickInfo[$propId]) ? $proClickInfo[$propId] : 0;
             $list['isBid'] = $list['isChoice'] = 0;
             if (isset($spreadArr) && isset($spreadArr[$propId])) {
                 if ($spreadArr[$propId]['bidVersion'] == 1 && $spreadArr[$propId]['status'] == 1) {
                     $list['isBid'] = 1;
                 } elseif ($spreadArr[$propId]['bidVersion'] == 2 && ($spreadArr[$propId]['status'] == 1 || $spreadArr[$propId]['status'] == 11)) {
                     $list['isChoice'] = 1;
                 }
             }
             $list['isMoreImg'] = $row['isHighQulity'];
             $list['isVisible'] = $row['isVisible'];
             $list['isPhonePub'] = $row['uriCode'] == 'mobile.asyn' || $row['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0;
             $list['createTime'] = $row['postDate'];
             $imgBll = Bll_Image_EsfHouseImage::getInstance();
             $list['imgUrl'] = $imgBll->getThumbImageUrl($propId, $row['commId']);
             //增加委托房源标签
             if ($row['commitionType'] == 2) {
                 $list['isEntrust'] = 1;
             } else {
                 $list['isEntrust'] = 0;
             }
             //计算出房源推广天数
             $timeFixStr = strtotime(date("Ymd", $row['postDate']));
             $leftDay = floor((time() - $timeFixStr) / 86400);
             if ($leftDay >= 30) {
                 $propertyList['oldList'][] = $list;
             } else {
                 $propertyList['newList'][] = $list;
             }
         }
     }
     $result['data'] = $propertyList;
     return $result;
 }
예제 #3
0
 public function handle_request_internal()
 {
     header("Access-Control-Allow-Origin: *");
     $propId = $this->_params['propId'];
     //好丑陋。。。。。。好无奈。。。。。。
     //委托房源自动转发停用,为了app能够展示报错信息。。。
     if (empty($propId)) {
         $this->_params['apiDebug'] = 1;
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '0000', 'message' => '委托房源自动转发功能已停用;若要发布请手动发布');
     }
     $propInfo = Bll_Ppc_ServiceAPI::getHouseInfo($propId);
     $brokerId = $this->_params['brokerId'];
     $houseInfo = Model_House_EsfHouseElementFactory::getHouseBaseInfo($propId);
     if (empty($houseInfo)) {
         $cityId = Model_Broker_AjkBrokerExtend::getCityIdByBrokerId($this->_params['brokerId']);
         $houseInfo = Bll_House_EsfHouse::getHouseBaseInfo($propId, $cityId);
     }
     if (!empty($houseInfo)) {
         $result['status'] = 'ok';
         $areaCode = $houseInfo['areaCode'];
         $block = Bll_Commtype_Api::getInfoByTypeCode($areaCode);
         $area = Bll_Commtype_Api::getInfoByTypeId($block['parentId']);
         $area_name = $area['typeName'];
         $block_name = $block['typeName'];
         $data['title'] = $houseInfo['proName'];
         $data['commId'] = $houseInfo['commId'];
         $data['commName'] = $houseInfo['commName'];
         //小区信息
         $commInfo = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($data['commId'], 2);
         $data['commLocation'] = $commInfo['commLocal'];
         $data['sosolat'] = $commInfo['sosolat'];
         //纬度
         $data['sosolng'] = $commInfo['sosolng'];
         //经度
         $data['floor'] = $propInfo['property']['ProFloor'];
         $data['totalFloor'] = $propInfo['property']['FloorNum'];
         $propDescription = $propInfo['property']['sale']['AddExplan'];
         $propDescription = str_replace('<p>', "", $propDescription);
         $propDescription = str_replace('</p>', "", $propDescription);
         $propDescription = trim($propDescription);
         $data['propDescription'] = $propDescription;
         $data['areaname'] = $area_name;
         $data['blockname'] = $block_name;
         $data['roomNum'] = $houseInfo['roomNum'];
         $data['hallNum'] = $houseInfo['hallNum'];
         $data['toiletNum'] = $houseInfo['toiletNum'];
         $data['area'] = $houseInfo['areaNum'];
         $data['areaUnit'] = '平米';
         $data['price'] = $houseInfo['proPrice'];
         $data['priceUnit'] = '万';
         $data['isMoreImg'] = $houseInfo['isHighQulity'];
         $data['isVisible'] = $houseInfo['isVisible'];
         $data['isPhonePub'] = $houseInfo['uriCode'] == 'mobile.asyn' || $houseInfo['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0;
         $data['propImagesUrl'] = array();
         $data['propImages'] = $data['outdoorImage'] = array();
         if ($propInfo['attachments']['attachments']) {
             $propImageNum = 0;
             $outdoorImageNum = 0;
             $images = $propInfo['attachments']['attachments'];
             foreach ($images as $image) {
                 if ($image['DataType'] == 2) {
                     if ($propImageNum >= 8) {
                         continue;
                     }
                     $imageInfo = array();
                     $url = Util_ImageUtils::getResizeURL($image['FileName'], $image['host_id'], 600, 600);
                     $url = str_replace("display", "display/e", $url);
                     $imageInfo['bigImageUrl'] = $url;
                     $data['propImages'][] = $imageInfo;
                     $propImageNum += 1;
                 } else {
                     if ($image['DataType'] == 3) {
                         if ($outdoorImageNum >= 1) {
                             continue;
                         }
                         $imageInfo = array();
                         $url = Util_ImageUtils::getResizeURL($image['FileName'], $image['host_id'], 600, 600);
                         $url = str_replace("display", "display/e", $url);
                         $imageInfo['bigImageUrl'] = $url;
                         $data['outdoorImage'][] = $imageInfo;
                         $outdoorImageNum += 1;
                     }
                 }
             }
         }
         $spread = Model_Plan_AjkPropspread::getAjkPropSpreadByIds($propId);
         $data['isChoice'] = $data['isBid'] = 0;
         if (!empty($spread)) {
             if ($spread[0]['bidVersion'] == 1 && $spread[0]['status'] == 1) {
                 $data['isBid'] = 1;
             } elseif ($spread[0]['bidVersion'] == 2 && ($spread[0]['status'] == 1 || $spread[0]['status'] == 11)) {
                 $data['isChoice'] = 1;
             }
         }
         //计算出房源推广天数
         $timeFixStr = strtotime(date("Ymd", $houseInfo['postDate']));
         $leftDay = floor((time() - $timeFixStr) / 86400);
         $data['publishDaysMsg'] = $leftDay > 0 ? $leftDay . '天前发布' : '今天发布';
         $imgBll = Bll_Image_EsfHouseImage::getInstance();
         $data['imgUrl'] = $imgBll->getThumbImageUrl($propId, $houseInfo['commId']);
         $mobileBaseDomain = APF::get_instance()->get_config("mobile_base_domain");
         $data['url'] = 'http://' . $mobileBaseDomain . '/sale/x/' . $houseInfo['cityId'] . '/' . $houseInfo->proId;
         //增加委托房源标签
         if ($houseInfo['commitionType'] == 2) {
             $data['isEntrust'] = 1;
         } else {
             $data['isEntrust'] = 0;
         }
     } else {
         $data['status'] = 'error';
         $data['message'] = '房源信息不存在';
     }
     $result['data'] = $data;
     return $result;
 }