Ejemplo n.º 1
0
 public function handle_request_internal()
 {
     $cityId = $this->_params['cityId'];
     $companyId = $this->_params['companyId'];
     $keyword = $this->_params['keyword'];
     $store_name = trim($keyword);
     $store_name = str_replace('%', '', $store_name);
     $store_name = str_replace('_', '', $store_name);
     $rs = Model_Broker_AjkCstBrokerCompany::getStoreListByKeyword($companyId, $cityId, "%{$store_name}%");
     if ($rs) {
         $areaCodes = $blockCodes = array();
         foreach ($rs as $val) {
             $areaCodes[] = substr($val['areaCode'], 0, 8);
             $blockCodes[] = $val['areaCode'];
         }
         // 获取信息
         $tmpAreaData = Bll_Commtype_Api::getBatchInfoByTypeIdOrCode('', $areaCodes);
         $tmpBlockData = Bll_Commtype_Api::getBatchInfoByTypeIdOrCode('', $blockCodes);
         $areaData = $blockData = array();
         foreach ($tmpAreaData as $val) {
             $areaData[$val['typeCode']] = $val;
         }
         foreach ($tmpBlockData as $val) {
             $blockData[$val['typeCode']] = $val;
         }
     }
     foreach ($rs as $value) {
         $tmpAreaCode = substr($value['areaCode'], 0, 8);
         $tmpBlockCode = $value['areaCode'];
         $return['storeList'][] = array('storeId' => $value['comanyId'], 'storeName' => $value['comanyName'], 'districtId' => $areaData[$tmpAreaCode] ? $areaData[$tmpAreaCode]['typeId'] : '', 'districtName' => $areaData[$tmpAreaCode] ? $areaData[$tmpAreaCode]['typeName'] : '', 'blockId' => $blockData[$tmpBlockCode] ? $blockData[$tmpBlockCode]['typeId'] : '', 'blockName' => $blockData[$tmpBlockCode] ? $blockData[$tmpBlockCode]['typeName'] : '');
     }
     $return['storeList'][] = array('storeId' => 0, 'storeName' => '其他门店', 'districtId' => '', 'districtName' => '', 'blockId' => '', 'blockName' => '');
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $return);
 }
Ejemplo n.º 2
0
 public function handle_request_internal()
 {
     $params = APF::get_instance()->get_request()->get_parameters();
     if ($params['cityid'] && isset($params['act']) && $params['act'] == "area") {
         //            $areaInfoByCityId = Model_City_TypeCode::getAreaInfoByCityId(intval($params['cityid']));
         //            $resultInfo = Model_City_TypeCode::getArrayAreaInfoByParentId($areaInfoByCityId->typeId);
         $areaInfoByCityId = Bll_Commtype_Api::getCityAreaByCityId(intval($params['cityid']));
         $resultInfo = Bll_Commtype_Api::getAreaByTypeId($areaInfoByCityId['typeId']);
     }
     if ($params['typeid'] && isset($params['act']) && $params['act'] == "block") {
         //            $resultInfo = Model_City_TypeCode::getArrayAreaInfoByParentId(intval($params['typeid']));
         $resultInfo = Bll_Commtype_Api::getBlockByTypeId($params['typeid']);
     }
     if ($params['key'] && $params['cityid'] && isset($params['act']) && $params['act'] == "company") {
         $resultInfo = Dao_Broker_CompanyAndStore::get_company_list($params['cityid'], $params['key']);
     }
     if ($params['companyid'] && $params['key'] && $params['cityid'] && isset($params['act']) && $params['act'] == "store") {
         $resultInfo = Dao_Broker_CompanyAndStore::get_store_list($params['cityid'], $params['companyid'], $params['key']);
     }
     //返回store数据时,同时返回该store所在的区域和板块
     if ($params['companyid'] && $params['key'] && $params['cityid'] && isset($params['act']) && $params['act'] == "store_area") {
         $resultInfo = Dao_Broker_CompanyAndStore::get_store_area_block_list($params['cityid'], $params['companyid'], $params['key']);
     }
     echo json_encode($resultInfo);
     die;
 }
