Ejemplo n.º 1
0
 public function handle_request_internal()
 {
     $this->communityId = $this->getCommunityId();
     $this->setAttribute('show_searchbar', false);
     /** 判断小区地图是都已经锁定 */
     $this->isLockMap = Bll_Community_CommunityGardener::checkCommunityMapIsLock($this->communityId);
     $this->setAttribute('isLockMap', $this->isLockMap);
     /** 获取小区当前的图片数量 */
     $this->communityImageCount = self::COMMUNITY_PHOTO_COUNT - intval(Model_Community_Attachment::getCommunityPictureCount($this->communityId));
     $this->setAttribute('brokerShouldUploadPhotoCount', $this->communityImageCount);
     /** 获取小区详细信息 */
     $this->communityInfo = Bll_Community_CommunityGardener::getCommunityDetail($this->communityId);
     /** 如果是隐藏小区,那么就直接跳转到小区详情页 */
     $this->isHiddenCommunity($this->communityInfo);
     $communityWikiInfo = Bll_Community_CommunityGardener::getCommunityWikiInfo($this->communityId);
     if (!empty($communityWikiInfo)) {
         $this->baseInfoIsLocked = true;
         for ($fieldIndex = 2; $fieldIndex < 15; $fieldIndex++) {
             if (!isset($communityWikiInfo[$fieldIndex]) || $communityWikiInfo[$fieldIndex] == 1) {
                 $this->baseInfoIsLocked = false;
                 break;
             }
         }
     }
     $this->setAttribute('baseInfoIsLocked', $this->baseInfoIsLocked);
     /** TODO 判断是否是完善小区 */
     if (Bll_Community_CommunityGardener::checkCommunityIsComplete($this->communityInfo)) {
         $this->setAttribute('isOk', 3);
         return 'Community_Gardener_PhotoCommitOk';
     }
     /** 验证码 */
     $this->verifyCode = Bll_Community_CommunityGardener::getVerifyCode($this->communityId, static::$intBrokerID);
     $this->setAttribute('verify', $this->verifyCode);
     /** TODO 判断小区园丁申请是否有效 */
     if (!$this->checkApplyIsValid($this->communityId, static::$intBrokerID, $this->getParameter('verify'))) {
         $this->setAttribute('isOk', 2);
         return 'Community_Gardener_PhotoCommitOk';
     }
     /** TODO 过滤小区信息 */
     /** TODO 初始化小区信息 */
     $this->setAttributes($this->communityInfo);
     $this->setAttribute('commId', $this->communityId);
     return $this->handle_request_abs();
 }
Ejemplo n.º 2
0
 /**
  * @param array $communityIds 小区编号
  */
 protected function getCommunityImageUrls($communityIds)
 {
     if (empty($communityIds)) {
         return array();
     }
     // ID去重
     $communityIds = array_flip(array_flip($communityIds));
     $communityImages = Model_Community_Attachment::data_access()->load_field(array('commId', 'fileName', 'hostId'))->filter('commId', $communityIds)->filter('imageSign', Model_Community_Attachment::IMAGE_SIGN_COMMUNITY)->filter('isDefault', Model_Community_Attachment::DEFAULT_YES)->find_all();
     $communityImageUrls = array();
     foreach ($communityImages as $communityImage) {
         $communityImageUrls[$communityImage->commId] = Util_ImageUtils::format_commpicurl_to_larger(Util_ImageUtils::convert_community_image2urlLarge($communityImage->fileName, $communityImage->hostId));
     }
     foreach ($communityIds as $communityId) {
         if (!isset($communityImageUrls[$communityId])) {
             $communityImageUrls[$communityId] = 'http://pages.anjukestatic.com/img/global/nopic2_385x240.gif';
         }
     }
     return $communityImageUrls;
 }
