Exemple #1
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     //检测title
     $checkRes = $this->checkTitle($this->_params);
     if (!$checkRes) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_LENGTH_ERROE);
     }
     //构造房源接口数据
     $params = Bll_Prop::gen_prop_info($this->_params);
     $params['proid'] = $this->_params['propId'];
     if (isset($params['status']) and $params['status'] === 'error') {
         return $params;
     }
     //判断经纪人为ppc经纪人 & 套餐经纪人
     //根据不同类型判断调用不同的java接口
     if (Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         $params['isComboBroker'] = true;
         $api_url = 'sale/properties/update?json';
     } else {
         $params['isComboBroker'] = false;
         $api_url = 'ppc/properties/update?json';
     }
     //调用房源编辑接口
     $result = Util_CallAPI::callJavaInternalApi($api_url, $params, false);
     if ($result['data']['status'] !== 'ok') {
         return Util_MobileAPI::error(Bll_Prop::changeJavaAPICodeToSelfCode($result['data']['code']));
     }
     $return = array();
     $return["status"] = "ok";
     $return['data'] = array();
     return $return;
 }
Exemple #2
0
 public function handle_request_internal()
 {
     if (!isset($this->_params["propId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_ID_MISS);
     }
     $json = $this->_params['imageJson'];
     //$json = '[{"type":3,"commPicIds":12345}]';
     $imageJson = json_decode($json, true);
     if ($imageJson) {
         $proid = $this->_params["propId"];
         foreach ($imageJson as $img) {
             $api_url = 'image/addImg';
             $img_params['brokerId'] = $this->_params['brokerId'];
             $img_params['propId'] = $proid;
             $img_params['imageJson'] = json_encode($img);
             $img_params['from'] = APF::get_instance()->get_config('java_api_from');
             $img_params["token"] = $this->_params["token"];
             //token
             ksort($img_params);
             $img_params_json = json_encode($img_params);
             $img_return = Util_CallAPI::get_data_from_java_v3($api_url, $img_params_json, false);
             if ($img_return['data']['status'] != 'ok' && !$img_return['data']['id']) {
                 return Util_MobileAPI::error(Bll_Prop::changeJavaAPICodeToSelfCode($img_return['data']['code']));
             }
         }
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_IMAGEJSON_ERROR);
     }
     $return = array();
     $return["status"] = "ok";
     $return['data']['id'] = $img_return['data']['id'];
     return $return;
 }
Exemple #3
0
 public function handle_request_internal()
 {
     if (mb_strlen($this->_params['title'], 'UTF-8') < 5 || mb_strlen($this->_params['title'], 'UTF-8') > 30) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_LENGTH_ERROE);
     }
     $params = Bll_ZuProp::gen_prop_info($this->_params);
     $params['proid'] = $this->_params['propId'];
     //unset($params['style']);
     //获取租房房信息
     /*$propInfo       =  Bll_HzProp::get_prop($this->_params['propId']);
       $style = intval($propInfo['protype']) ? intval($propInfo['protype']) : 1;
       $change_style   = array(1=>1, 4=>2, 3=>3, 5=>4, 2=>5, 6=>6, 7=>7, 8=>8);
       $params['style'] = $change_style[$style];*/
     unset($params['year']);
     if (isset($params['status']) and $params['status'] === 'error') {
         return $params;
     }
     $brokerId = $this->_params['brokerId'];
     if (isset($brokerId) && Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         $params['isComboBroker'] = true;
         $api_url = 'rent/properties/update?json=1';
     } else {
         $params['isServiceInternal'] = 1;
         $params['isComboBroker'] = false;
         $api_url = '/service-internal/rest/properties/update?json=1';
     }
     $result = Util_CallAPI::callJavaInternalApi($api_url, $params, false);
     if ($result['data']['status'] !== 'ok') {
         return Util_MobileAPI::error(Bll_Prop::changeJavaAPICodeToSelfCode($result['data']['code']));
     }
     $return = array();
     $return["status"] = "ok";
     $return['data'] = array();
     return $return;
 }
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $url = 'haopan/unRecommendProp/' . $brokerId . '/1';
     $data = Util_CallAPI::get_data_from_java_v3($url);
     mb_internal_encoding('UTF-8');
     if ($data['data']['status'] === 'ok') {
         if (!isset($data['data']['propBaseInfo'])) {
             $ret = array('status' => 'ok', 'data' => array('propertyList' => array()));
             return $ret;
         }
         $props = array();
         if (!empty($data['data']['propBaseInfo'])) {
             foreach ($data['data']['propBaseInfo'] as $info) {
                 list($room, $hall, $wc) = $this->get_house_unit($info['housUnits']);
                 $propInfo = Bll_Prop::get_ajk_prop_info($info['propId']);
                 $tmp = array('id' => $info['propId'], 'title' => $info['title'], 'commName' => $info['commName'], 'roomNum' => $room, 'hallNum' => $hall, 'toiletNum' => $wc, 'area' => $propInfo['AREANUM'], 'price' => $info['price'] / 10000, 'priceUnit' => '万', 'ImgNum' => $info['propImgNum'], 'isMoreImg' => $propInfo['ISHIGHQULITY']);
                 $props['propertyList'][] = $tmp;
             }
         }
         $ret = array('status' => 'ok', 'data' => $props);
     } else {
         $ret = Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR);
     }
     return $ret;
 }