Ejemplo n.º 3
0
 public function handle_request_internal()
 {
     $request = APF::get_instance()->get_request();
     $broker = self::$BrokerInfo;
     $brokerIdentity = Bll_BrokerBaseBll::get_instance()->get_broker_identity_info_v2($broker['BaseInfo']['brokerId']);
     if (empty($broker['BaseInfo']) || empty($brokerIdentity)) {
         apf_require_class("Uri_Http");
         //Uri_Http::redirect_header("/user/broker/new/brokerinfo/");
         Uri_Http::redirect_header("/ajkbroker/broker/modify/brokerinfo/");
     }
     $broker['UsrCardState'] = $brokerIdentity['IdentityInfo']['usrCardState'];
     $broker['UsrPhotoTmpState'] = $brokerIdentity['IdentityInfo']['userPhotoTmpState'];
     $broker['UsrPhotoState'] = $brokerIdentity['IdentityInfo']['userPhotoState'];
     $broker['BnsCardState'] = $brokerIdentity['IdentityInfo']['bnsCardState'];
     $broker['CheckState'] = $brokerIdentity['IdentityInfo']['checkState'];
     //        $area = $this->getBlockName(substr($broker['BaseInfo']['areaCode'], 4, 4));
     //        $block = $this->getBlockName(substr($broker['BaseInfo']['areaCode'], 8, 4));
     $area = Bll_Commtype_Api::getInfoByTypeCodeV2(substr($broker['BaseInfo']['areaCode'], 0, 8));
     $block = Bll_Commtype_Api::getInfoByTypeCodeV2($broker['BaseInfo']['areaCode']);
     $broker['CityName'] = $this->getCityName($broker['BaseInfo']['cityId']);
     $broker['AreaName'] = $area['typeName'];
     $broker['BlockName'] = $block['typeName'];
     //获得最后提交资料
     $lastupdata = Bll_BrokerBaseBll::get_instance()->getLastPostFile($broker['BaseInfo']['brokerId']);
     $brokerCheckInfoBll = new Bll_Broker_BrokerCheckInfo();
     //获取经纪人最近一次头像或名片审核不通过的原因记录
     if ($broker['UsrPhotoState'] == 2) {
         $brokerTheLastCheck = $brokerCheckInfoBll->getBrokerTheLastCheckInfo($broker['BaseInfo']['brokerId'], 1);
         $faceLastCheckInfo = $brokerTheLastCheck['content'];
     } else {
         $faceLastCheckInfo = $brokerCheckInfoBll->getNoPassExp($broker['BaseInfo']['brokerId'], 1);
         //1图像
     }
     $brokerTheLastCheckInfo = $brokerCheckInfoBll->getBrokerTheLastCheckInfo($broker['BaseInfo']['brokerId'], 2);
     //名片
     $mingpianLastCheckInfo = $brokerCheckInfoBll->getNoPassExp($broker['BaseInfo']['brokerId'], 3);
     //名片
     $idCardLastCheckInfo = $brokerCheckInfoBll->getNoPassExp($broker['BrokerId'], 2);
     //电话锁定状态
     $phoneLockInfo = $brokerCheckInfoBll->getLockStatus($broker['BaseInfo']['brokerId']);
     if ($phoneLockInfo['company_id'] == $broker['BaseInfo']['companyId'] && $phoneLockInfo['status'] == 1) {
         $phoneLockStatus = 1;
     } else {
         $phoneLockStatus = 0;
     }
     $request->set_attribute('broker', $broker);
     $request->set_attribute('lastupdata', $lastupdata);
     $request->set_attribute('faceLastCheckInfo', $faceLastCheckInfo);
     $request->set_attribute('mingpianLastCheckInfo', $mingpianLastCheckInfo);
     $request->set_attribute('phoneLockStatus', $phoneLockStatus);
     $request->set_attribute('idCardLastCheckInfo', $idCardLastCheckInfo);
     $request->set_attribute('brokerTheLastCheckInfo', $brokerTheLastCheckInfo);
     return 'Broker_BrokerInfo';
 }
Ejemplo n.º 4
0
 public function handle_request_internal()
 {
     $districtId = $this->_params['districtId'];
     $areaInfosByParentId = Bll_Commtype_Api::getBlockInfoByParentId($districtId);
     //$areaInfosByParentId = Model_City_TypeCode::getAreaInfoByParentId($districtId);
     $return = array();
     foreach ($areaInfosByParentId as $value) {
         $return['blockList'][] = array('blockId' => $value['typeId'], 'blockName' => $value['typeName']);
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $return);
 }
Ejemplo n.º 5
0
 public function handle_request_internal()
 {
     $this->params = APF::get_instance()->get_request()->get_parameters();
     //        $allblock = Model_City_TypeCode::getArrayAreaInfoByParentIdEx($this->params['areaid']);
     $allblock = Bll_Commtype_Api::getBlockByTypeId($this->params['areaid']);
     $temp = array();
     foreach ($allblock as $k => $v) {
         $temp[$k]['id'] = $v['typeId'];
         $temp[$k]['name'] = $v['typeName'];
     }
     echo json_encode($temp);
     exit;
 }