Ejemplo n.º 3
0
 /**
  * 判断小区是否是完善小区
  *
  * @param array $communityInfo
  * @return bool
  */
 public static function checkCommunityIsComplete($communityInfo)
 {
     $checkCommunityCompleteFields = array('baseInfo' => array('commLocal', 'useType'), 'extendInfo' => array('commBuilder', 'manageCompany', 'managePay', 'buildArea', 'carbarnState', 'containPert', 'greenPert', 'houseTotal', 'sendDate', 'commIntro', 'commOther'));
     $lockMapping = array('commOtherName' => 1, 'commLocal' => 2, 'useType' => 3, 'commBuilder' => 4, 'manageCompany' => 5, 'managePay' => 6, 'buildArea' => 7, 'carbarnState' => 8, 'containPert' => 9, 'greenPert' => 10, 'houseTotal' => 11, 'sendDate' => 12, 'commIntro' => 13, 'commOther' => 14);
     $communityId = $communityInfo['baseInfo']['commId'];
     $communityLockInfo = Bll_Community_CommunityGardener::getCommunityWikiInfo($communityId);
     foreach ($checkCommunityCompleteFields as $infoType => $checkFields) {
         if (!isset($communityInfo[$infoType]) || empty($communityInfo[$infoType]) || !is_array($communityInfo[$infoType])) {
             return false;
         }
         foreach ($checkFields as $checkField) {
             if (isset($communityLockInfo[$lockMapping[$checkField]]) && $communityLockInfo[$lockMapping[$checkField]] != 1) {
                 continue;
             }
             if (!isset($communityInfo[$infoType][$checkField]) || empty($communityInfo[$infoType][$checkField])) {
                 return false;
             }
         }
     }
     /** 判断小区图片是否满10张 */
     $communityImageCount = Model_Community_Attachment::getCommunityPictureCount($communityId);
     if ($communityImageCount < 10) {
         return false;
     }
     return true;
 }
Ejemplo n.º 4
0
 public function handle_request_internal()
 {
     $request = APF::get_instance()->get_request();
     $params = $request->get_parameters();
     $fields = array('commId', 'roomNum', 'hallNum', 'toiletNum', 'houseOri');
     $apiParams = array();
     foreach ($fields as $field) {
         if (!isset($params[$field])) {
             $this->responseJSON('error', array(), '参数不全');
             return;
         }
         $apiParams[$field] = $params[$field];
     }
     $data = array('MODELPIC' => array(), 'COMMPIC' => array());
     $apiParams['houseOri'] = Bll_House_EsfPublish::getPropOrigin($apiParams['houseOri']);
     try {
         /**
          * @var $result Bll_Service_Client_HttpResponse
          */
         $result = Bll_Service_Image::esfGetImgInfo($apiParams);
         if ($result->isFailed()) {
             $this->responseJSON('error', $data, '调用API超时');
             return;
         }
         if ($result['status'] != 'ok') {
             $this->responseJSON('error', $data, '调用API失败');
             return;
         }
         /** 房型图 */
         $modelPicAIds = array();
         if (isset($result['publicPicResult']['fineImg']['count']) && isset($result['publicPicResult']['fineImg']['list'])) {
             foreach ($result['publicPicResult']['fineImg']['list'] as $imageInfo) {
                 $modelPicAIds[] = $imageInfo['Aid'];
             }
         }
         if (isset($result['publicPicResult']['readyImg']['count']) && isset($result['publicPicResult']['readyImg']['list'])) {
             foreach ($result['publicPicResult']['readyImg']['list'] as $imageInfo) {
                 $modelPicAIds[] = $imageInfo['Aid'];
             }
         }
         if (!empty($modelPicAIds)) {
             $modelImageList = Model_Community_Attachment::getImageInfoById($modelPicAIds, array('aid', 'fileName', 'hostId'));
             foreach ($modelImageList as $imageInfo) {
                 $imageInfo['AID'] = intval($imageInfo['aid']);
                 $imageInfo['commPicId'] = intval($imageInfo['aid']);
                 $imageInfo['IMGURL'] = Util_ImageUtils::getResizeURL($imageInfo['fileName'], $imageInfo['hostId'], 100, 75);
                 $imageInfo['BIGIMGURL'] = Util_ImageUtils::getResizeURL($imageInfo['fileName'], $imageInfo['hostId'], 600, 600);
                 $data['MODELPIC'][] = $imageInfo;
             }
         }
         if (isset($result['publicPicResult']['othResult']['count']) && isset($result['publicPicResult']['othResult']['attachmentsComm'])) {
             foreach ($result['publicPicResult']['othResult']['attachmentsComm'] as $imageInfo) {
                 $imageInfo['AID'] = intval($imageInfo['Aid']);
                 $imageInfo['commPicId'] = intval($imageInfo['Aid']);
                 $imageInfo['IMGURL'] = Util_ImageUtils::getResizeURL($imageInfo['FileName'], $imageInfo['host_id'], 100, 75);
                 $imageInfo['BIGIMGURL'] = Util_ImageUtils::getResizeURL($imageInfo['FileName'], $imageInfo['host_id'], 600, 600);
                 $data['MODELPIC'][] = $imageInfo;
             }
         }
         /** 小区图 */
         if (isset($result['publicPicResult']['commPic']['count']) && isset($result['publicPicResult']['commPic']['attachmentsComm'])) {
             foreach ($result['publicPicResult']['commPic']['attachmentsComm'] as $imageInfo) {
                 $imageInfo['AID'] = intval($imageInfo['Aid']);
                 $imageInfo['commPicId'] = intval($imageInfo['Aid']);
                 $imageInfo['IMGURL'] = Util_ImageUtils::getResizeURL($imageInfo['FileName'], $imageInfo['host_id'], 100, 75);
                 $imageInfo['BIGIMGURL'] = Util_ImageUtils::getResizeURL($imageInfo['FileName'], $imageInfo['host_id'], 600, 600);
                 $data['COMMPIC'][] = $imageInfo;
             }
         }
         $data['MODELPIC'] = array_slice($data['MODELPIC'], 0, 10);
         $data['COMMPIC'] = array_slice($data['COMMPIC'], 0, 20);
         $this->responseJSON('ok', $data, '');
     } catch (Exception $e) {
         $this->responseJSON('error', $data, $e->getMessage());
     }
 }
