Example #1
0
 public function handle_request_internal()
 {
     // 关闭录入房源
     $tmpTime = APF::get_instance()->get_config('fyk_onoff_time', 'fyk_common');
     if (time() >= strtotime($tmpTime)) {
         return array('status' => 'error', 'message' => "现在无法录入房源");
     }
     $userId = intval($this->_params['userId']);
     $data = $this->_params;
     //$commInfo = Bll_Community_CommunityGardener::getCommunityInfoByCommunityId($data['commId']);
     $commInfo = Bll_Community_APIComm::getInstance()->getInfoById($data['commId']);
     //判断用户是否有使用房源库的资格
     $hasAccess = Bll_Fyk_Prop_Action::getInstance()->hasFykAccess($userId);
     if ($hasAccess === false) {
         $ary = array("status" => "error", "errcode" => Const_APIStatus::E_FYK_USER_NO_ACCESS, "message" => '该用户没有权限');
         return $ary;
     }
     //验证用户是否达到发房上限
     if (Const_Fyk::LIMIT_OF_PUBLISH > 0) {
         $isReach = $this->isReachTheLimitOfPublish($userId, Const_Fyk::LIMIT_OF_PUBLISH);
         if (!empty($isReach)) {
             return $isReach;
         }
     }
     //验证房源库是否达到每日发房总数上限
     if (Const_Fyk::LIMIT_OF_TOTAL_PUBLISH > 0) {
         $isReachTotal = Bll_Fyk_Prop_Action::getInstance()->isReachTheLimitOfTotalPublish($commInfo['city_id'], Const_Fyk::LIMIT_OF_TOTAL_PUBLISH);
         if ($isReachTotal === true) {
             $ary = array('status' => 'error', 'errcode' => Const_APIStatus::E_FYK_PROP_PUBLISH_REACH_TOTAL_PUBLISH_NUM, 'message' => '该城市房源库达到每日发房数量上限');
             return $ary;
         }
     }
     //验证发布的房源是否已被此经纪人发布过
     $isInVerification = Bll_Fyk_Prop_Action::getInstance()->isPublishPropInVerification($userId, intval($data['commId']), $data['houseNum'], $data['buildNum']);
     if ($isInVerification === true) {
         $ary = array('status' => 'error', 'errcode' => Const_APIStatus::E_FYK_PROP_PUBLISH_IN_VERIFICATION, 'message' => '该房源已被此经纪人发布过');
         return $ary;
     }
     $data['isOnly'] = $data['isOnly'] ? 1 : 0;
     $data['certificate'] = $data['certificate'] ? 1 : 0;
     $data['houseImages'] = $data['houseImages'] ? $data['houseImages'] : '';
     $houseImages = array();
     if (!empty($data['houseImages'])) {
         $houseImages = json_decode($data['houseImages'], true);
     }
     $acreage = round($data['acreage']);
     $base = array('userId' => $data['userId'], 'commId' => $data['commId'], 'buildNum' => trim($data['buildNum']), 'roomNum' => trim($data['houseNum']), 'ownerName' => $data['ownerName'], 'mobile' => $data['ownerPhone'], 'totalPrices' => $data['prices'], 'acreage' => $acreage, 'cell' => $data['cell'], 'hall' => $data['hall'], 'toilet' => $data['toilet'], 'totalFloor' => $data['totalFloor'], 'floor' => $data['floor'], 'orientation' => $data['orientation'], 'isOnly' => $data['isOnly'], 'certificate' => $data['certificate'], 'houseImages' => $houseImages);
     $body = json_encode(array('base' => $base, 'edit' => array()));
     $publishInfo = array('cityId' => $commInfo['city_id'], 'userId' => $data['userId'], 'operatorId' => '', 'operatorName' => '', 'status' => 0, 'source' => $data['fromType'], 'type' => 1, 'body' => $body, 'checkMsg' => '', 'createTime' => time());
     $result = Model_Fyk_UserPropAction::getInstance()->insertData($publishInfo);
     if ($result) {
         //设置缓存
         $publishCacheKey = Bll_Fyk_Prop_Action::getInstance()->getPublishCacheKey($userId, $data['commId'], $data['houseNum'], $data['buildNum']);
         $cache = APF_Cache_Factory::get_instance()->get_memcache();
         $cache->set($publishCacheKey, 'fykPublish', 0, 300);
         return array("status" => "ok", "message" => "发布成功");
     } else {
         return array("status" => "error", "errcode" => Const_APIStatus::E_FYK_PROP_PUBLISH_FAILURE, "message" => "");
     }
 }
Example #2
0
 public function handle_request_internal()
 {
     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);
     }
     //经纪人所有二手房房源
     $tempHouseInfoList = Bll_House_EsfHouse::getBrokerAllPropInfoList($brokerId, $brokerInfo->cityId);
     //过滤违规房源
     $commIds = array();
     foreach ($tempHouseInfoList as $key => $houseInfo) {
         $illegal = isset($houseInfo['isVisible']) ? $houseInfo['isVisible'] : 1;
         if ($illegal == 0 && $houseInfo['ExpireWorker'] != 'propertyReport') {
             unset($tempHouseInfoList[$key]);
             continue;
         }
         $commIds[] = $houseInfo['commId'];
     }
     $commInfos = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIds);
     $commlist = array();
     foreach ($commInfos as $commInfo) {
         $row = array();
         $row['commId'] = $commInfo['commId'];
         $row['commName'] = $commInfo['commName'];
         $row['commAddress'] = $commInfo['commLocal'];
         $commlist[] = $row;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('commlist' => $commlist));
 }
Example #3
0
 public static function &getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #4
0
 /**
  * 获取经纪人我的房源
  * @param $userId
  * @param $status
  * @param $orderBy
  * @param $sort
  * @param int $limit
  * @param int $sinceId
  * @param string $upOrDown
  * @return mixed
  */
 public function getUserPropsByUserIdAndSinceId($userId, $status, $orderBy, $sort, $limit = 20, $sinceId = 0, $upOrDown = 'down')
 {
     $list = Model_Fyk_UserProps::getInstance()->getDataByUserIdAndSinceId($userId, $status, $orderBy, $sort, $limit, $sinceId, $upOrDown);
     $result = array();
     if (!empty($list)) {
         $propIds = array();
         foreach ($list as $val) {
             $propIds[] = $val['propId'];
         }
         $propInfos = $this->getPropInfo($propIds);
         // 获取房源信息
         $propExtendInfos = Bll_Fyk_Prop_Extend::getInstance()->getPropExtendInfo($propIds);
         // 获取房源扩展信息
         $cInfo = array();
         foreach ($list as $val) {
             $propInfo = $propInfos[$val['propId']];
             // 单个房源信息
             $propExtendInfo = $propExtendInfos[$val['propId']];
             // 单个房源扩展信息
             if (empty($propInfo)) {
                 continue;
             }
             if (empty($cInfo[$propInfo['commId']])) {
                 $cInfo[$propInfo['commId']] = Bll_Community_APIComm::getInstance()->getInfoById($propInfo['commId']);
             }
             //print_r($cInfo[$propInfo['commId']]);exit;
             $commInfo = $cInfo[$propInfo['commId']];
             $result[] = array('id' => $val['id'], 'fPropId' => $propInfo['id'], 'commId' => $propInfo['commId'], 'commName' => $commInfo['name'], 'buildNum' => $propInfo['buildNum'], 'houseNum' => $propInfo['roomNum'], 'roomNum' => $propInfo['cell'], 'hallNum' => $propInfo['hall'], 'toiletNum' => $propInfo['toilet'], 'area' => $propInfo['acreage'], 'price' => intval($propInfo['totalPrices']), 'priceUnit' => '万元', 'ownerName' => $propInfo['ownerName'], 'ownerMobile' => $propInfo['mobile'], 'is400' => 0, 'owner400host' => '', 'owner400' => '', 'isUserRush' => $val['comeFrom'] == 1 ? 1 : 0, 'houseStatus' => $propInfo['status'], 'houseStatusName' => $this->getPropStatusName($propInfo['status']), 'createTime' => date("Y-m-d H:i:s", $val['createTime']));
         }
     }
     return $result;
 }