Ejemplo n.º 6
0
 public function handle_request_internal()
 {
     $mobile = $this->_params['mobile'];
     $password = $this->_params['password'];
     $checkPassword = $this->_params['checkPassword'];
     $truename = $this->_params['truename'];
     $cityId = $this->_params['cityId'];
     $mainBusiness = $this->_params['mainBusiness'];
     $companyId = $this->_params['companyId'];
     $storeId = $this->_params['storeId'];
     $blockId = $this->_params['blockId'];
     $ip = $this->_params['ip'];
     $is_rand_mobile = $this->_params['is_rand_mobile'];
     //验证数据
     $checkReturn = $this->checkData($password, $checkPassword, $cityId, $mainBusiness);
     if ($checkReturn !== true) {
         return $checkReturn;
     }
     //调试用的代码
     if ($is_rand_mobile == 1) {
         $mobile = substr(time(), 1, 7) . rand(1000, 9999);
     }
     #$areaInfo = Model_City_TypeCode::getAreaInfoByTypeId($blockId, $cityId);
     $areaInfo = Bll_Commtype_Api::getInfoByTypeIdAndCityId($blockId, $cityId);
     $post_data = array("j_password" => $password, "trueName" => $truename, "cityId" => $cityId, "areaCode" => $areaInfo['typeCode'], "companyId" => $companyId, "storeId" => $storeId, "userMobile" => $mobile, "channel" => 138, "regip" => $ip, "isPPC" => Bll_City::isFixCity($cityId) ? 'true' : 'false', "mainBussiness" => $mainBusiness);
     //打注册接口
     $res = $this->register($post_data);
     if ($res['status'] == 'ok') {
         //设置主营业务
         $mainBusinessId = $this->setMainBusiness($res['broker']['userId'], $res['broker']['brokerId'], $mainBusiness);
         if (!$mainBusinessId) {
             return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_SYS_ERR, 'message' => V1_RegisterController::MAIN_BUSINESS_FAIL);
         }
         //写主营业务log
         $mainBusinessLogId = $this->setMainBusinessLog($res['broker']['userId'], $res['broker']['brokerId'], $mainBusiness);
         if (!$mainBusinessLogId) {
             return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_SYS_ERR, 'message' => V1_RegisterController::MAIN_BUSINESS_LOG_FAIL);
         }
         //获取token
         $token = $this->createBrokerToken($res['broker']['brokerId'], $res['broker']['userName']);
         $sid = APF::get_instance()->get_config("sid", "login");
         //单点登录
         $registerBll = new Bll_Register();
         $registerBll->singleSignon($mobile, $password, $sid);
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('brokerId' => $res['broker']['brokerId'], 'userId' => $res['broker']['userId'], 'userName' => $res['broker']['userName'], 'cityId' => $res['broker']['cityId'], 'mobile' => $res['broker']['userMobile'], 'trueName' => $res['broker']['trueName'], 'token' => $token));
     } else {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_JAVA_API_ERROR, 'message' => empty($res['info']) ? '请求超时' : $res['info']);
     }
 }
