Exemplo n.º 1
0
 /**
  * 构造房源数据。
  * @param array $info
  * @return array
  */
 public static function gen_prop_info($info)
 {
     $need_fileno_city_arr = APF::get_instance()->get_config('need_fileno_city', 'mobile_api');
     if (!isset($info["brokerId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS);
     }
     if (!isset($info["cityId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS);
     }
     /*
             if (in_array($info["cityId"], $need_fileno_city_arr)) {//北京必选档案号
                 if ($info["fileNo"]) {
                     $params["fileNo"] = $info["fileNo"];
                 } else {
                     return Util_MobileAPI::error(Const_APIStatus::E_PROP_PUBLISH_FILENO_MISS);
                 }
             }*/
     $params["fileNo"] = $info["fileNo"];
     $params["brokerId"] = $info["brokerId"];
     //经纪人ID
     $params["broker_id"] = $info["brokerId"];
     //经纪人ID
     $params["comm_id"] = $info["commId"];
     //小区ID
     $params["rooms"] = $info["rooms"];
     //户型(选择)
     $params["area"] = $info["area"];
     //产证面积(输入)
     $params["price"] = $info["price"];
     //价格(输入)
     $params["fitment"] = $info["fitment"];
     //装修(默认+选择)
     $params["exposure"] = $info["exposure"];
     //朝向(默认+选择)
     $params["floor"] = $info["floor"];
     //楼层(选择)
     $params["title"] = $info["title"];
     //房源标题(输入)
     $params["description"] = $info["description"];
     //房源描述(输入)
     $params["trade_type"] = 2;
     //交易类型-租房
     $params["rentType"] = $info["shareRent"];
     //租房类型(1.整租  2.合租)
     $params["shareSex"] = $info["shareSex"] ? $info["shareSex"] : 0;
     //0男女不限   1限男生  2限女生
     $params["shareType"] = $info["shareType"] ? $info["shareType"] : 1;
     //合租类型1单间 2隔断间 3床位
     $params["rent_deposit_and_cycle"] = $info["rentDeposit"] ? $info["rentDeposit"] : '0|0';
     //付款方式。仅对出租房(trade_type==2)。目前仅支持押几付几的形式,例如'3|1'表示押金为一个月的price,一次付款3个月price。(0|0)面议、(3|1)付3押1、(1|1)付1押1、(2|1)付2押1、(1|2)付1押2、(12|0)年付不押、(6|0)半年付不押、(12|1)年付押1、(6|1)半年付押1 ,其中年付押1、半年付押1只适用于大连、西安、成都经纪人
     $params["equipment"] = $info["equipment"] ? $info["equipment"] : 0;
     //房屋配置 值域范围正整数【0-1023】。一个由1(无)/0(有)组成长度为10位的的字符串,eg:1011001101【整型值:717】,从左->右:分别表示:是否有床、是否有电视、是否有空调、是否有冰箱、 是否有洗衣机、 是否有热水器、是否有宽带、是否可做饭、是否有独立卫生间、是否有阳台.扩展从高位前添加。
     $params['from'] = APF::get_instance()->get_config('java_api_from');
     $params["token"] = $info["token"];
     //token
     $params["style"] = Bll_House_HzPublish::buildHouseType($info["style"] ? $info["style"] : 1);
     //房屋类型 (//1公寓;2老公房;3新里洋房;4别墅;5其它 ;6洒店公寓;7四合院; 8普通住宅)
     // 房屋类型(读取) 读取所选择小区的“物业类型”
     // 建造年代(读取) 读取所选择小区的“竣工时间”
     $api_url = '/service-ppc/rest/cache/commInfo?commuId=' . $params["comm_id"] . '&rsl=111';
     $comminfo = Util_CallAPI::get_data_from_java_api($api_url);
     if ($comminfo['data']['status'] == 'ok') {
         $usetype = Dao_Broker_AjkProp::get_prop_usetype($info["cityId"], intval($comminfo['data']['commBaseInfo']['USETYPE']));
         $usetype_name_id = array('公寓' => 1, '别墅' => 4, '新里洋房' => 3, '其它' => 5, '老公房' => 2, '普通住宅' => 8, '四合院' => 7, '酒店公寓' => 6);
         $change_style = array(1 => 1, 4 => 2, 3 => 3, 5 => 4, 2 => 5, 6 => 6, 7 => 7, 8 => 8);
         $usetype_id = $change_style[$usetype_name_id[$usetype['TYPENAME']]];
         //$params["style"] = $usetype_id ? $usetype_id : intval($params["style"]); //物业类型
         if (2 == $params["style"]) {
             $pos = strpos($params["floor"], ',');
             $params["floor"] = '0' . substr($params["floor"], $pos);
         }
         $params["year"] = $comminfo['data']['commExtInfo']['SENDDATE'] ? date("Y", strtotime($comminfo['data']['commExtInfo']['SENDDATE'])) : date("Y");
         //竣工日期
         if ($params["year"] > date('Y')) {
             $params["year"] = date('Y');
         }
         //删除该经纪人房源缓存
         $key = self::MEMCACHE_KEY_ZUFANG_CHAT_GETCOMMPROPS . '_' . $info["brokerId"] . '_' . $info["commId"] . '_' . date("Ymd");
         $memcache = APF_Cache_Factory::get_instance()->get_memcache();
         $result = $memcache->delete($key);
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR);
     }
     //$params["style"]        = $params["style"] ? $params["style"] : 1;//房屋类型 (//1公寓;2老公房;3新里洋房;4别墅;5其它 ;6洒店公寓;7四合院; 8普通住宅)
     return $params;
 }
Exemplo n.º 2
0
 /**
  * 页面参数post提交
  */
 public function handlePost()
 {
     $params = $this->requestObj->get_parameters();
     $params['ajkBrokerId'] = $this->ctx['ajkBrokerId'];
     $params['cityId'] = $this->ctx['cityId'];
     $propPostData = Bll_House_HzPublish::buildPropPostData($params);
     if (!$propPostData['status']) {
         $this->redirect2Result(Const_PublishCode::UNKNOWN_ERROR, $this->site, $this->action, $this->ctx['proId']);
     } else {
         $propPostData = $propPostData['msg'];
     }
     if ($this->ctx['isEdit']) {
         // 更新
         $propPostData['proid'] = $this->ctx['proId'];
         $result = Bll_House_HzHouse::updateHouse($propPostData);
         // 注入调试信息
         if ($this->ctx['debug'] && $this->ctx['debug'] == 'prop') {
             echo '房源更新' . PHP_EOL;
             echo 'post参数' . PHP_EOL;
             print_r($propPostData);
             echo 'api结果' . PHP_EOL;
             print_r($result);
             die;
         }
         if (!$result['status']) {
             $this->redirect2Result(Const_PublishCode::API_ERROR, $this->site, $this->action, $this->ctx['proId'], $result['msg']);
         }
     } else {
         // 发房
         $result = Bll_House_HzHouse::addHouse($propPostData);
         // 注入调试信息
         if ($this->ctx['debug'] && $this->ctx['debug'] == 'prop') {
             echo '房源发布' . PHP_EOL;
             echo 'post参数' . PHP_EOL;
             print_r($propPostData);
             echo 'api结果' . PHP_EOL;
             print_r($result);
             die;
         }
         if (!$result['status']) {
             $this->redirect2Result(Const_PublishCode::API_ERROR, $this->site, $this->action, $this->ctx['proId'], $result['msg']);
         } else {
             $this->ctx['proId'] = $result['msg']['proid'];
         }
     }
     // 图片数据预处理
     $postApiImages = Bll_House_HzPublish::buildPostImagesForApi($params, $this->ctx['images']);
     // 兼容图片全部删除的问题
     if ($postApiImages) {
         // 图片请求api
         $addImageResult = Bll_Image_HzHouseImage::addImage($this->ctx['ajkBrokerId'], $this->ctx['proId'], $postApiImages);
         // 注入调试信息
         if ($this->ctx['debug'] && $this->ctx['debug'] == 'image') {
             echo '图片请求' . PHP_EOL;
             echo 'post参数' . PHP_EOL;
             print_r($postApiImages);
             echo 'api结果' . PHP_EOL;
             print_r($addImageResult);
             die;
         }
         if (!$addImageResult['status']) {
             $this->redirect2Result(Const_PublishCode::HOUSE_SAVE_SUCCESS, $this->site, $this->action, $this->ctx['proId'], $addImageResult['msg']);
         }
     }
     $this->ctx['html_action'] = $params['html_action'];
     return true;
 }
Exemplo n.º 3
0
 /**
  * 获取发房页是否可以推广信息
  * @param $ctx
  */
 public static function getSpreadFlagInfo($ctx)
 {
     if ($ctx['isFixCity']) {
         $spreadProIds = Bll_House_HzPublish::getSpreadProIds($ctx);
         $ctx['isCanSpread'] = count($spreadProIds) < $ctx['brokerLimitInfo']['promotionLimit'] && !in_array($ctx['proId'], $spreadProIds);
         $ctx['spreadTip'] = $ctx['isCanSpread'] ? '可以推广' : '推广房源已满,只能保存到未推广房源';
         if (in_array($ctx['proId'], $spreadProIds)) {
             $ctx['spreadTip'] = '';
         }
     } else {
         $spreadProIds = array();
         $spreadInfos = Bll_Combo_HouseRelation::getHouseRelations($ctx['ajkBrokerId'], Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
         if ($spreadInfos) {
             foreach ($spreadInfos as $spreadInfo) {
                 $spreadProIds[] = $spreadInfo['houseId'];
             }
         }
         $comboResult = Bll_Combo_HouseRelation::housePublishComboCheck($ctx['ajkBrokerId'], $ctx['cityId'], Bll_Combo_HouseRelation::SITE_TYPE_HZ);
         $ctx['isCanSpread'] = $comboResult['status'] > 0 && !in_array($ctx['proId'], $spreadProIds);
         $ctx['spreadTip'] = $ctx['isCanSpread'] ? '可以推广' : in_array($ctx['proId'], $spreadProIds) ? '' : $comboResult['msg'];
     }
     return $ctx;
 }