Beispiel #1
0
 public function handle_request_internal()
 {
     //组织POST参数
     $params = array();
     if (!isset($this->_params['brokerId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS);
     } else {
         $broker_id = $this->_params["brokerId"];
     }
     if (!isset($this->_params["cityId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS);
     }
     if (!isset($this->_params["propId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_ID_MISS);
     }
     if (!isset($this->_params["offer"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_BID_PRICE_MISS);
     }
     if (!Bll_City::isBidCity($this->_params["cityId"])) {
         $error_code = Const_HzErrorInfo::NOBIDCITY;
         return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
     }
     $search = new Util_SearchUtil();
     $prop = Bll_HzProp::get_prop($this->_params["propId"]);
     $blockid = $prop['blockid'];
     $price = $prop['pricenum'];
     $price_block = Bll_HzBidPlan::get_price_block($this->_params["cityId"], $price);
     $ajkid = Bll_HzProp::get_subregion_id($prop['commId'], $this->_params["propId"]);
     $rank = $search->getHpRankByProp($this->_params["cityId"], $ajkid, $this->_params["propId"], $price_block['LOWER'], $price_block['UPPER'], $this->_params['offer']);
     $return = array();
     $return["status"] = "ok";
     $return["data"] = $rank;
     return $return;
 }
 public function handle_request_internal()
 {
     if (!isset($this->_params['propId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_ID_MISS);
     }
     //获取租房房信息
     $propInfo = Bll_HzProp::get_prop($this->_params['propId']);
     /*
     备案编号:fileNo
     小区ID:commId
     小区名字:commName
     房间数:roomNum
     厅数:hallNum
     卫生间数:toiletNum
     面积:area
     房源所在的楼层: proFloor
     总楼层: floorNum
     装修:fitment
     朝向:exposure
     标题:title
     描述:description
     小区图:commImg
     室内图:roomImg
     房型图:moduleImg
     */
     if (!empty($propInfo)) {
         $return = array();
         $return["status"] = "ok";
         $community = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($propInfo['commid'], 2);
         $return["data"]['propInfo']['fileNo'] = $propInfo['houseCard'];
         $return["data"]['propInfo']['commId'] = $propInfo['commid'];
         $return["data"]['propInfo']['commName'] = $propInfo['commname'];
         $return["data"]['propInfo']['commAddress'] = $community['commLocal'];
         $return["data"]['propInfo']['roomNum'] = $propInfo['roomnum'];
         $return["data"]['propInfo']['hallNum'] = $propInfo['hallnum'];
         $return["data"]['propInfo']['toiletNum'] = $propInfo['toilnetnum'];
         $return["data"]['propInfo']['area'] = round($propInfo['areanum']);
         $return["data"]['propInfo']['floor'] = $propInfo['floor'];
         $return["data"]['propInfo']['floorNum'] = $propInfo['totalfloor'];
         // 装修类型
         $fitments_unify = APF::get_instance()->get_config('ajk_fitment_unify', 'zu_house');
         $fitments = APF::get_instance()->get_config('ajk_fitment', 'zu_house');
         $fitment = array_keys($fitments[$propInfo['cityid']]);
         $fitment_unify = array_keys($fitments_unify[$propInfo['cityid']]);
         $key = array_search($propInfo['fitment'], $fitment);
         $return["data"]['propInfo']['fitment'] = $fitment_unify[$key];
         //朝向
         $toward = APF::get_instance()->get_config('toward', 'zu_house');
         $return["data"]['propInfo']['exposure'] = $toward[$propInfo['toward']];
         //$return["data"]['propInfo']['exposure']     = $propInfo['toward'];
         $return["data"]['propInfo']['title'] = $propInfo['title'];
         $return["data"]['propInfo']['description'] = $propInfo['descript'];
         $return["data"]['propInfo']['price'] = $propInfo['pricenum'];
         $return["data"]['propInfo']['style'] = $propInfo['protype'];
         $return["data"]['propInfo']['shareRent'] = $propInfo['renttype'];
         $return["data"]['propInfo']['shareSex'] = $propInfo['sharesex'];
         $return["data"]['propInfo']['shareType'] = $propInfo['sharetype'];
         $prop_imgs = Bll_HzProp::get_images($this->_params['propId'], 1, false, false);
         $return["data"]["propInfo"]["roomImg"] = array();
         $return["data"]["propInfo"]["commImg"] = array();
         $return["data"]["propInfo"]["moduleImg"] = array();
         if (count($prop_imgs)) {
             foreach ($prop_imgs as $k => $img) {
                 $ajkcid = intval($img['ajkcid']);
                 if ($ajkcid > 0) {
                     $b_src = Bll_Image_UtilsImage::show_a_img_size($img['hostid'], $img['imageid'], $ajkcid, '420x315');
                 } else {
                     $b_src = 'http://pic' . $img['hostid'] . '.ajkimg.com/display/hz/' . $img['imageid'] . '/420x315.jpg';
                 }
                 $prop_imgs = array('imgId' => $img['id'], 'imgUrl' => $b_src, 'default' => $img['default']);
                 if (1 == $img['type']) {
                     $return["data"]['propInfo']['roomImg'][] = $prop_imgs;
                 } else {
                     if (2 == $img['type']) {
                         $return["data"]['propInfo']['moduleImg'][] = $prop_imgs;
                     } else {
                         $return["data"]['propInfo']['commImg'][] = $prop_imgs;
                     }
                 }
             }
         }
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR);
     }
     return $return;
 }
Beispiel #3
0
 /**
  * 108 房源价格变更
  * 查选房源信息是否存在
  *   如果不存在 返回结束
  *   如果存在 记录房源编辑日志 type=2
  * 查询该房源的计划关系
  *   如果不存在 返回结束
  *   如果存在,重新计算定价的底价并更新计划关系表中的底价
  * 查询计划
  *   如果计划不在推广 返回结束
  *   如果计划正在推广或者第二天推广, 记录房源更新日志 type=4
  * 处理竞价
  */
 private function change_prop_price()
 {
     $data = self::build_prop_log($this->params, 2, "房源修改价格", $this->params['broker_id']);
     $houseStatus = json_decode($this->params['remark'], true);
     $data['remark'] = json_encode(array('oldPrice' => $houseStatus['oldPrice'], 'newPrice' => $houseStatus['price'], 'msg' => $data['remark']));
     if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
         throw new Exception_BllErrorException("房源{$this->params['broker_id']}修改价格日志写入失败");
     } else {
         $this->allReturn[] = "房源{$this->params['broker_id']}修改价格日志写入";
     }
     if ($this->params['isComboCity']) {
         if (!($comboRelation = Bll_Combo_HouseRelation::getOnlineRelationByHouseId($this->params['pro_id']))) {
             return $this->allReturn[] = "房源{$this->params['pro_id']}套餐关系为空";
         }
         //$this->writePropLog(4, '更新');
     } else {
         // 查询定价关系
         if (!($fixPlanning = Model_Plan_HzPlanning::getPropFixPlan($this->params['pro_id']))) {
             return $this->allReturn[] = "房源{$this->params['pro_id']}定价关系为空";
         }
         // 重新计算低价并更新
         $prop = Bll_HzProp::get_prop($this->params['pro_id']);
         $priceNum = $prop['pricenum'];
         $cityId = $prop['cityid'];
         $priceLevel = Model_House_HzPriceChoice::get_price($cityId, $priceNum);
         $bottomPrice = $priceLevel['price'];
         Model_Plan_HzPlanning::updatePropPlan($fixPlanning['id'], array('unit_price' => $bottomPrice));
         if (in_array($fixPlanning['is_valid'], array(Const_HzPlan::SPREAD, Const_HzPlan::AUTOOVER))) {
             //$this->writePropLog(4, '更新');
         }
     }
     $this->tempDoBid();
 }
 /**
  * 处理小区id为0的情况
  * @param $beginId
  * @param $nocomms
  * @param $cityId
  * @param int $limit
  * @return array
  */
 public function dealPropCommidZero($beginId, $nocomms, $cityId, $limit = 100)
 {
     $allReturn = array();
     if (empty($nocomms)) {
         return array('status' => 0, 'msg' => 'nocomms is empty');
     }
     $searchProps = Bll_HzProp::getSearchProps(array('where' => 'status in (1,2,5,6,9,11,12,13,14,15) and cityid=? and proid>? limit ' . $limit, 'params' => array($cityId, $beginId)), $cityId);
     if (empty($searchProps)) {
         return array('status' => 0, 'msg' => 'empty');
     }
     foreach ($searchProps as $searchProp) {
         $proId = $this->cursor = $searchProp['proid'];
         if ($searchProp['commid']) {
             continue;
         }
         $prop = Bll_HzProp::get_prop($proId);
         foreach ($nocomms as $index => $nocomm) {
             $blockInofNew = Bll_HzProp::getBlockByTypeCode($nocomm['new_code']);
             $blockInofOld = Bll_HzProp::getBlockByTypeCode($nocomm['old_code']);
             if (!$blockInofNew || !$blockInofOld) {
                 return array('status' => 0, 'msg' => 'block info is empty');
             }
             if ($prop['blockid'] == $blockInofOld['id'] && $prop['areaid'] == $blockInofOld['parentid']) {
                 // 更新房源信息
                 $result = $this->changePropBlock($proId, $blockInofNew['id'], $blockInofNew['parentid'], $cityId, $searchProp['ajk_brokerid']);
                 if ($result['status'] == 0) {
                     $this->setLog('租房房源区域板块更新失败 id:[ ' . $proId . ' ]' . ' info:' . $result['msg']);
                 } else {
                     $this->setLog('租房房源区域板块更新成功 id:[ ' . $proId . ' ]');
                     //通知上下架队列
                     $param['prop_id'] = $proId;
                     $param['spread_id'] = 0;
                     //
                     $param['ajk_broker_id'] = $searchProp['ajk_brokerid'];
                     $param['from'] = 'cms_' . __FUNCTION__;
                     $param['time'] = time();
                     $param['operate_id'] = 0;
                     $param['site_type'] = 2;
                     $param['remark'] = json_encode(array('cityId' => $cityId, 'old' => $nocomm['old_code'], 'new' => $nocomm['new_code']));
                     $param['type'] = 'community_area_change_ex';
                     $getRes = $this->action_collect_Api_new($param);
                     $res = json_decode($getRes, true);
                     if ($res['status'] == 'err') {
                         $this->setLog('调用上下架队列api失败,租房房源id:[ ' . $proId . ' ] info:' . $res['msg']);
                     } else {
                         $this->setLog('调用上下架队列api成功,租房房源id:[ ' . $proId . ' ] info:' . $res['msg']);
                     }
                 }
                 $allReturn = array_merge($allReturn, $result['msg']);
             }
         }
     }
     return array('status' => 1, 'msg' => $allReturn);
 }