Example #5
0
 public function handle_request_internal()
 {
     $entrustId = $this->_params['entrustId'];
     $brokerId = $this->_params['brokerId'];
     $entrustType = $this->_params['entrustType'];
     //房源数据获取
     $data = Model_House_CommissionHouse::getEntrustsPro($entrustId);
     $data = $data[0];
     //图片读取
     $imgInfo = Model_Image_SaleEntrustImage::getImagesByProIds(array($entrustId));
     //获取委托房源关系
     $eEntrust = Model_House_Commission::getCommissions($entrustId);
     foreach ($eEntrust as $eEntrustval) {
         $eBrokers[] = $eEntrustval['brokerId'];
         if ($eEntrustval['brokerId'] == $brokerId) {
             $rushBrokerId = $eEntrustval['brokerId'];
             $brokerHouseId = $eEntrustval['brokerHouseId'];
         }
     }
     //委托房源详情状态值获取
     list($showStatus, $propertyId) = $this->showState($data, $brokerId, $rushBrokerId, $brokerHouseId);
     //小区信息读取
     $commInfo = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($data['commId'], 2);
     //格式化数据
     $data = $this->formatdate($data, $eBrokers, $showStatus, $commInfo['commLocal'], $rushBrokerId, $propertyId, $imgInfo);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $data);
 }
 public function handle_request_internal()
 {
     /**
      * 00:00
      *  获取前一天20:00 以后
      * 10:00
      *  获取10:00 以后
      * 15:00
      *  获取15:00 以后
      * 20:00
      *  获取20:00 以后
      *
      */
     // 获取参数;
     $commId = $this->_params['commId'];
     // 根据ID获取小区
     $community = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId, 2);
     if (!$community || !$community['sosolat'] || !$community['sosolng']) {
         throw new Exception('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $data = array();
     if (Bll_Broker_CommunitySign::isTopSignerActivityOngoing()) {
         $hour = intval(date('H'));
         if ($hour >= 0 && $hour < 10) {
             $theSignRange = array(date('Y-m-d 20:00:00', strtotime('-1 day')), date('Y-m-d 23:59:59', strtotime('-1 day')));
         } elseif ($hour >= 10 && $hour < 15) {
             $theSignRange = array(date('Y-m-d 10:00:00'), date('Y-m-d 14:59:59'));
         } elseif ($hour >= 15 && $hour < 20) {
             $theSignRange = array(date('Y-m-d 15:00:00'), date('Y-m-d 19:59:59'));
         } else {
             $theSignRange = array(date('Y-m-d 20:00:00'), date('Y-m-d 23:59:59'));
         }
         $brokerInfos = Bll_Commsign::getFirstThr($commId, $theSignRange[0]);
         //var_dump($data);exit;
         $data = array();
         if (!empty($brokerInfos)) {
             foreach ($brokerInfos as $k => $v) {
                 $brokerTmp = Bll_Commsign::getBrokerInfo($v['brokerId']);
                 if (!$brokerTmp) {
                     $broker = Model_Broker_AjkBrokerExtend::data_access()->filter('brokerId', $v['brokerId'])->find_only();
                     $broker_photo = Util_ImageUtils::get_broker_photo_url($broker['userPhoto'], '200x200');
                     $brokerTmp = array('brokerId' => $broker['brokerId'], 'username' => $broker['trueName'], 'userPhoto' => $broker_photo, 'cityId' => $broker['cityId']);
                     Bll_Commsign::redisBrokerInfo($v['brokerId'], $brokerTmp);
                 }
                 if (empty($brokerTmp['userPhoto'])) {
                     $brokerTmp['userPhoto'] = PageHelper::pure_static_url('/img/bknoimg.gif');
                 }
                 $dataTmp = array('brokerId' => $brokerTmp['brokerId'], 'brokerTrueName' => $brokerTmp['username'], 'brokerPhoto' => $brokerTmp['userPhoto']);
                 $data[] = $dataTmp;
             }
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $data);
 }
Example #7
0
 private function dataCheck($fPropInfo, $fPropInfoExtend, $isBuy)
 {
     $propStatusArr = array(Const_Fyk::PROPSTATUS_DELETE => '房源已被删除', Const_Fyk::PROPSTATUS_SELLING => '在售中', Const_Fyk::PROPSTATUS_SELLED => '房源已出售', Const_Fyk::PROPSTATUS_NOSELL => '房东不卖了', Const_Fyk::PROPSTATUS_FALSE => '房源已被证实为虚假房源');
     //部分缺省数据获取
     //$commInfo = Bll_Community_CommunityGardener::getCommunityInfoByCommunityId($fPropInfo['commId']);
     $commInfo = Bll_Community_APIComm::getInstance()->getInfoById($fPropInfo['commId']);
     $unitPrice = round($fPropInfo['totalPrices'] / $fPropInfo['acreage'], 2);
     //计算发布时间
     $publishDate = strtotime(date('Y-m-d', $fPropInfo['createTime']));
     $nowDate = strtotime(date('Y-m-d', time()));
     $publishDays = intval(($nowDate - $publishDate) / 86400);
     $publishDaysMsg = '天前发布';
     if ($publishDays < 1) {
         $publishDays = 0;
         $publishDaysMsg = '今天发布';
     }
     $wish = $fPropInfoExtend['sale_desire'] ? $fPropInfoExtend['sale_desire'] : '';
     $saleReason = $fPropInfoExtend['sale_reason'] ? $fPropInfoExtend['sale_reason'] : '';
     if ($fPropInfo['status'] == Const_Fyk::PROPSTATUS_FALSE) {
         $fPropInfo['falseReason'] = $fPropInfoExtend['false_reason'] ? $fPropInfoExtend['false_reason'] : '房东不存在';
     }
     //图片信息整理
     $houseImages = array();
     $imageData = $fPropInfoExtend['image'];
     foreach ($imageData as $image) {
         $hash_host = explode("_", $image);
         $images['id'] = $hash_host[0];
         $images['hash'] = $hash_host[0];
         $images['host'] = $hash_host[1];
         $images['smallImageUrl'] = Util_Image::getInstance()->getResizeURL($hash_host[0], $hash_host[1], 100, 75);
         //(拼好小图)
         if ($isBuy === true) {
             $images['bigImageUrl'] = Util_Image::getInstance()->getResizeURL($hash_host[0], $hash_host[1], 600, 600);
             //(拼好大图)
         } else {
             $images['bigImageUrl'] = '';
         }
         $images['format'] = 'JPEG';
         $houseImages[] = $images;
     }
     //未购买时隐藏部分字段
     if ($isBuy === true) {
         $ownerMobile = $fPropInfo['mobile'];
         $buildNum = $fPropInfo['buildNum'] ? $fPropInfo['buildNum'] : '暂无';
         $houseNum = $fPropInfo['roomNum'] ? $fPropInfo['roomNum'] : '暂无';
     } else {
         $ownerMobile = substr_replace($fPropInfo['mobile'], '****', 3, 4);
         $buildNum = '购买后可见';
         $houseNum = '购买后可见';
     }
     $result = array('commName' => $commInfo['name'], 'commId' => $fPropInfo['commId'], 'roomNum' => $fPropInfo['cell'], 'hallNum' => $fPropInfo['hall'], 'toiletNum' => $fPropInfo['toilet'], 'totalPrice' => intval($fPropInfo['totalPrices']), 'unitPrice' => $unitPrice, 'priceUnit' => '万', 'area' => $fPropInfo['acreage'], 'publishDays' => $publishDays, 'publishDaysMsg' => $publishDaysMsg, 'buildNum' => $buildNum, 'houseNum' => $houseNum, 'totalFloor' => $fPropInfo['totalFloor'], 'floor' => $fPropInfo['floor'], 'orientation' => $fPropInfo['orientation'], 'isOnly' => $fPropInfo['isOnly'], 'certificate' => $fPropInfo['certificate'], 'ownerName' => $fPropInfo['ownerName'], 'ownerMobile' => $ownerMobile, 'isOwner400' => 0, 'owner400' => '', 'owner400host' => '', 'wish' => $wish, 'saleReason' => $saleReason, 'status' => $fPropInfo['status'], 'statusMsg' => $propStatusArr[$fPropInfo['status']], 'falseReason' => '', 'isBuy' => $isBuy ? 1 : 0, 'houseImages' => $houseImages);
     return $result;
 }
Example #8
0
 /**
  * 获取房源 Solr 文档信息
  *
  * @param Model_Fyk_QueuePropToSolr $task
  *
  * @return array
  */
 protected function propDoc($task)
 {
     $propDoc = array();
     $prop = $task->prop();
     if (!$prop) {
         throw new Exception(sprintf('Task %d prop %d not found.', $task->id, $task->propId));
     }
     $propDoc['id'] = $prop->id;
     $propDoc['status'] = $prop->status;
     $propDoc['city_id'] = $prop->cityId;
     $propDoc['housing_type_id'] = $prop->housingType;
     $propDoc['housing_type_name'] = '';
     // TODO
     // TODO 待优化
     $housingType = Model_Community_UseType::data_access()->filter('typeId', $prop->housingType)->find_only();
     if ($housingType) {
         $propDoc['housing_type_name'] = $housingType['typeName'];
         // TODO
     }
     $propDoc['build_year'] = $prop->buildYear;
     $propDoc['is_only'] = $prop->isOnly;
     $propDoc['is_real'] = $prop->isReal;
     $propDoc['is_certificate'] = $prop->certificate;
     $propDoc['fitment_id'] = $prop->fitment;
     $propDoc['fitment_name'] = '';
     // TODO
     $fitmentType = Model_House_FitmentType::data_access()->filter('fitmentId', $prop->fitment)->find_only();
     if ($fitmentType) {
         $propDoc['fitment_name'] = $fitmentType->fitmentValue;
     }
     $propDoc['area_num'] = $prop->acreage;
     $propDoc['room_num'] = $prop->cell;
     $propDoc['hall_num'] = $prop->hall;
     $propDoc['toilet_num'] = $prop->toilet;
     $propDoc['floor'] = $prop->floor;
     $propDoc['floor_total'] = $prop->totalFloor;
     $propDoc['price'] = $prop->totalPrices * 10000;
     // 单位:元
     $propDoc['price_unit'] = $prop->acreage ? intval($prop->totalPrices * 10000 / $prop->acreage) : 0;
     $propDoc['comm_id'] = $prop->commId;
     $propDoc['comm_name'] = '';
     $propDoc['comm_location'] = '';
     // TODO 待优化
     $comm = Bll_Community_APIComm::getInstance()->getInfoById($prop->commId, 2);
     $commLat = $comm['geolocation']['soso'] ? $comm['geolocation']['soso']['lat'] : null;
     $commLng = $comm['geolocation']['soso'] ? $comm['geolocation']['soso']['lng'] : null;
     if ($comm) {
         $propDoc['comm_name'] = $comm['name'];
         $propDoc['comm_location'] = $commLat . ',' . $commLng;
     }
     $propDoc['block_id'] = $prop->blockId;
     $propDoc['block_name'] = '';
     $propDoc['district_id'] = $prop->areaId;
     $propDoc['district_name'] = '';
     // TODO 待优化
     $zones = Model_City_TypeCode::data_access()->filter('typeId', array($prop->blockId, $prop->areaId))->find_all();
     foreach ($zones as $zone) {
         if ($zone->typeId == $propDoc['block_id']) {
             $propDoc['block_name'] = $zone->typeName;
         }
         if ($zone->typeId == $propDoc['district_id']) {
             $propDoc['district_name'] = $zone->typeName;
         }
     }
     $propDoc['onsell_time'] = $prop->onsellTime;
     $propDoc['create_time'] = $prop->createTime;
     $propDoc['update_time'] = strtotime($prop->updateTime);
     return $propDoc;
 }
Example #9
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);
 }