Ejemplo n.º 7
0
 public function handle_request_internal()
 {
     $cityId = $this->_params['cityId'];
     //$areaInfoBycityId = Model_City_TypeCode::getAreaInfoByCityId($cityId);
     $areaInfoBycityId = Bll_Commtype_Api::getAreaInfoByCityId($cityId);
     //$areaInfosByParentId = Model_City_TypeCode::getAreaInfoByParentId($areaInfoBycityId['typeId']);
     $areaInfosByParentId = Bll_Commtype_Api::getAreaInfoByParentId($areaInfoBycityId['typeId']);
     $return = array();
     foreach ($areaInfosByParentId as $value) {
         //判断区域下面有没有板块,如果没有板块,则不现实该区域
         $blockInfos = Model_City_TypeCode::getAreaInfoByParentId($value['typeId']);
         $blockCount = count($blockInfos);
         if ($blockCount > 0) {
             $return['districtList'][] = array('districtId' => $value['typeId'], 'districtName' => $value['typeName']);
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $return);
 }
Ejemplo n.º 8
0
 public function handle_request_internal()
 {
     //$a = Bll_Commtype_Api::getInstance()->search(1,200);
     //    $a = Bll_Commtype_Api::getInfoByTypeIdOrCode(array(200,201),0,2);
     ///print_r($a);exit;
     $a = Bll_Commtype_Api::getAreaInfoByCityId(11);
     print_r($a);
     $tmp = Model_City_TypeCode::get_area_block(200);
     echo $tmp->typeName;
     phpinfo();
     die;
     $hzbrokerId = 147468;
     $r = Bll_Hammer::send_gift($hzbrokerId);
     echo "<pre>";
     var_dump($r);
     die;
     $ret = array('status' => 'ok', 'data' => array('num1' => 10000, 'num2' => 20000));
     $this->output($ret);
     die;
 }
Ejemplo n.º 9
0
 /**
  * 二手房-精选房源管理页面
  *返回值 为页面参数,所以必须是数组
  *
  * @param int $broker_id
  * @param int $city_id
  * @param array $extraData $request->get_parameters();
  * @return array
  */
 public static function esf_init_manage($brokerId, $cityId, $extraData = array())
 {
     $attr = array();
     //$attr['bidChoiceIsFull'] = self::checkEsfBidChoiceFull($brokerId,$cityId);
     $houseId = $attr = array();
     //获取经纪人竞价计划
     self::setEsfBrokerAllPlanInfo($brokerId, $cityId);
     $attr['planInfos'] = self::$esfBrokerAllPlanInfo[$brokerId];
     if (empty($attr['planInfos'])) {
         return array();
     }
     $onQueueNumArray = array();
     foreach ($attr['planInfos'] as $key => $value) {
         //转换key
         unset($attr['planInfos'][$key]);
         //剔除非精选推广计划
         if ($value->bidVersion != Model_Plan_EsfAjkPropSpread::CHOICEVERSION) {
             continue;
         }
         $attr['planInfos'][$value->propId] = $value;
         $houseId[] = $value->propId;
         if ($value->model == Model_Plan_EsfAjkPropSpread::BLOCK_CHOICE) {
             $attr['planInfoUrl'][$value->propId]['urlChoice'] = "/ajkbroker/user/ajax/blockchoice";
         } else {
             $attr['planInfoUrl'][$value->propId]['urlChoice'] = "/ajkbroker/user/ajax/choice";
         }
         if ($value->status == Model_Plan_EsfAjkPropSpread::ONQUEUE) {
             //计算排名
             //$onQueueNumArray[$value->id] = sprintf("当前排第%d位",self::getEsfOnQueueNum($value->id,$value->commId,$value->smallprice,$value->bigprice));
             if ($value->model == Model_Plan_EsfAjkPropSpread::BLOCK_CHOICE) {
                 //板块精选
                 $onQueueNumArray[$value->id] = Bll_Plan_Bid_BlockChoice::getEsfOnQueueNum($value->id, $value->areacode, $value->smallprice, $value->bigprice);
             } else {
                 //小区精选
                 $onQueueNumArray[$value->id] = self::getEsfOnQueueNum($value->id, $value->commId, $value->smallprice, $value->bigprice);
             }
         }
     }
     //排队中名词列表
     $attr['onQueueNumArray'] = $onQueueNumArray;
     //判断计划是否已满
     $attr['bidChoiceIsFull'] = self::checkEsfBidChoiceFull($brokerId, $cityId);
     //获取房源信息
     //$houseId = array('168783719','168783720');
     $onLinceHouseInfo = $onQueueHouseInfo = $historyHouseInfo = array();
     $allHouseInfo = Bll_House_EsfHouse::getHouseBaseInfo($houseId, $cityId);
     foreach ($allHouseInfo as $row) {
         $block = Bll_Commtype_Api::getInfoByTypeCode($attr['planInfos'][$row->proId]->areacode);
         $area = Bll_Commtype_Api::getInfoByTypeId($block['parentId']);
         $attr['AreaBlock'][$row->proId]['areaName'] = $area['typeName'];
         $attr['AreaBlock'][$row->proId]['blockName'] = $block['typeName'];
         if ($attr['planInfos'][$row->proId]->status == Model_Plan_EsfAjkPropSpread::ONLINE) {
             $onLinceHouseInfo[] = $row;
         } elseif ($attr['planInfos'][$row->proId]->status == Model_Plan_EsfAjkPropSpread::ONQUEUE) {
             $onQueueHouseInfo[] = $row;
         } else {
             $historyHouseInfo[] = $row;
         }
     }
     $attr['housesInfo'] = array_merge($onLinceHouseInfo, $onQueueHouseInfo, $historyHouseInfo);
     //获取房源所在城市拼音
     $attr['citySet'] = APF::get_instance()->get_config("city_set", "multicity");
     $attr['baseDomain'] = APF::get_instance()->get_config("base_domain");
     return $attr;
 }
Ejemplo n.º 10
0
 public function getAreaList($cityId, $areaCode)
 {
     $sel = '';
     //        $areaListTmp = Model_City_TypeCode::getAreaInfoByCityIdEx($cityId);
     $areaInfoByCityId = Bll_Commtype_Api::getCityAreaByCityId(intval($cityId));
     $areaListTmp = Bll_Commtype_Api::getAreaByTypeId($areaInfoByCityId['typeId']);
     foreach ($areaListTmp as $arealist) {
         if ($arealist['typeCode'] == $areaCode) {
             continue;
         } else {
             $sel .= "<option value=\"" . $arealist['typeId'] . "\">" . $arealist['typeName'] . "</option>";
         }
     }
     return $sel;
 }
Ejemplo n.º 11
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;
 }