Exemple #5
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $cityId = $this->_params['cityId'];
     $ownerPropId = $this->_params['ownerPropId'];
     //检测title
     $checkRes = $this->checkTitle($this->_params);
     if (!$checkRes) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_LENGTH_ERROE);
     }
     //构造房源接口数据
     $params = Bll_Prop::gen_prop_info($this->_params);
     if (isset($params['status']) and $params['status'] === 'error') {
         return $params;
     }
     //判断经纪人为ppc经纪人 & 套餐经纪人
     //根据不同类型判断调用不同的java接口
     $api_url = 'sale/properties/add?json';
     //调用房源发布接口
     $result = Util_CallAPI::callJavaInternalApi($api_url, $params, false);
     if ($result['data']['status'] != 'ok') {
         return Util_MobileAPI::error_tmp($result['data']['code'], $result['data']['info']);
     }
     $imageJson = (array) json_decode($this->_params['imageJson']);
     if ($imageJson) {
         $proid = $result['data']['action']['proid'];
         foreach ($imageJson as $img) {
             $api_url = 'image/addImg';
             $img_params['brokerId'] = $brokerId;
             $img_params['propId'] = $proid;
             $img_params['imageJson'] = json_encode($img);
             $img_params['from'] = APF::get_instance()->get_config('java_api_from');
             $img_params["token"] = $this->_params["token"];
             //token
             ksort($img_params);
             $img_params_json = json_encode($img_params);
             $img_return = Util_CallAPI::get_data_from_java_v3($api_url, $img_params_json, false);
             if ($img_return['data']['status'] != 'ok' && !$img_return['data']['id']) {
                 return Util_MobileAPI::error(Bll_Prop::changeJavaAPICodeToSelfCode($img_return['data']['code']));
             }
         }
     }
     $return = array();
     $return["status"] = "ok";
     $return['data']['id'] = $proid = $result['data']['action']['proid'];
     if ($proid && isset($ownerPropId) && !empty($ownerPropId)) {
         //委托房源回写
         $entrustDynamicLog = new V1_Entrust_PropertyDynamicLogController();
         $entrustDynamicLog->addLog($cityId, $ownerPropId, $brokerId, $proid, 2, 2);
     }
     return $return;
 }
 public function handle_request_internal()
 {
     if (!isset($this->_params['cityId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS);
     }
     $api_url = 'conf/publishPropConf?cityId=' . $this->_params['cityId'];
     $result = Util_CallAPI::get_data_from_java_v3($api_url);
     if ($result['data']['status'] !== 'ok') {
         return Util_MobileAPI::error(Bll_Prop::changeJavaAPICodeToSelfCode($result['data']['code']));
     }
     unset($result['data']['status']);
     $return = array();
     $return["status"] = "ok";
     $return['data'] = $result['data'];
     return $return;
 }
Exemple #7
0
 public function handle_request_internal()
 {
     header("Content-type:text/html;charset=utf-8");
     if (mb_strlen($this->_params['title'], 'UTF-8') < 5 || mb_strlen($this->_params['title'], 'UTF-8') > 30) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_LENGTH_ERROE);
     }
     $params = Bll_ZuProp::gen_prop_info($this->_params);
     if (isset($params['status']) and $params['status'] === 'error') {
         return $params;
     }
     //$api_url = '/service-ppc/rest/ppc/properties/add';
     $brokerId = $this->_params['brokerId'];
     $api_url = 'rent/properties/add?json=1';
     $result = Util_CallAPI::callJavaInternalApi($api_url, $params, false);
     if ($result['data']['status'] != 'ok') {
         return Util_MobileAPI::error_tmp($result['data']['code'], $result['data']['info']);
     }
     $imageJson = (array) json_decode($this->_params['imageJson']);
     $proid = $result['data']['id'];
     if (empty($proid)) {
         $proid = $result['data']['action']['proid'];
     }
     if ($imageJson) {
         foreach ($imageJson as $img) {
             $api_url = 'image/addImg';
             $img_params['brokerId'] = $brokerId;
             $img_params['propId'] = $proid;
             //type:1-室内图  2-房型图 3-小区图
             $img_params['imageJson'] = json_encode($img);
             $img_params['from'] = APF::get_instance()->get_config('java_api_from');
             $img_params["token"] = $this->_params["token"];
             //token
             ksort($img_params);
             $img_params_json = json_encode($img_params);
             $img_return = Util_CallAPI::get_data_from_java_v3($api_url, $img_params_json, false);
             if ($img_return['data']['status'] != 'ok' && !$img_return['data']['id']) {
                 return Util_MobileAPI::error(Bll_Prop::changeJavaAPICodeToSelfCode($img_return['data']['code']));
             }
         }
     }
     $return = array();
     $return["status"] = "ok";
     $return['data']['id'] = $proid;
     return $return;
 }
 /**
  * 构造房源数据。
  * @param str $proid_str
  * @param int $brokerId
  * @param array $props
  * @return array
  */
 private function get_prop_info_new($proid_str, $brokerId, $props)
 {
     $effects = Bll_Prop::get_ajk_prop_effect($brokerId, $proid_str);
     $effect_info = array();
     foreach ($effects as $effect) {
         $effect_info[$effect['propId']] = $effect;
     }
     $return = array();
     foreach ($props as $prop) {
         $rooms = $halls = $toilets = $temp_b = 0;
         if ($prop['propInfo']['propModel']) {
             $model = $prop['propInfo']['propModel'];
             $temp_b = 0;
             list($rooms, $temp_a) = explode('室', $model);
             if ($temp_a) {
                 list($halls, $temp_b) = explode('厅', $temp_a);
             }
             if ($temp_b) {
                 list($toilets, $temp_c) = explode('卫', $temp_b);
             }
         }
         $ret = array('id' => $prop['propId'], 'title' => $prop['propInfo']['propTitle'], 'commName' => $prop['propInfo']['commName'], 'roomNum' => $rooms, 'hallNum' => $halls, 'toiletNum' => $toilets, 'area' => $prop['propInfo']['propArea'], 'price' => round($prop['propInfo']['propPrice'] / 10000, 2), 'priceUnit' => '万', 'bidStatus' => $prop['planState']['state'], 'index' => $prop['index'], 'clickNum' => $effect_info[$prop['propId']]['hpClickAmount'], 'offer' => $prop['offer'] / 100, 'budget' => $prop['balance'] / 100, 'yusuan' => $prop['budget'] / 100);
         //增加委托房源标签
         $isEntrust = Bll_Zufang_Choice::isCommissionHouse($prop['propId'], $brokerId);
         if ($prop['propInfo']['commitionType'] == 2) {
             $ret['isEntrust'] = 1;
         } else {
             $ret['isEntrust'] = 0;
         }
         if ($prop['planState']['state'] != 1) {
             $ret['yusuan'] = 20;
         }
         $return[] = $ret;
     }
     return $return;
 }