Example #10
0
 private function checkData($body, $checkMsg, $status)
 {
     $data = $body['base'];
     $checkInfo = $body['edit'];
     $commInfo = Bll_Community_APIComm::getInstance()->getInfoById($data['commId']);
     $unitPrice = round($data['totalPrices'] / $data['acreage'], 2);
     $buildNum = $data['buildNum'] ? $data['buildNum'] : '暂无';
     $houseNum = $data['roomNum'] ? $data['roomNum'] : '暂无';
     $statusMessage = APF::get_instance()->get_config('prop_status_message', 'fyk_common');
     //图片处理
     $houseImages = array();
     if (!empty($data['houseImages'])) {
         $houseImages = $this->getImagesInfo($data['houseImages']);
     }
     $falseMsg = '';
     if (!empty($checkMsg['passedData'])) {
         if (!empty($checkMsg['passedData']['falseMsg'])) {
             $falseMsg = $checkMsg['passedData']['falseMsg'];
         }
     }
     $wish = $data['wish'] ? $data['wish'] : '';
     $saleReason = $data['saleReason'] ? $data['saleReason'] : '';
     $propInfo = array('commName' => $commInfo['name'], 'commId' => $data['commId'], 'roomNum' => $data['cell'], 'hallNum' => $data['hall'], 'toiletNum' => $data['toilet'], 'totalPrice' => intval($data['totalPrices']), 'unitPrice' => $unitPrice, 'priceUnit' => '万', 'area' => $data['acreage'], 'buildNum' => $buildNum, 'houseNum' => $houseNum, 'totalFloor' => $data['totalFloor'], 'floor' => $data['floor'], 'orientation' => $data['orientation'], 'isOnly' => $data['isOnly'], 'certificate' => $data['certificate'], 'ownerName' => $data['ownerName'], 'ownerMobile' => $data['mobile'], 'isOwner400' => 0, 'owner400' => '', 'owner400host' => '', 'wish' => $wish, 'saleReason' => $saleReason, 'status' => $status, 'statusMessage' => $statusMessage[$status], 'falseMsg' => $falseMsg, 'houseImages' => $houseImages);
     //将修改字段变为用户提交的值
     if (!empty($checkInfo)) {
         foreach ($checkInfo as $key => $value) {
             if ($value = 'status') {
                 continue;
             }
             $apiKey = '';
             if (!empty($value)) {
                 switch ($value) {
                     case 'cell':
                         $apiKey = 'roomNum';
                         break;
                     case 'hall':
                         $apiKey = 'hallNum';
                         break;
                     case 'toilet':
                         $apiKey = 'toiletNum';
                         break;
                     case 'acreage':
                         $apiKey = 'area';
                         break;
                     case 'totalPrices':
                         $apiKey = 'totalPrice';
                         break;
                     case 'roomNum':
                         $apiKey = 'houseNum';
                         break;
                     case 'mobile':
                         $apiKey = 'ownerMobile';
                         break;
                     default:
                         $apiKey = $key;
                 }
                 $propInfo[$apiKey] = $value;
             }
             //如果涉及到总价或面积的修改,则重新计算单价
             if (in_array($key, array('area', 'totalPrices'))) {
                 $propInfo['unitPrice'] = round($checkInfo['totalPrices'] / $checkInfo['acreage'], 2);
             }
             //如果涉及到图片修改,重新切图
             if ($key == 'houseImages') {
                 $propInfo['houseImages'] = $this->getImagesInfo($value);
             }
         }
     }
     return $propInfo;
 }