Ejemplo n.º 12
0
 public function handle_request_internal()
 {
     if (Bll_Weshop::weshopPropsIsMaintain()) {
         return array('status' => 'error', 'message' => "系统维护中,请稍后再试!");
     }
     header("Access-Control-Allow-Origin: *");
     //获取房源 获取房源图片
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     //获取房源信息
     $propId = $this->_params['propId'];
     $propInfo = Model_Weshop_Props::getWeshopProp($propId);
     if (empty($propInfo)) {
         throw new Exception_Property_NotFound(Const_APIStatus::E_PROP_INFO_FAILED);
     }
     //小区信息
     $commInfo = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($propInfo->commId, 2);
     $city_set = APF::get_instance()->get_config("city_set", "multicity");
     $cityPinYin = $city_set[$brokerInfo->cityId]['pinyin'];
     $row = array();
     $row['propId'] = $propId;
     $row['floor'] = $propInfo->floor;
     $row['totalFloor'] = $propInfo->totalFloor;
     $row['commId'] = $propInfo->commId;
     $row['commName'] = $commInfo['commName'];
     $row['commLocation'] = $commInfo['commLocal'];
     $row['sosolat'] = $commInfo['sosolat'];
     //纬度
     $row['sosolng'] = $commInfo['sosolng'];
     //经度
     //$areaId = substr($commInfo['areaCode'], 0, 8);
     //$areaInfo = Model_City_TypeCode::getTypeName($areaId);
     //$row['areaName'] = $areaInfo->typeName;
     $blockId = $commInfo['areaCode'];
     $blockInfo = Bll_Commtype_Api::getInfoByTypeCode($blockId);
     $areaInfo = Bll_Commtype_Api::getInfoByTypeId($blockInfo['parentId']);
     $row['areaName'] = $areaInfo['typeName'];
     $row['blockName'] = $blockInfo['typeName'];
     $row['room'] = $propInfo->room;
     $row['hall'] = $propInfo->hall;
     $row['toilet'] = $propInfo->toilet;
     $row['area'] = $propInfo->acreage;
     $row['areaUnit'] = '平米';
     $row['price'] = intval($propInfo->price);
     $row['priceUnit'] = '万';
     $isJson = Util_String::isJson($propInfo->description);
     $row['propDescription'] = $isJson ? json_decode($propInfo->description) : $propInfo->description;
     $row['title'] = $propInfo->title ? $propInfo->title : $row['commName'] . ' ' . $row['room'] . '室' . $row['hall'] . '厅' . ' ' . $row['area'] . '平' . ' ' . $row['price'] . '万';
     $row['cityPinYin'] = $cityPinYin;
     //从数据库取房源特色id
     $tagIds = $propInfo->tagIds;
     $tagIds = explode(',', $tagIds);
     $allTags = APF::get_instance()->get_config('weshop_tags');
     $propTags = array();
     foreach ($tagIds as $tagId) {
         $tagId = trim($tagId);
         if ($tagId) {
             $tag = array();
             $tag['tagId'] = $tagId;
             $tag['tagName'] = $allTags[$tagId];
             $propTags[] = $tag;
         }
     }
     $row['tags'] = $propTags;
     //获取房源图片
     $propImages = Model_Weshop_PropImages::getWeshopPropImages($propId);
     $row['propImages'] = $row['outdoorImage'] = array();
     foreach ($propImages as $propImage) {
         $image = array();
         $image['host'] = $propImage->imageHostId;
         $image['hash'] = $propImage->imageHash;
         $url = Util_ImageUtils::getResizeURL($propImage->imageHash, $propImage->imageHostId, 290, 240);
         $url = str_replace("display", "display/e", $url);
         //无水印格式
         $url = str_replace("240", "240c", $url);
         //图片url 加c
         $image['smallImageUrl'] = $url;
         $url = Util_ImageUtils::getResizeURL($propImage->imageHash, $propImage->imageHostId, 600, 600);
         $url = str_replace("display", "display/e", $url);
         //无水印格式
         $image['bigImageUrl'] = $url;
         //区分户型图和室内图
         if ($propImage->imageType == 1) {
             $row['propImages'][] = $image;
         } elseif ($propImage->imageType == 2) {
             $row['outdoorImage'][] = $image;
         }
     }
     $row['cityId'] = $brokerInfo->cityId;
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $row);
 }
Ejemplo n.º 13
0
 public function getCommTypeInfo($typeCode)
 {
     // $commTypeInfos = Model_City_TypeCode::getTypeName($typeCode);
     $commTypeInfos = Bll_Commtype_Api::getBatchInfoByTypeIdOrCode("", $typeCode);
     $keyCommTypeInfo = array();
     foreach ($commTypeInfos as $commTypeInfo) {
         $keyCommTypeInfo[$commTypeInfo['typeCode']] = $commTypeInfo['typeName'];
     }
     return $keyCommTypeInfo;
 }