Ejemplo n.º 5
0
 /**
  * 取得小区相册图片
  * @param $commId
  * @param $type 1:小区相册图片;2:小区房型图
  *              (二手房type)  =》 对应好租的
  *              $p_type    = (1 == $type) ? 3 : 2;
  * @param $limit
  * @return array
  */
 public static function getCommAlbum($commId, $type = 1, $limit = 20)
 {
     $minPKID = APF::get_instance()->get_config("min_haozu_comm_img_id", "image");
     $images = Model_Community_Attachment::getLists(array(array('visibility', '=', 1), array('commId', '=', $commId), array('imageSign', '=', $type), array('aid', '>', $minPKID)), $limit);
     $result = array();
     $resultImgs = array();
     foreach ($images as $image) {
         $result[] = array('hostid' => $image['host_id'], 'filename' => $image['filename']);
         if (isset($image['updatedDatetime'])) {
             unset($image['updatedDatetime']);
         }
         if (isset($image['imgDesc'])) {
             unset($image['imgDesc']);
         }
         $resultImgs[] = array('smallSrc' => Bll_Image_UtilsImage::show_a_img_size($image['hostId'], $image['fileName'], $commId, 'small'), 'bigSrc' => Bll_Image_UtilsImage::show_a_img_size($image['hostId'], $image['fileName'], $commId, 'big'), 'info' => $image, 'aid' => $image['aid'], 'commPicId' => $image['aid']);
     }
     return empty($resultImgs) ? $result : $resultImgs;
 }