Example #11
0
 public function handle_request_internal()
 {
     /**
      * 签到小区详情
      *
      * - 验证参数
      *
      *
      * - 获取经纪人
      *
      * - 获取小区(AjkCommunity)
      * -
      *
      * - 获取小区签到人数
      *
      * - 判断经纪人是否可签到(经纪人是否已签到、当前是否在签到时间段)
      * - 校验小区坐标和lat、lng的距离5公里,超出不可签到(如小区无坐标,不可签到)
      *
      * - 计算距离下一时间点的签到倒计时(单位:s)
      *
      * - 获取小区各个时间段签到前3名
      *
      * - 返回数据
      */
     // 获取参数
     $brokerId = $this->_params['brokerId'];
     $commId = $this->_params['commId'];
     $lat = $this->_params['lat'];
     $lng = $this->_params['lng'];
     // 根据ID获取经纪人
     $broker = Bll_Commsign::getBrokerInfo($brokerId);
     if (!$broker) {
         $broker = Model_Broker_AjkBrokerExtend::data_access()->filter('brokerId', $brokerId)->find_only();
         if (!$broker) {
             throw new Exception('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
         }
         $broker_photo = Util_ImageUtils::get_broker_photo_url($broker['userPhoto'], '200x200');
         $brokerInfo = array('brokerId' => $broker['brokerId'], 'username' => $broker['trueName'], 'userPhoto' => $broker_photo, 'cityId' => $broker['cityId']);
         Bll_Commsign::redisBrokerInfo($brokerId, $brokerInfo);
     }
     // 根据ID获取小区
     $community = Bll_Commsign::getCommInfo($commId);
     if (empty($community)) {
         $community = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId, 2);
         $commInfo = array();
         $commInfo['commId'] = $community['commId'];
         $commInfo['commName'] = $community['commName'];
         $commInfo['sosolng'] = $community['sosolng'];
         $commInfo['sosolat'] = $community['sosolat'];
         Bll_Commsign::setCommInfo($commId, $commInfo);
     }
     if (!$community || !$community['sosolat'] || !$community['sosolng']) {
         throw new Exception('小区不存在', Const_APIStatus::E_COMMUNITY_NOT_EXISTS);
     }
     // 获取小区签到人数
     $communitySignCount = Bll_Commsign::getCommCount($commId);
     // 判断经纪人是否可签到
     $signAble = true;
     $currentSignRange = Bll_Broker_CommunitySign::getCurrentSignRange();
     if (!$currentSignRange) {
         $signAble = false;
     } else {
         // 经纪人是否已经签过到
         if (Bll_Commsign::isSignedAlready($brokerId, $commId, $currentSignRange[0])) {
             $signAble = false;
         }
     }
     // 对比小区坐标和参数坐标两点的距离(5km)
     $distance = Util_Map::distance($lat, $lng, $community['sosolat'], $community['sosolng']);
     if ($distance > 5000) {
         $signAble = false;
     }
     $data = array();
     $data['signAble'] = intval($signAble);
     $data['signCount'] = $communitySignCount;
     $data['countDown'] = $signAble ? 0 : Bll_Broker_CommunitySign::nextSignCountDown();
     $data['signList'] = array();
     // 获取各时间段签到前三名
     if (Bll_Broker_CommunitySign::isTopSignerActivityOngoing()) {
         $data['signList'] = array(array('hour' => '10:00', 'brokers' => array()), array('hour' => '15:00', 'brokers' => array()), array('hour' => '20:00', 'brokers' => array()));
         foreach ($data['signList'] as &$theSignList) {
             $theHour = intval($theSignList['hour']);
             $hour = intval(date('H'));
             if ($hour >= 0 && $hour < 10) {
                 break;
             } elseif ($hour >= 10 && $hour < 20) {
                 if ($theHour > $hour) {
                     continue;
                 }
             }
             $theSignRange = array();
             switch ($theHour) {
                 case 10:
                     $theSignRange = array(date('Y-m-d 10:00:00'), date('Y-m-d 14:59:59'));
                     break;
                 case 15:
                     $theSignRange = array(date('Y-m-d 15:00:00'), date('Y-m-d 19:59:59'));
                     break;
                 case 20:
                     $theSignRange = array(date('Y-m-d 20:00:00'), date('Y-m-d 23:59:59'));
                     break;
             }
             $theSignList['brokers'] = Bll_Commsign::getFirstThr($commId, $theSignRange[0]);
             if (empty($theSignList['brokers'])) {
                 $theSignList['brokers'] = Model_Broker_CommunitySign::data_access(date('Ym', strtotime($currentSignRange[0])))->filter('communityId', $commId)->filter_by_op_multi(array(array('signTime', '>=', $theSignRange[0]), array('signTime', '<=', $theSignRange[1])))->sort('signTime', 'asc')->limit(3)->get_all();
             }
             $tmp = array();
             if (!empty($theSignList['brokers'])) {
                 foreach ($theSignList['brokers'] as $k => $v) {
                     $brokerTmp = Bll_Commsign::getBrokerInfo($v['brokerId']);
                     if (!$brokerTmp) {
                         $broker = Model_Broker_AjkBrokerExtend::data_access()->filter('brokerId', $v['brokerId'])->find_only();
                         $broker_photo = Util_ImageUtils::get_broker_photo_url($broker['userPhoto'], '200x200');
                         $brokerTmp = array('brokerId' => $broker['brokerId'], 'username' => $broker['trueName'], 'userPhoto' => $broker_photo, 'cityId' => $broker['cityId']);
                         Bll_Commsign::redisBrokerInfo($v['brokerId'], $brokerTmp);
                     }
                     if (empty($brokerTmp['userPhoto'])) {
                         $brokerTmp['userPhoto'] = PageHelper::pure_static_url('/img/bknoimg.gif');
                     }
                     $dataTmp = array('brokerId' => $brokerTmp['brokerId'], 'brokerTrueName' => $brokerTmp['username'], 'brokerPhoto' => $brokerTmp['userPhoto']);
                     $tmp[] = $dataTmp;
                 }
                 $theSignList['brokers'] = $tmp;
             }
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $data);
 }
 public function handle_request_internal()
 {
     $propLists = array();
     $hasNextPage = 0;
     $userId = $this->_params['userId'];
     $sinceId = isset($this->_params['sinceId']) ? intval($this->_params['sinceId']) : 0;
     $per = isset($this->_params['per']) ? $this->_params['per'] : 20;
     $propIds = Model_Broker_FykPushProps::data_access()->load_field('propId')->filter('userId', $userId)->sort('id', 'desc')->limit($per + 1)->offset($sinceId)->get_all();
     if (!empty($propIds)) {
         $hasNextPage = count($propIds) > $per ? 1 : 0;
         if ($hasNextPage) {
             array_pop($propIds);
             $sinceId = $sinceId + $per;
         } else {
             $sinceId = 0;
         }
         $propIds = self::getArrayColumn($propIds, 'propId');
         $props = Model_Fyk_PropLibrary::data_access()->filter('id', array_unique($propIds))->get_all();
         //获取小区、板块名称 start
         $commNames = $typeNames = array();
         $commIds = self::getArrayColumn($props, 'commId');
         /*$commInfos = Model_Community_AjkCommunity::data_access()
           ->filter('commId', $commIds)
           ->get_all();*/
         $commInfos = Bll_Community_APIComm::getInstance()->getInfoById($commIds);
         foreach ($commInfos as $info) {
             $commNames[$info['comm_id']] = $info['name'];
         }
         //————————————————————————————————————————————————
         $districtIds = self::getArrayColumn($props, 'areaId');
         $blockIds = self::getArrayColumn($props, 'blockId');
         $typeIds = array_merge($districtIds, $blockIds);
         $typeInfos = Model_City_TypeCode::data_access()->load_field('typeId')->load_field('typeName')->filter('typeId', $typeIds)->get_all();
         foreach ($typeInfos as $info) {
             $typeNames[$info['typeId']] = $info['typeName'];
         }
         //获取小区、板块名称 end
         foreach ($props as $prop) {
             //计算发布时间
             $publishDate = strtotime(date('Y-m-d', $prop['createTime']));
             $nowDate = strtotime(date('Y-m-d', time()));
             $publishDays = intval(($nowDate - $publishDate) / 86400);
             $propId = $prop['id'];
             $propList['fPropId'] = $propId;
             $propList['isOnly'] = $prop['isOnly'];
             $propList['isReal'] = $prop['isReal'];
             $propList['certificate'] = $prop['certificate'];
             $propList['commId'] = $prop['commId'];
             $propList['commName'] = $commNames[$prop['commId']];
             $propList['districtId'] = $prop['areaId'];
             $propList['districtName'] = $typeNames[$prop['areaId']];
             $propList['blockId'] = $prop['blockId'];
             $propList['blockName'] = $typeNames[$prop['blockId']];
             $propList['roomNum'] = $prop['cell'];
             $propList['hallNum'] = $prop['hall'];
             $propList['toiletNum'] = $prop['toilet'];
             $propList['area'] = $prop['acreage'];
             $propList['areaUnit'] = '平';
             $propList['price'] = intval($prop['totalPrices']);
             $propList['priceUnit'] = '万';
             $propList['publishDays'] = $publishDays;
             $propList['publishDaysMsg'] = $propList['publishDays'] > 0 ? "{$propList['publishDays']}天前发布" : '今天发布';
             $propLists[$propId] = $propList;
         }
     }
     $propListFormat = array();
     foreach ($propIds as $id) {
         $propListFormat[] = $propLists[$id];
     }
     unset($propLists);
     //更新为0
     Model_Fyk_PushPropsLatestCount::data_access()->set_field('count', 0)->filter('userId', $userId)->update();
     $data['props'] = $propListFormat;
     $data['sinceId'] = $sinceId;
     $data['hasNextPage'] = $hasNextPage;
     return API_Result::create()->ok()->data($data)->toArray();
 }
Example #13
0
 public function handle_request_internal()
 {
     $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);
     }
     //获取最近使用的小区 @todo token问题。
     /*
     $api_url = '/service-internal/rest/brokers/commRecentUse?brokerId=' . $broker_id;
     $recent_comm = Util_CallAPI::get_data_from_java_api($api_url);
     
     if ($recent_comm['data']['status'] == 'ok') {
         $recent_commids = $recent_comm['data']['info'];
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR);
     }
     */
     //调用java api获取经纪人的小区 http://java-api.a.ajkdns.com/3.0/rest/broker/comms?brokerId=7790703&from=mobile-ajk-broker
     $api_url = 'broker/comms?brokerId=' . $broker_id;
     $recent_comm = Util_CallAPI::get_data_from_java_v3($api_url);
     if ($recent_comm['data']['status'] == 'ok') {
         $recent_commids_arr = $recent_comm['data']['comm'];
         if (!empty($recent_commids_arr)) {
             foreach ($recent_commids_arr as $comm) {
                 $recent_commids[] = $comm['commId'];
             }
             //$recent_commids_str = implode(',', $recent_commids);
         }
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR);
     }
     $return = array();
     $return["status"] = "ok";
     if ($recent_comm['data']['status'] == 'ok') {
         $recent_comm = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($recent_commids);
         $recent_comm_list = $recent_comm;
         //最近使用的小区列表
         $recent_comm_count = count($recent_comm);
         if ($recent_comm_count < Const_APIStatus::SEARCH_COMM_LIST_NUM) {
             $this->_params['pageSize'] = Const_APIStatus::SEARCH_COMM_LIST_NUM - $recent_comm_count;
             apf_require_controller("V1_Comm_GetNearby");
             $nearby_comm = new V1_Comm_GetNearbyController();
             $nearby_comm = $nearby_comm->getNearbyComm($this->_params);
             $nearby_comm_list = $nearby_comm['communities'];
         }
         if ($recent_comm_list) {
             foreach ($recent_comm_list as $list) {
                 if ($list['typeFlag'] == 0) {
                     continue;
                 }
                 $return['data']['history'][] = array('commId' => $list['commId'], 'commName' => $list['commName'], 'address' => $list['commLocal']);
             }
         } else {
             $return['data']['history'] = array();
         }
         if ($nearby_comm_list) {
             foreach ($nearby_comm_list as $list) {
                 $return['data']['nearby'][] = array('commId' => $list['id'], 'commName' => $list['name'], 'address' => $list['address']);
             }
         } else {
             $return['data']['nearby'] = array();
         }
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR);
     }
     return $return;
 }