Ejemplo n.º 14
0
 public function handle_request_internal()
 {
     if (Bll_Weshop::weshopPropsIsMaintain()) {
         return array('status' => 'error', 'message' => "系统维护中,请稍后再试!");
     }
     //存储房源  存储图片
     $brokerId = $this->_params['brokerId'];
     $data = $this->_params;
     //header('Content-Type: application/json; charset=utf-8');
     $images = json_decode($data['imageJson'], true);
     if (count($images) > 8) {
         throw new Exception_Prop_PropImageBeyondLimit();
     }
     if (mb_strlen($data['propDescription'], 'utf-8') > 500) {
         throw new Exception_Prop_PropDescriptionBeyondLimit();
     }
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $tagIds = explode(',', $data['tagIds']);
     if (count($tagIds) > 4) {
         throw new Exception_Prop_PropTagsBeyondLimit();
     }
     $tmpBrokerIds = array(1471136);
     // ios5.2 加急审核
     if ($data['tagIds'] == 2 && $data['cv'] == 5.2 && in_array($data['brokerId'], $tmpBrokerIds)) {
         return array();
     }
     //小区信息
     $commInfo = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($data['commId']);
     if (empty($commInfo)) {
         throw new Exception_Property_CommNotFound(Const_APIStatus::E_COMM_NOT_EXISTS);
     }
     $propInfo = array();
     $propInfo['cityId'] = $brokerInfo->cityId;
     $propInfo['commId'] = $data['commId'];
     $propInfo['brokerId'] = $brokerId;
     $propInfo['areaId'] = substr($commInfo['areaCode'], 0, 8);
     $propInfo['blockId'] = $commInfo['areaCode'];
     $propInfo['price'] = $data['price'] > 0 ? $data['price'] : 0;
     $propInfo['acreage'] = $data['area'];
     $propInfo['room'] = $data['room'];
     $propInfo['hall'] = $data['hall'];
     $propInfo['toilet'] = $data['toilet'];
     $propInfo['description'] = json_encode($data['propDescription']);
     if (!empty($data['title'])) {
         $propInfo['title'] = trim($data['title']);
     }
     if (!empty($data['floor'])) {
         $propInfo['floor'] = intval($data['floor']);
     }
     if (!empty($data['totalFloor'])) {
         $propInfo['totalFloor'] = intval($data['totalFloor']);
     }
     $propInfo['tagIds'] = $data['tagIds'];
     //特色
     $propInfo['status'] = 1;
     $propInfo['createTime'] = date('Y-m-d H:i:s', time());
     $propInfo['updateTime'] = date('Y-m-d H:i:s', time());
     //存储房源
     $result = Model_Weshop_Props::insertWeshopProps($propInfo);
     $propId = $result->id;
     //$areaInfo = Model_City_TypeCode::getTypeName($propInfo['areaId']);
     //$areaName = $areaInfo->typeName;
     //$blockInfo = Model_City_TypeCode::getTypeName($propInfo['blockId']);
     //$blockName = $blockInfo->typeName;
     $areaInfo = Bll_Commtype_Api::getInfoByTypeCode($propInfo['areaId']);
     $areaName = $areaInfo['typeName'];
     $blockInfo = Bll_Commtype_Api::getInfoByTypeCode($propInfo['blockId']);
     $blockName = $blockInfo['typeName'];
     $imageUrl = '';
     if ($images) {
         foreach ($images as $key => $img) {
             $img_params['propId'] = $propId;
             $img_params['imageHostId'] = $img['host'];
             $img_params['imageHash'] = $img['hash'];
             $img_params['isDelete'] = 0;
             if ($key == 0) {
                 $img_params['isDefault'] = 1;
                 $url = Util_ImageUtils::getResizeURL($img_params['imageHash'], $img_params['imageHostId'], 290, 240);
                 //(拼好小图)
                 $imageUrl = str_replace("240", "240c", $url);
                 //无水印格式
             } else {
                 $img_params['isDefault'] = 0;
             }
             $img_params['createTime'] = date('Y-m-d H:i:s', time());
             $img_params['updateTime'] = date('Y-m-d H:i:s', time());
             $img_params['imageType'] = 1;
             //室内图
             //存储图片
             Model_Weshop_PropImages::insertWeshopPropImages($img_params);
         }
     }
     //户型图
     if (!empty($data['outdoorImageJson'])) {
         $outdoorImages = json_decode($data['outdoorImageJson'], true);
         if (!empty($outdoorImages)) {
             $img_params['propId'] = $propId;
             $img_params['imageHostId'] = $outdoorImages['host'];
             $img_params['imageHash'] = $outdoorImages['hash'];
             $img_params['isDelete'] = 0;
             $img_params['isDefault'] = 0;
             $img_params['createTime'] = date('Y-m-d H:i:s', time());
             $img_params['updateTime'] = date('Y-m-d H:i:s', time());
             $img_params['imageType'] = 2;
             //户型图
             //存储图片
             Model_Weshop_PropImages::insertWeshopPropImages($img_params);
         }
     }
     header("Access-Control-Allow-Origin: *");
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propId' => $propId, 'title' => $propInfo['title'] ? $propInfo['title'] : $commInfo['commName'] . ' ' . $result->room . '室' . $result->hall . '厅' . ' ' . $result->acreage . '平' . ' ' . intval($result->price) . '万', 'areaName' => $areaName, 'blockName' => $blockName, 'commId' => $commInfo['commId'], 'commName' => $commInfo['commName'], 'room' => $result->room, 'hall' => $result->hall, 'toilet' => $result->toilet, 'price' => intval($result->price), 'priceUnit' => '万', 'area' => $result->acreage, 'areaUnit' => '平米', 'propDescription' => json_decode($propInfo['description']), 'previewUrl' => Bll_Weshop::getPropPreviewUrl(array('brokerId' => $brokerId, 'propId' => $propId)), 'imageUrl' => $imageUrl));
 }