Exemple #9
0
 public function handle_request_internal()
 {
     if (!isset($this->_params['cityId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS);
     }
     $api_url = 'conf/publishPropConf?cityId=' . $this->_params['cityId'];
     $result = Util_CallAPI::get_data_from_java_v3($api_url);
     unset($result['data']['houseType']['allValue']);
     $tempArr = Model_Community_UseType::getUseTypeByCityId($this->_params['cityId']);
     if (empty($tempArr)) {
         return Util_MobileAPI::error(Const_APIStatus::E_NOT_FOUND_STYLE);
     }
     $styleArr = array();
     foreach ($tempArr as $v) {
         if ($v['typeName'] != '其它') {
             $styleArr[] = array('index' => $v['typeId'], 'value' => $v['typeName']);
         }
     }
     $result['data']['houseType']['allValue'] = $styleArr;
     if ($result['data']['status'] !== 'ok') {
         return Util_MobileAPI::error(Bll_Prop::changeJavaAPICodeToSelfCode($result['data']['code']));
     }
     unset($result['data']['status']);
     $fitments = $result['data']['fitments']['allValue'];
     foreach ($fitments as $k => $v) {
         if (($v['value'] == '其它' || $v['value'] == '其他') && !in_array($this->_params['cityId'], array(11, 30, 31))) {
             unset($result['data']['fitments']['allValue'][$k]);
         }
     }
     // fixbug44041 - 解决
     $result['data']['fitments']['allValue'] = array_values($result['data']['fitments']['allValue']);
     $return = array();
     $return["status"] = "ok";
     $return['data'] = $result['data'];
     return $return;
 }
 /**
  * 构造房源的信息。
  * @param array $props
  * @param array $brokerId
  * @return array
  */
 private function gen_props($props, $brokerId)
 {
     if (empty($props)) {
         return array();
     }
     $ret = array();
     $proids = array();
     foreach ($props as $prop) {
         $proids[$prop['id']] = $prop['id'];
     }
     $proids_str = implode(',', $proids);
     $pro_cost_info = Bll_Prop::get_ajk_prop_effect($brokerId, $proids_str);
     $prop_info = array();
     foreach ($pro_cost_info as $pro_cost) {
         $prop_info[$pro_cost['propId']] = $pro_cost;
     }
     foreach ($props as $prop) {
         $isMoreImg = $prop['isHighQulity'] ? 1 : 0;
         $tmp = array('id' => $prop['id'], 'title' => $prop['title'], 'commId' => $prop['commId'], 'commName' => $prop['commName'], 'roomNum' => $prop['roomNum'], 'hallNum' => $prop['hallNum'], 'toiletNum' => $prop['toiletNum'], 'area' => $prop['area'], 'price' => round($prop['price'] / 10000, 2), 'priceUnit' => '万', 'clickNum' => $prop_info[$prop['id']]['ppcClickAmount'], 'isBid' => $prop_info[$prop['id']]['isHp'] ? '1' : '0', 'isMoreImg' => $isMoreImg);
         $ret[] = $tmp;
     }
     return array_reverse($ret);
 }
 public function handle_request_internal()
 {
     if (!isset($this->_params['propId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_ID_MISS);
     }
     $params['propId'] = $this->_params['propId'];
     $params['token'] = $this->_params['token'];
     $params['brokerId'] = $this->_params['brokerId'];
     $params['from'] = APF::get_instance()->get_config('java_api_from');
     $params['rsl'] = '3';
     //获取二手房信息
     //http://api.anjuke.com/3.0/rest/properties/propInfo?propId=1&brokerId=1&token=a&rsl=7&from=mobile&version=jbeta
     $propInfo = Bll_Prop::get_prop_detail($params);
     /*
     备案编号:fileNo
     小区ID:commId
     小区名字:commName
     小区地址:commAddress
     房间数:roomNum
     厅数:hallNum
     卫生间数:toiletNum
     面积:area
     房源所在的楼层: proFloor
     总楼层: floorNum
     装修:fitment
     朝向:exposure
     标题:title
     描述:description
     */
     if (!empty($propInfo)) {
         $return = array();
         $return["status"] = "ok";
         $community = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($propInfo['data']['baseInfo']['commId'], 2);
         $return["data"]['propInfo']['fileNo'] = $propInfo['data']['baseInfo']['houseCard'];
         $return["data"]['propInfo']['commId'] = $propInfo['data']['baseInfo']['commId'];
         $return["data"]['propInfo']['commName'] = $propInfo['data']['baseInfo']['commName'];
         $return["data"]['propInfo']['commAddress'] = $community['commLocal'];
         $return["data"]['propInfo']['roomNum'] = $propInfo['data']['baseInfo']['roomNum'];
         $return["data"]['propInfo']['hallNum'] = $propInfo['data']['baseInfo']['hallNum'];
         $return["data"]['propInfo']['toiletNum'] = $propInfo['data']['baseInfo']['toiletNum'];
         $return["data"]['propInfo']['area'] = $propInfo['data']['baseInfo']['area'];
         //@todo 此处是个坑,下一版改进
         if ($this->_params['app'] == 'a-broker') {
             $return["data"]['propInfo']['area'] = intval($propInfo['data']['baseInfo']['area']);
         }
         $return["data"]['propInfo']['floor'] = $propInfo['data']['baseInfo']['proFloor'];
         $return["data"]['propInfo']['floorNum'] = $propInfo['data']['baseInfo']['floorNum'];
         $return["data"]['propInfo']['fitment'] = $propInfo['data']['baseInfo']['fitment'];
         $return["data"]['propInfo']['exposure'] = $propInfo['data']['baseInfo']['houseOri'];
         $return["data"]['propInfo']['title'] = $propInfo['data']['baseInfo']['title'];
         $return["data"]['propInfo']['description'] = $propInfo['data']['baseInfo']['desc'];
         $return["data"]['propInfo']['price'] = $propInfo['data']['baseInfo']['price'];
         $return["data"]['propInfo']['houseAge'] = $propInfo['data']['baseInfo']['houseAge'];
         $return["data"]['propInfo']['style'] = $propInfo['data']['baseInfo']['style'];
         $return["data"]['propInfo']['tradeType'] = $propInfo['data']['baseInfo']['tradeType'];
         $return["data"]['propInfo']['roomImg'] = $propInfo['data']['roomImg'] ? $propInfo['data']['roomImg'] : array();
         $return["data"]['propInfo']['commImg'] = $propInfo['data']['commImg'] ? $propInfo['data']['commImg'] : array();
         $return["data"]['propInfo']['moduleImg'] = $propInfo['data']['moduleImg'] ? $propInfo['data']['moduleImg'] : array();
         $return["data"]['propInfo']['minDownPay'] = $propInfo['data']['baseInfo']['minDownPay'];
         $return["data"]['propInfo']['isFullFive'] = $propInfo['data']['baseInfo']['isFullFive'];
         $return["data"]['propInfo']['isOnly'] = $propInfo['data']['baseInfo']['isOnly'];
         if ($propInfo['data']['baseInfo']['commitionType'] == 2) {
             $return["data"]['propInfo']['isEntrust'] = 1;
         } else {
             $return["data"]['propInfo']['isEntrust'] = 0;
         }
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return $return;
 }