Example #14
0
 /**
  * 数据校验主方法
  * @param $mobile
  * @param $commId
  * @param $buildNum
  * @param $roomNum
  * @param $userId
  * @return int
  */
 private function mainVerification($mobile, $commId, $buildNum, $roomNum, $userId)
 {
     if (Const_Fyk::LIMIT_OF_PUBLISH > 0) {
         $isReach = Bll_Fyk_Prop_Action::getInstance()->isReachTheLimitOfPublish($userId, Const_Fyk::LIMIT_OF_PUBLISH);
         if ($isReach === true) {
             return 5;
         }
     }
     //$commInfo = Bll_Community_CommunityGardener::getCommunityInfoByCommunityId($commId);
     $commInfo = Bll_Community_APIComm::getInstance()->getInfoById($commId);
     $isReachTotal = Bll_Fyk_Prop_Action::getInstance()->isReachTheLimitOfTotalPublish($commInfo['city_id'], Const_Fyk::LIMIT_OF_TOTAL_PUBLISH);
     if ($isReachTotal === true) {
         return 6;
     }
     $isInVerification = Bll_Fyk_Prop_Action::getInstance()->isPublishPropInVerification($userId, $commId, $roomNum, $buildNum);
     if ($isInVerification === true) {
         return 7;
     }
     if (strlen($mobile) != 11) {
         return 4;
     }
     $isBrokerPhone = $this->isBrokerPhone($mobile);
     if ($isBrokerPhone === true) {
         return 1;
     }
     $isSameProp = $this->isSameProp($commId, $buildNum, $roomNum);
     if ($isSameProp === true) {
         return 2;
     }
     $isFalseProp = $this->isFalseProp($mobile, $commId, $buildNum, $roomNum);
     if ($isFalseProp === true) {
         return 3;
     }
     return 0;
 }
Example #15
0
 public function handle_request_internal()
 {
     $userId = $this->_params['userId'];
     $sinceId = isset($this->_params['sinceId']) ? $this->_params['sinceId'] : 0;
     $per = isset($this->_params['per']) ? $this->_params['per'] : 20;
     $per += 1;
     $hasNextPage = 0;
     $fPropId = array();
     $amountList = array();
     $logInfo = Bll_Fyk_Payment_Log::getInstance()->getLogInfoByUserIdOrderByIdDesc($userId, $per, $sinceId);
     if (!empty($logInfo)) {
         //判断是否有下一页
         if (isset($logInfo[$per - 1])) {
             $hasNextPage = 1;
             unset($logInfo[$per - 1]);
         }
         //房源数据获取
         foreach ($logInfo as $log) {
             $fPropId[] = $log['propId'];
         }
         $fPropId = array_unique($fPropId);
         $fPropInfo = Bll_Fyk_Prop_Manage::getInstance()->getPropInfo($fPropId);
         //获取app版本号
         $cv = 4.2;
         $chatInfos = Model_Mobile_BrokerChatInfo::getActiveBrokerIdsCV(array($this->_params['brokerId']));
         if (!empty($chatInfos)) {
             $chatInfo = $chatInfos[0];
             $response = Bll_Mobile_ChatInfoBll::getInstance()->apiGetChatInfoByCV($chatInfo['chatId']);
             $cv = $response['data']['result']['cv'];
         }
         //组装数据
         foreach ($logInfo as $log) {
             $list = array();
             $createTime = date('Y-m-d', $log['createTime']);
             list($comment, $content, $symbol, $clickAble) = $this->_loadingLogConfig(intval($log['type']));
             $amount = $this->_assemblyAmount($log['price'], $symbol);
             $type = $log['type'];
             $typeArr = array(Const_Fyk::THE_THIRD_PARTY_RECHARGE, Const_Fyk::THE_THIRD_PARTY_WITHDRAWAL, Const_Fyk::THE_THIRD_PARTY_WITHDRAWAL_FAILED);
             //4.3版本以下,做兼容处理 (支付宝提现,支付宝充值,支付宝提现失败,全部并入type=8)
             if ($cv < 4.3 && in_array($log['type'], $typeArr)) {
                 $type = 8;
             }
             $list['id'] = $log['id'];
             $list['amountType'] = $type;
             $list['comment'] = $comment;
             $list['content'] = $content;
             $list['amount'] = $amount;
             $list['amountUnit'] = '元';
             $list['fPropId'] = $log['propId'];
             $list['createTime'] = $createTime;
             $list['clickAble'] = $clickAble;
             $list['commName'] = '';
             $list['roomNum'] = '';
             $list['price'] = '';
             $list['priceUnit'] = '';
             $list['area'] = '';
             //获取房源基本信息
             if (empty($content)) {
                 if (!empty($fPropInfo[$log['propId']])) {
                     $commInfo = Bll_Community_APIComm::getInstance()->getInfoById($fPropInfo[$log['propId']]['commId']);
                     $list['commName'] = $commInfo['name'];
                     $list['roomNum'] = $fPropInfo[$log['propId']]['cell'];
                     $list['price'] = intval($fPropInfo[$log['propId']]['totalPrices']);
                     $list['priceUnit'] = '万';
                     $list['area'] = $fPropInfo[$log['propId']]['acreage'];
                 }
             }
             $amountList[] = $list;
         }
         //更新未读账户日志
         Bll_Fyk_Payment_Amount::getInstance()->updateUnReadNewAmountNum($userId);
     }
     $result = array('status' => 'ok', 'data' => array('amountList' => $amountList, 'hasNextPage' => $hasNextPage));
     return $result;
 }