Ejemplo n.º 15
0
 public static function getAreaOrBlockNameV2($typeId)
 {
     $tmp = Bll_Commtype_Api::getInfoByTypeId($typeId);
     return $tmp['typeName'];
 }
Ejemplo n.º 16
0
 /**
  * 二手房-板块精选房源设置页面
  *
  * @param int $brokerId
  * @param int $cityId
  * @param int $houseId
  * @param array $params
  *
  * @return array
  */
 public static function esf_setting($brokerId, $cityId, $houseId, $userId, $params = array())
 {
     $pageAttribute = array();
     //获取精选推广预算
     $brokerInfo = Bll_BrokerBaseBll::get_instance()->get_broker_info($brokerId);
     $brokerCompanyId = $brokerInfo['BaseInfo']['COMPANYID'];
     $choiceSet = APF::get_instance()->get_config('block_choice_set');
     //根据经纪人公司不同有不同的预算
     if (isset($choiceSet[$brokerCompanyId]) && !empty($choiceSet[$brokerCompanyId])) {
         $pageAttribute['min_budget'] = $choiceSet[$brokerCompanyId]['ajk']['ESF_CHOICE_MIN_BUDGET'];
         $pageAttribute['max_budget'] = $choiceSet[$brokerCompanyId]['ajk']['ESF_CHOICE_MAX_BUDGET'];
     } else {
         $pageAttribute['min_budget'] = $choiceSet['default']['ajk']['ESF_CHOICE_MIN_BUDGET'];
         $pageAttribute['max_budget'] = $choiceSet['default']['ajk']['ESF_CHOICE_MAX_BUDGET'];
     }
     self::setChoiceNum($cityId);
     //判断当前经纪人已经精选推广的房源数
     if (isset($params['act']) && isset($params['rebid'])) {
         if (self::checkEsfBidChoiceFull($brokerId, $cityId, 1)) {
             //检查二手房精选是否达到最大
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '最多精选推广' . self::$all_esf_plan_num . '套房源');
         }
     } else {
         if (self::checkEsfBidChoiceFull($brokerId, $cityId)) {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '最多精选推广' . self::$all_esf_plan_num . '套房源');
         }
     }
     /** 经纪人重新推广房源 */
     if (isset($params['act']) && isset($params['rebid'])) {
         //在精选管理页就已经设置时候是重新推广
         $planInfo = Model_Plan_EsfAjkPropSpread::getChoicePlanInfoByHouseid($houseId);
         if ($planInfo->status == Model_Plan_EsfAjkPropSpread::ONLINE || $planInfo->status == Model_Plan_EsfAjkPropSpread::ONQUEUE) {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源已经精选');
         }
         $pageAttribute['plan_id'] = $params['plan_id'];
         $pageAttribute['rebid'] = true;
     }
     $balance = self::get_broker_balance_by_broker_id($brokerId);
     //获取经纪人账户余额
     $pageAttribute['balance'] = $balance;
     if ($balance > 0) {
         $balance = sprintf('%.2f', $balance / 100);
     }
     $pageAttribute['balance_fmt'] = $balance;
     //获取房源信息
     $pageAttribute['housesInfo'] = Bll_House_EsfHouse::getHouseBaseInfo($houseId, $cityId);
     if (empty($pageAttribute['housesInfo'])) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源不存在!');
     }
     $houseInfo = $pageAttribute['housesInfo'][0];
     if ($houseInfo->userId != $userId) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '房源不属于当前操作人');
     }
     if ($houseInfo->isVisible != 1) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '房源是违规房源,不可以参加精选房源推广');
     }
     if ($houseInfo->isHighQulity == 0) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '多图、新发15天房源才能参与精选推广');
     }
     if (date('Ymd', strtotime('-15 days')) > date('Ymd', $houseInfo->postDate)) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '多图、新发15天房源才能参与精选推广');
     }
     /** 判断是否是精选开放城市 */
     if (!Bll_City::isChoiceIndependentCity($cityId, Const_Site::ANJUKE)) {
         /** 判断是在套餐推广中 */
         $houseState = Bll_Combo_HouseRelation::getOnlineRelationByHouseId($houseId, Bll_Combo_HouseRelation::SITE_TYPE_AJK);
         if (empty($houseState)) {
             return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '该房源不在推广中');
         }
     }
     //判断是否已在竞价计划中
     $planInfo = Model_Plan_EsfAjkPropSpread::getChoicePlanInfoByHouseid($houseId);
     if (!empty($planInfo) && !isset($params['act']) && !isset($params['rebid'])) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源已经精选');
     }
     $block = Bll_Commtype_Api::getInfoByTypeCode($houseInfo->areaCode);
     $area = Bll_Commtype_Api::getInfoByTypeId($block['parentId']);
     $pageAttribute['areaBlock'] = $area['typeName'] . " " . $block['typeName'];
     $pageAttribute['title'] = sprintf("%s,%s,%d室%d厅%d卫,%d平,%.2f万", $pageAttribute['areaBlock'], $houseInfo->commName, $houseInfo->roomNum, $houseInfo->hallNum, $houseInfo->toiletNum, intval($houseInfo->areaNum), $houseInfo->proPrice);
     $pageAttribute['community_name'] = $houseInfo->commName;
     $housePrice = intval($houseInfo->proPrice * 10000);
     if (strlen($houseInfo->areaCode) < 12) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源不能精选');
     }
     //获取坑位信息
     $bucketInfo = Bll_Choice_EsfBlockBidBucket::get_bucket_info($houseInfo->areaCode, $cityId, $housePrice);
     //获取坑位信息
     if (empty($bucketInfo)) {
         Bll_Choice_EsfBlockBidBucket::init_bucket_info($houseInfo->areaCode, $cityId, $housePrice);
         $bucketInfo = Bll_Choice_EsfBlockBidBucket::get_bucket_info($houseInfo->areaCode, $cityId, $housePrice);
     }
     if ($bucketInfo['usedNum'] < $bucketInfo['maxOnlineNum']) {
         $pageAttribute['hidden']['show'] = 1;
     }
     $pageAttribute['bucket_total'] = $bucketInfo['totalNum'];
     $pageAttribute['bucket_used'] = $bucketInfo['usedNum'];
     $pageAttribute['bucket_used_num'] = $bucketInfo['usedNum'];
     $pageAttribute['bucket_total_num'] = $bucketInfo['totalNum'];
     $pageAttribute['bucket_max_online_num'] = $bucketInfo['maxOnlineNum'];
     $priceInfo = Model_House_EsfPrice::get_price_by_id($bucketInfo['priceId']);
     $pageAttribute['price_title'] = sprintf("%d-%d万", intval($priceInfo['minPrice'] / 10000), intval($priceInfo['maxPrice'] / 10000));
     //价格
     $clickPrice = Bll_Service_BlockChoice::ajkBlockClickPrice(array('brokerId' => $brokerId, 'cityId' => $cityId, 'price' => $housePrice, 'blockId' => $block['typeId']));
     if ($clickPrice['status'] == 'error') {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '服务器繁忙,请重试(code: -' . __LINE__ . ')');
     }
     if ($clickPrice['realTradeAmount'] != $clickPrice['shouldTradeAmount']) {
         $pageAttribute['favorable'] = true;
         $pageAttribute['price'] = round($clickPrice['realTradeAmount'] / 100, 2);
         $pageAttribute['origin_price'] = round($clickPrice['shouldTradeAmount'] / 100, 2);
         $pageAttribute['favorable_end_time'] = date('Y-m-d', strtotime($clickPrice['rebateEndTime']));
     } else {
         $pageAttribute['favorable'] = false;
         $pageAttribute['price'] = round($clickPrice['realTradeAmount'] / 100, 2);
     }
     //         $clickAndBudget = Bll_Choice_EsfBlockBidBucket::getBucketAverageClickBudget($houseInfo->areaCode, $cityId, $housePrice);  //获取坑位的平均点击的预算
     //        if (!empty($clickAndBudget)) {
     //            $pageAttribute['averageClick'] = $clickAndBudget['averageClick'];
     //            $pageAttribute['averageBudget'] = $clickAndBudget['averageBudget'] / 100;
     //        }
     /**重组区域精选url**/
     $bidPlanList = Bll_Plan_Bid_AjkPlan::getBrokerValidPlanListByhouseId($houseId, $brokerId, $cityId, true);
     $bidPlanList = $bidPlanList[0];
     if (isset($bidPlanList)) {
         $blockInfo['bidStatus'] = $bidPlanList['status'];
         if ($bidPlanList['status'] == 1) {
             $bidUrl = '/ajkbroker/user/choice/manage/ajk/#' . $houseId;
         } elseif ($bidPlanList['status'] == 11) {
             $bidUrl = '/ajkbroker/user/choice/manage/ajk/#' . $houseId;
         } else {
             if ($bidPlanList['status'] != 2) {
                 $bidUrl = "/ajkbroker/user/choice/set/ajk/" . $houseInfo['proId'] . '/?act=1&rebid=1&plan_id=' . $bidPlanList['id'];
             }
         }
     } else {
         $bidUrl = "/ajkbroker/user/choice/set/ajk/" . $houseInfo['proId'];
     }
     $pageAttribute['bidUrl'] = $bidUrl;
     return $pageAttribute;
 }