Ejemplo n.º 6
0
 /**
  * 获取房源图片信息
  *
  * @param int $brokerId
  * @param int $houseId
  * @return array
  */
 public static function getHouseImage($brokerId, $houseId)
 {
     $result = array('COMMPIC' => array(), 'MODELPIC' => array(), 'SELCOMM' => array(), 'SELMODEL' => array(), 'UPDCOMM' => array(), 'UPDMODEL' => array(), 'UPDROOM' => array(), 'DEFAULTIMGID' => '', 'ALLCOMM' => array(), 'ALLMODEL' => array());
     $apiResult = Bll_Service_House_EsfHouseInfo::getHouseImage($houseId);
     if ($apiResult->isFailed()) {
         return $result;
     }
     if ($apiResult['status'] != 'ok') {
         return $result;
     }
     $houseBaseInfo = $apiResult['property'];
     if ($houseBaseInfo['BrokerId'] != $brokerId) {
         return $result;
     }
     /** 房型图 ** 开始 */
     $modelPicIds = array();
     /** 精选图 */
     if (isset($apiResult['publicPicResult']['fineImg']['list'])) {
         foreach ($apiResult['publicPicResult']['fineImg']['list'] as $val) {
             $modelPicIds[] = $val;
         }
     }
     /** 备选图 */
     if (isset($apiResult['publicPicResult']['readyImg']['list'])) {
         foreach ($apiResult['publicPicResult']['readyImg']['list'] as $val) {
             $modelPicIds[] = $val;
         }
     }
     $modelImageList = array();
     $modelImageIds = array();
     if (!empty($modelPicIds)) {
         $modelImageList = Model_Community_Attachment::getImageInfoById($modelPicIds);
     }
     if (empty($modelImageList)) {
         if (isset($apiResult['publicPicResult']['othResult']['attachmentsComm'])) {
             $modelImageList = $apiResult['publicPicResult']['othResult']['attachmentsComm'];
         }
     }
     foreach ($modelImageList as &$modelImage) {
         if (empty($modelImage['FileName'])) {
             continue;
         }
         $modelImage['imageId'] = isset($modelImage['aid']) ? $modelImage['aid'] : $modelImage['AId'];
         $modelImage['url'] = Util_ImageUtils::getResizeURL($modelImage['FileName'], $modelImage['host_id'], 100, 75);
         $modelImage['bigImageUrl'] = Util_ImageUtils::getResizeURL($modelImage['FileName'], $modelImage['host_id'], 600, 600);
         $modelImageIds[] = $modelImage['imageId'];
     }
     unset($modelImage);
     $result['MODELPIC'] = array_slice($modelImageList, 0, 10);
     /** 房型图 ** 结束 */
     $sideOther = explode(',', $houseBaseInfo['SideOther'] . ',,,', 4);
     list($communityImageIds, $roomImageIds, $modelImageIds) = $sideOther;
     $communityImageIds = explode('|', $communityImageIds);
     $roomImageIds = explode('|', $roomImageIds);
     $modelImageIds = explode('|', $modelImageIds);
     $communityImageOrder = array();
     $roomImageOrder = array();
     $modelImageOrder = array();
     /** 小区排序 */
     for ($i = count($communityImageIds); $i > 0; $i--) {
         $imageId = $communityImageIds[$i - 1];
         $communityImageOrder[$imageId] = $i;
     }
     /** 室内图排序 */
     for ($i = count($roomImageIds); $i > 0; $i--) {
         $imageId = $roomImageIds[$i - 1];
         $roomImageOrder[$imageId] = $i;
     }
     /** 户型图排序 */
     for ($i = count($modelImageIds); $i > 0; $i--) {
         $imageId = $modelImageIds[$i - 1];
         $modelImageOrder[$imageId] = $i;
     }
     $defaultImageId = 0;
     $communityImageList = array();
     $roomImageList = array();
     $modelImageList = array();
     $selectCommunityImageList = array();
     $selectCommunityImageIds = array();
     $selectModelImageList = array();
     $selectModelImageIds = array();
     if (isset($apiResult['attachments']['attachments'])) {
         foreach ($apiResult['attachments']['attachments'] as $imageInfo) {
             if (empty($imageInfo['FileName'])) {
                 continue;
             }
             if ($imageInfo['IsSel']) {
                 $defaultImageId = $imageInfo['AId'];
             }
             $imageInfo['imageId'] = $imageInfo['AId'];
             $imageInfo['AID'] = $imageInfo['AId'];
             $imageInfo['url'] = Util_ImageUtils::getResizeURL($imageInfo['FileName'], $imageInfo['host_id'], 100, 75);
             $imageInfo['bigImageUrl'] = Util_ImageUtils::getResizeURL($imageInfo['FileName'], $imageInfo['host_id'], 600, 600);
             /** 小区图 */
             if ($imageInfo['DataType'] == 1) {
                 if ($imageInfo['CommPicId'] == 0 && isset($communityImageOrder[$imageInfo['imageId']])) {
                     $imageInfo['order'] = $communityImageOrder[$imageInfo['imageId']];
                     $communityImageList[$imageInfo['AId']] = $imageInfo;
                 } elseif (isset($communityImageOrder[$imageInfo['CommPicId']])) {
                     $imageInfo['order'] = $communityImageOrder[$imageInfo['CommPicId']];
                     $selectCommunityImageList[$imageInfo['CommPicId']] = $imageInfo;
                     $selectCommunityImageIds[] = $imageInfo['AId'];
                 }
             }
             /** 室内图 */
             if ($imageInfo['DataType'] == 2 && isset($roomImageOrder[$imageInfo['imageId']])) {
                 $imageInfo['order'] = $roomImageOrder[$imageInfo['imageId']];
                 $roomImageList[$imageInfo['AId']] = $imageInfo;
             }
             /** 房型图 */
             if ($imageInfo['DataType'] == 3) {
                 if ($imageInfo['CommPicId'] == 0 && isset($modelImageOrder[$imageInfo['imageId']])) {
                     $imageInfo['order'] = $modelImageOrder[$imageInfo['imageId']];
                     $modelImageList[$imageInfo['AId']] = $imageInfo;
                 } elseif (isset($modelImageOrder[$imageInfo['CommPicId']])) {
                     $imageInfo['order'] = $modelImageOrder[$imageInfo['CommPicId']];
                     $selectModelImageList[$imageInfo['CommPicId']] = $imageInfo;
                     $selectModelImageIds[] = $imageInfo['AId'];
                 }
             }
         }
     }
     $result['UPDCOMM'] = static::sortImage($communityImageList);
     $result['UPDMODEL'] = static::sortImage($modelImageList);
     $result['UPDROOM'] = static::sortImage($roomImageList);
     $result['SELCOMM'] = static::sortImage($selectCommunityImageList);
     $result['SELMODEL'] = static::sortImage($selectModelImageList);
     $result['ALLCOMM'] = static::sortImage(array_merge($communityImageList, $selectCommunityImageList));
     $result['ALLMODEL'] = static::sortImage(array_merge($modelImageList, $selectModelImageList));
     $result['DEFAULTIMGID'] = $defaultImageId;
     return $result;
 }