Example #16
0
 public function handle_request()
 {
     $communityId = 1;
     $communityBaseInfo = Model_Community_AjkCommunity::getCommunityInfoById($communityId);
     //        echo Model_Community_AjkCommunity::data_access()->get_last_sql();
     //        print_r($communityBaseInfo);
     $communityList = Bll_Community_APIComm::getInstance()->getInfoById($communityId);
     //        print_r($communityList);
     $communityMapInfo = Model_Community_CommunityBaiDuMap::getCommunityMap($communityId);
     //        echo Model_Community_CommunityBaiDuMap::data_access()->get_last_sql();
     //        print_r($communityMapInfo);
     $commId = 1;
     $commIds = array(1);
     //        $commInfos = Model_Community_AjkCommunity::getInfoById($commIds);
     //        print_r($commInfos);
     //        $records = Model_Community_AjkCommunity::getRecordsById($commIds);
     //        print_r($records);
     //        $community = Model_Community_AjkCommunity::data_access()
     //            ->filter('commId', $communityId)
     //            ->find_only();
     //        print_r($community);
     $commInfo = Model_Community_AjkCommunity::getInfoById($commIds);
     $commInfo1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId);
     //        print_r($commInfo);
     //        print_r($commInfo1);
     //
     //        $communityBaseInfo = Model_Community_AjkCommunity::getCommunityInfoById($communityId);
     //        $communityExtendInfo = Model_Community_CommunityExtend::getCommunityExtendInfo($communityId);
     //        $communityMapInfo = Model_Community_CommunityBaiDuMap::getCommunityMap($communityId);
     //        $communityFrmInfo = Model_Community_CommunityFrm::getCommunityFrmByCommunityId($communityId);
     //        $result = array(
     //            'baseInfo' => $communityBaseInfo,
     //            'extendInfo' => $communityExtendInfo,
     //            'mapInfo' => $communityMapInfo,
     //            'frmInfo' => $communityFrmInfo,
     //        );
     //        print_r($result);
     $communityBaseInfo1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($communityId);
     $communityExtendInfo1 = Model_Community_CommunityExtend::getCommunityExtendInfo($communityId);
     $communityMapInfo1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapBaiDuMapping($communityId, 2);
     $communityFrmInfo1 = Model_Community_CommunityFrm::getCommunityFrmByCommunityId($communityId);
     $result1 = array('baseInfo' => $communityBaseInfo1, 'extendInfo' => $communityExtendInfo1, 'mapInfo' => $communityMapInfo1, 'frmInfo' => $communityFrmInfo1);
     //        print_r($result1);
     //                $community = Model_Community_AjkCommunity::data_access()
     //            ->filter('commId', $commId)
     //            ->find_only();
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId,2);
     //        $community = Bll_Community_APIComm::getInstance()->getInfoById($commId);
     //        $community = Model_Community_AjkCommunity::getInfoById($commIds);
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIds,2);
     //        $community = Model_Community_AjkCommunity::getInfoById($commIds);
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIds,2);
     $commIdStr = '1,2';
     $commIds = explode(',', $commIdStr);
     //        print_r($commIds);
     $community = Model_Community_AjkCommunity::getRecordsById($commIds);
     $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIds);
     //        $community = Dao_Comm_AjkCommunity::get_community_info_byids($commIds);
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIds);
     //        $community = Model_Community_AjkCommunity::data_access()
     //                ->filter('commId', $commId)
     //                ->find_only();
     //
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId,2);
     //        $community = Model_Community_AjkCommunity::getRecordsById($commId);
     //        $data['commLocation']= $commInfo->commLocal;
     //        $data['sosolat']= $commInfo->sosolat;//纬度
     //        $data['sosolng']= $commInfo->sosolng;//经度
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId,2);
     //        $community = Model_Community_AjkCommunity::data_access()
     //            ->filter('commId', $commId)
     //            ->find_only();
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId,2);
     //
     $community = Model_Community_AjkCommunity::data_access()->filter('commId', $commId)->find_only();
     $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId, 2);
     print_r($community);
     print_r($community1);
 }
Example #17
0
 public function handle_request_internal()
 {
     if (Bll_Weshop::weshopPropsIsMaintain()) {
         return array('status' => 'error', 'message' => "系统维护中,请稍后再试!");
     }
     //更新房源数据库
     //header('Content-Type: application/json; charset=utf-8');
     header("Access-Control-Allow-Origin: *");
     $brokerId = $this->_params['brokerId'];
     $data = $this->_params;
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     //获取房源信息
     $imageUrl = 'http://pages.anjukestatic.com/img/mobile/app/weshop_prop_default.jpg';
     $propId = $data['propId'];
     $oldPropInfo = Model_Weshop_Props::getWeshopProp($propId);
     if (empty($oldPropInfo)) {
         throw new Exception_Property_NotFound();
     }
     if ($oldPropInfo->brokerId != $brokerId) {
         throw new Exception_Prop_PropNotBelongBroker('brokerId' . $oldPropInfo->brokerId);
     }
     $images = json_decode($data['imageJson'], true);
     $outdoorImage = json_decode($data['outdoorImageJson'], true);
     if (count($images) > 8) {
         throw new Exception_Prop_PropImageBeyondLimit();
     }
     if (mb_strlen($data['propDescription'], 'utf-8') > 500) {
         throw new Exception_Prop_PropDescriptionBeyondLimit();
     }
     $tagIds = explode(',', $data['tagIds']);
     if (count($tagIds) > 4) {
         throw new Exception_Prop_PropTagsBeyondLimit();
     }
     //小区信息
     $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;
     $res = Model_Weshop_Props::updateWeshopProps($propId, $propInfo);
     if (!$res) {
         throw new Exception_Property_NotFound();
     } else {
         //比较图片是否有修改
         $oldImages = Model_Weshop_PropImages::getWeshopPropImages($propId);
         $oldImageHashAndHost = $oldOutImageHashAndHost = array();
         foreach ($oldImages as $img) {
             if ($img->imageType == 1) {
                 $oldImageHashAndHost[] = $img->imageHash;
                 $oldImageHashAndHost[] = $img->imageHostId;
             } elseif ($img->imageType == 2) {
                 $oldOutImageHashAndHost[] = $img->imageHash;
                 $oldOutImageHashAndHost[] = $img->imageHostId;
             }
         }
         $newImageHashAndHost = $newOutImageHashAndHost = array();
         foreach ($images as $img) {
             $newImageHashAndHost[] = $img['hash'];
             $newImageHashAndHost[] = $img['host'];
         }
         $newOutImageHashAndHost[] = $outdoorImage['hash'];
         $newOutImageHashAndHost[] = $outdoorImage['host'];
         $compareImages = $this->compareImages($oldImageHashAndHost, $newImageHashAndHost);
         //无论是否有图片的变化 一定返回室内图片的第一张 作为默认图在列表显示
         if ($images) {
             $imageUrl = str_replace("240", "240c", str_replace("display", "display/e", Util_ImageUtils::getResizeURL($images[0]['hash'], $images[0]['host'], 290, 240)));
         }
         //不同 室内图
         if (!$compareImages) {
             //删除老图片插入新图片
             foreach ($oldImages as $image) {
                 if ($image->imageType == 1) {
                     $image->isDelete = 1;
                     //删除
                     $image->save();
                 }
             }
             //插入新图片
             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;
                     $img_params['isDefault'] = $key == 0 ? 1 : 0;
                     $img_params['imageType'] = 1;
                     //室内图
                     $img_params['createTime'] = date('Y-m-d H:i:s', time());
                     $img_params['updateTime'] = date('Y-m-d H:i:s', time());
                     //存储新图片
                     Model_Weshop_PropImages::insertWeshopPropImages($img_params);
                 }
             }
         }
         $compareOutImages = $this->compareImages($oldOutImageHashAndHost, $newOutImageHashAndHost);
         //不同 房型图
         if (!$compareOutImages) {
             //删除老图片插入新图片
             foreach ($oldImages as $image) {
                 if ($image->imageType == 2) {
                     $image->isDelete = 1;
                     //删除
                     $image->save();
                 }
             }
             //插入新图片
             if ($outdoorImage) {
                 $img_params['propId'] = $propId;
                 $img_params['imageHostId'] = $outdoorImage['host'];
                 $img_params['imageHash'] = $outdoorImage['hash'];
                 $img_params['isDelete'] = 0;
                 $img_params['isDefault'] = 0;
                 $img_params['imageType'] = 2;
                 //户型图
                 $img_params['createTime'] = date('Y-m-d H:i:s', time());
                 $img_params['updateTime'] = date('Y-m-d H:i:s', time());
                 //存储新图片
                 Model_Weshop_PropImages::insertWeshopPropImages($img_params);
             }
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('imageUrl' => $imageUrl, 'message' => '保存成功'));
 }
Example #18
0
 public function getCommInfos($commIds)
 {
     $commInfos = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIds);
     $keyCommInfos = array();
     $areaIds = array();
     $blockIds = array();
     foreach ($commInfos as $commInfo) {
         $keyCommInfos[$commInfo['commId']] = $commInfo;
         $areaIds[] = substr($commInfo['areaCode'], 0, 8);
         $blockIds[] = $commInfo['areaCode'];
     }
     return array($keyCommInfos, $areaIds, $blockIds);
 }
Example #19
0
 /**
  * 获取经纪人目前发布过的小区
  *
  * @param int $brokerId
  * @return array
  */
 public static function getBrokerPublishCommunity($brokerId)
 {
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (is_null($brokerInfo) || empty($brokerInfo->PublishCName)) {
         return array();
     }
     $communityIds = explode(',', $brokerInfo->PublishCName);
     $lockedCommunityList = Model_Community_AjkCommunitysLock::getCommunityLockInfoByCommId($communityIds);
     if (!empty($lockedCommunityList)) {
         $tempCommunityIds = array();
         foreach ($lockedCommunityList as $lockedCommunity) {
             $tempCommunityIds[] = $lockedCommunity['commId'];
         }
         $communityIds = array_diff($communityIds, $tempCommunityIds);
     }
     $communityList = Bll_Community_APIComm::getInstance()->getInfoById($communityIds);
     $result = array();
     foreach ($communityList as $community) {
         if ($community['enabled'] == 0) {
             continue;
         }
         $result[] = $community;
     }
     return $result;
 }
Example #20
0
 public function NewTmp($data, $limit)
 {
     $operationMessage = APF::get_instance()->get_config('prop_operation_message', 'fyk_common');
     $statusMessage = APF::get_instance()->get_config('prop_status_message', 'fyk_common');
     $typeNeedToPay = APF::get_instance()->get_config('type_need_to_pay', 'fyk_common');
     $tmp = array();
     if (empty($data)) {
         return $tmp;
     }
     $i = 0;
     foreach ($data as $val) {
         $i++;
         if ($i > $limit && $limit) {
             continue;
         }
         //支付日期计算
         $paymentDays = '';
         //默认七天后到账
         $paymentDaysMsg = '';
         $isNeedToPay = 0;
         //是否为需要付款的操作类型
         if (in_array($val['type'], $typeNeedToPay) && $val['status'] == Model_Fyk_UserPropAction::STATUS_CHECKSUCCESS) {
             $isNeedToPay = 1;
             $paymentDays = 7;
             //默认七天后到账
             $paymentDaysMsg = '天后到账';
             //计算到账天数
             $updateTime = strtotime($val['updateTime']);
             $actionDate = strtotime(date('Y-m-d', $updateTime));
             $nowDate = strtotime(date('Y-m-d', time()));
             $actionDays = intval(($nowDate - $actionDate) / 86400);
             if ($actionDays < 1) {
                 $actionDays = 0;
             }
             $paymentDays -= $actionDays;
             if ($paymentDays < 1) {
                 $paymentDays = 0;
                 $paymentDaysMsg = '已到账';
             }
         }
         $temp = array();
         $temp['id'] = $val['id'];
         $temp['operationType'] = $val['type'];
         $temp['operationMessage'] = $operationMessage[$val['type']];
         $new = json_decode($val['body'], true);
         $commInfo = Bll_Community_APIComm::getInstance()->getInfoById($new['base']['commId']);
         $temp['commName'] = $commInfo['name'];
         $temp['commId'] = $new['base']['commId'];
         $temp['roomNum'] = $new['base']['cell'];
         $temp['hallNum'] = $new['base']['hall'];
         $temp['toiletNum'] = $new['base']['toilet'];
         $temp['price'] = intval($new['base']['totalPrices']);
         $temp['priceUnit'] = '万';
         $temp['area'] = $new['base']['acreage'];
         $checkMsg = json_decode($val['checkMsg'], true);
         if (empty($checkMsg['passedData'])) {
             $temp['falseMsg'] = '';
         } else {
             $temp['falseMsg'] = $checkMsg['passedData']['falseMsg'];
         }
         $temp['statusMessage'] = $statusMessage[$val['status']];
         $temp['status'] = $val['status'];
         $temp['createTime'] = date('Y-m-d', $val['createTime']);
         $temp['isNeedToPay'] = $isNeedToPay;
         $temp['paymentDays'] = $paymentDays;
         $temp['paymentDaysMsg'] = $paymentDaysMsg;
         $tmp[] = $temp;
     }
     return $tmp;
 }
Example #21
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;
 }
Example #22
0
 /**
  * 验证小区是否在经纪人所在的城市
  *
  * @param int $cityId
  * @param int $communityId
  * @return bool
  */
 public static function verifyCommunity($cityId, $communityId)
 {
     $communityInfo = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($communityId);
     if (!empty($communityInfo)) {
         return $cityId == $communityInfo['cityId'];
     }
     return false;
 }
Example #23
0
 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;
 }
Example #24
0
 /**
  * 拼接处罚原因的主干部分
  * @param $audit
  * @return string
  */
 private function _punishMsg($audit)
 {
     $checkMsg = json_decode($audit['checkMsg'], true);
     $propInfo = json_decode($audit['body'], true);
     $commInfo = Bll_Community_APIComm::getInstance()->getInfoById($propInfo['base']['commId']);
     $punishArr = APF::get_instance()->get_config('punish_reason', 'common');
     $message = $commInfo['name'] . '小区' . $punishArr[$checkMsg['passedData']['checkCode']];
     return $message;
 }
 /**
  * 获取多个小区的信息,返回值是以 小区ID 为键的数组
  *
  * @param array $communityIds
  * @param array $fields
  * @return array
  */
 public static function getMultiCommunityInfoByCommunityId($communityIds, $fields = array())
 {
     if (!empty($fields)) {
         $fields = array_unique(array_merge($fields, array('commId')));
     }
     //        $communityInfoList = Model_Community_AjkCommunity::getMultiCommunityInfoByIds($communityIds, $fields);
     $communityInfoList = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($communityIds);
     if (empty($communityInfoList)) {
         return $communityInfoList;
     }
     $ret = array();
     foreach ($communityInfoList as $communityInfo) {
         $ret[$communityInfo['commId']] = $communityInfo;
     }
     return $ret;
 }
Example #26
0
 /**
  * 根据多个小区id拼接的字符串获取小区名字
  *
  * @param $commIdStr
  */
 public function getCommName($commIdStr)
 {
     $commNameStr = '';
     if (empty($commIdStr)) {
         return $commNameStr;
     }
     $commIdArray = explode(',', $commIdStr);
     $records = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIdArray);
     if (empty($records)) {
         return $commNameStr;
     }
     $commNameArray = array();
     foreach ($records as $row) {
         $commNameArray[] = $row['commName'];
     }
     return implode(' ', $commNameArray);
 }
 /**
  * @param $commId
  * @return null
  */
 private function getCityIdByCommId($commId)
 {
     $res = Bll_Community_APIComm::getInstance()->getInfoById($commId);
     if ($res) {
         return $res['city_id'];
     } else {
         return null;
     }
 }
Example #28
0
 public function getCommLation($commIds)
 {
     if (!is_array($commIds)) {
         return array();
     }
     $commLoations = array();
     $commInfos = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIds, 2);
     foreach ($commInfos as $commInfo) {
         $commLoations[$commInfo['commId']] = $commInfo;
     }
     return $commLoations;
 }
Example #29
0
 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;
 }
Example #30
0
 public function handle_request_internal()
 {
     /**
      * 小区签到逻辑
      *
      * - 验证参数
      *
      * - 获取经纪人
      *
      * - 获取小区(AjkCommunity)
      * - 校验小区坐标和lat、lng的距离5公里(如小区无坐标,直接拒绝)
      *
      * - 添加签到记录
      *  - 添加签到记录
      *  - 更新签到按日统计信息(incr)
      *
      * - 更新经纪人坐标
      *  - 添加经纪人坐标日志
      *  - 更新经纪人坐标
      *
      * - 返回数据
      */
     $result = array('status' => 'error', 'errcode' => '', 'message' => '');
     // 获取参数
     $brokerId = $this->_params['brokerId'];
     $commId = $this->_params['commId'];
     $lat = $this->_params['lat'];
     $lng = $this->_params['lng'];
     if (empty($lat) || empty($lng)) {
         $result['message'] = '获取定位数据失败,请重新定位';
         return $result;
     }
     // 根据ID获取经纪人
     $broker = Bll_Commsign::getBrokerInfo($brokerId);
     if (!$broker) {
         $broker = Model_Broker_AjkBrokerExtend::data_access()->filter('brokerId', $brokerId)->find_only();
         if (!$broker) {
             throw new Exception('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
         }
         $broker_photo = Util_ImageUtils::get_broker_photo_url($broker['userPhoto'], '200x200');
         $brokerInfo = array('brokerId' => $broker['brokerId'], 'username' => $broker['trueName'], 'userPhoto' => $broker_photo, 'cityId' => $broker['cityId']);
         Bll_Commsign::redisBrokerInfo($brokerId, $brokerInfo);
     }
     // 根据ID获取小区
     $community = Bll_Commsign::getCommInfo($commId);
     if (empty($community)) {
         $community = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId, 2);
         $commInfo = array();
         $commInfo['commId'] = $community['commId'];
         $commInfo['commName'] = $community['commName'];
         $commInfo['sosolng'] = $community['sosolng'];
         $commInfo['sosolat'] = $community['sosolat'];
         Bll_Commsign::setCommInfo($commId, $commInfo);
     }
     // 小区不存在或小区经纬租表不存在时,返回小区不存在
     if (!$community || !$community['sosolat'] || !$community['sosolng']) {
         $result['errcode'] = Const_APIStatus::E_COMMUNITY_NOT_EXISTS;
         $result['message'] = '小区暂未开通签到功能';
         return $result;
     }
     // 对比小区坐标和参数坐标两点的距离(5km)
     $distance = Util_Map::distance($lat, $lng, $community['sosolat'], $community['sosolng']);
     if ($distance > 5000) {
         $result['errcode'] = Const_APIStatus::E_BROKER_COMMSIGN_FAR_AWAY;
         $result['message'] = '签到失败!你跑得太远了,请返回重新定位';
         return $result;
     }
     // 获取当前所处签到时间(10:00 15:00 20:00)
     $currentSignRange = Bll_Broker_CommunitySign::getCurrentSignRange();
     if (!$currentSignRange) {
         $result['errcode'] = Const_APIStatus::E_BROKER_COMMSIGN_NOT_IN_RANGE;
         $result['message'] = '不在签到时间范围';
         return $result;
     }
     // 判断是否已经签到
     if (Bll_Commsign::isSigned($brokerId, $commId, $currentSignRange[0])) {
         $result['errcode'] = Const_APIStatus::E_BROKER_COMMSIGN_ALREADY_SIGNED;
         $result['message'] = '已经签到!';
         return $result;
     }
     try {
         // 新建签到,
         $sign = array('brokerId' => $brokerId, 'communityId' => $commId, 'lat' => $lat, 'lng' => $lng, 'signTime' => date('Y-m-d H:i:s'), 'currentSignRange' => $currentSignRange[0]);
         Bll_Commsign::Signed($brokerId, $commId, $currentSignRange[0], $sign);
         //缓存‘签到信息’到同步数据库的redis中
         Bll_RedisToDb::writeBrokerCommunitySign($sign);
         // 缓存经纪人位置
         $locationInfo = array('brokerId' => $brokerId, 'lng' => $lng, 'lat' => $lat, 'updateTime' => date('Y-m-d H:i:s'));
         Bll_Commsign::setLocationInfo($brokerId, $locationInfo);
         //缓存‘位置信息’到同步数据库的redis中
         Bll_RedisToDb::writeBrokerLocation($locationInfo);
         //记录每日签到情况
         Bll_Commsign::dailySignedRecord($brokerId);
         // 获取签到排名
         $rank = Bll_Commsign::getSignRank($commId, $currentSignRange[0]);
         //连续签到统计
         $SignStatistics = Bll_Commsign::getSignStatistics($brokerId);
         $sendFlag = false;
         if ($SignStatistics) {
             if (date('Y-m-d', strtotime($SignStatistics['updateTime'])) == date('Y-m-d', strtotime('yesterday'))) {
                 $SignStatistics['signCount'] = $SignStatistics['signCount'] + 1;
                 $sendFlag = true;
             } elseif (date('Y-m-d', strtotime($SignStatistics['updateTime'])) == date('Y-m-d', time())) {
             } else {
                 $SignStatistics['signCount'] = 1;
                 $sendFlag = true;
             }
             if ($SignStatistics['signCount'] > $SignStatistics['maxSignCount']) {
                 $SignStatistics['maxSignCount'] = $SignStatistics['signCount'];
             }
             $SignStatistics['updateTime'] = date('Y-m-d H:i:s');
             Bll_Commsign::setSignStatistics($brokerId, $SignStatistics);
             //缓存‘签到统计信息’到同步数据库的redis中
             $SignStatistics = array_merge($SignStatistics, array('sendFlag' => $sendFlag));
             Bll_RedisToDb::writeCommSignStatistics($SignStatistics);
         } else {
             $SignStatistics = array('brokerId' => $brokerId, 'signCount' => 1, 'maxSignCount' => 1, 'createTime' => date('Y-m-d H:i:s'));
             Bll_Commsign::setSignStatistics($brokerId, $SignStatistics);
             $sendFlag = true;
             //缓存‘签到统计信息’到同步数据库的redis中
             $SignStatistics = array_merge($SignStatistics, array('sendFlag' => $sendFlag));
             Bll_RedisToDb::writeCommSignStatistics($SignStatistics);
         }
     } catch (Exception $e) {
         $result['message'] = '签到人太多,系统繁忙,请稍后再试~';
         return $result;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('signRank' => $rank, 'countDown' => Bll_Broker_CommunitySign::nextSignCountDown()));
 }