Esempio n. 1
0
 public function imageUrl()
 {
     $ajkcid = intval($this->ajkcid);
     if ($ajkcid > 0) {
         $b_src = Bll_Image_UtilsImage::show_a_img_size($this->hostid, $this->imageid, $ajkcid, '420x315');
     } else {
         $config = APF::get_instance()->get_config('hz', 'image', array('format_host' => 'pic%d.ajkimg.com', 'path_prefix' => '/display/hz/'));
         $host = sprintf($config['format_host'], $this->hostid);
         $path = $config['path_prefix'] . $this->imageid . '/420x315.jpg';
         $b_src = 'http://' . $host . $path;
     }
     return $b_src;
 }
Esempio n. 2
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;
 }
Esempio n. 3
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;
 }
Esempio n. 4
0
 /**
  * @param $images
  * @return array
  */
 public static function buildImagesForPage($images)
 {
     $picData = array('UPDROOM' => array(), 'ALLMODEL' => array(), 'ALLCOMM' => array(), 'defaultImgID' => 0);
     if (empty($images)) {
         return $picData;
     }
     $defaultImgID = 0;
     foreach ($images as $img) {
         $ajkcid = intval($img['ajkcid']);
         //$params['upload_imgs'][] = $ajkcid . '*' . $img['type'] . '*' . $img['hostid'] . '*' . $img['imageid'];
         if ($ajkcid > 0) {
             $s_src = Bll_Image_UtilsImage::show_a_img_size($img['hostid'], $img['imageid'], $ajkcid, 'small');
         } else {
             $s_src = 'http://pic' . $img['hostid'] . '.' . Bll_Image_HzHouseImage::getGenerateImgUrlBaseDomain() . '/display/hz/' . $img['imageid'] . '/100x75c.jpg';
         }
         if ($img['type'] == 1) {
             $prefix = 'UPDROOM';
         } elseif ($img['type'] == 2) {
             $prefix = 'ALLMODEL';
         } else {
             $prefix = 'ALLCOMM';
         }
         $tmp = array('AID' => $img['imageid'], 'url' => $s_src, 'type' => $img['type'], 'commId' => $ajkcid ? $ajkcid : 0, 'imageId' => $img['imageid'], 'ajkCid' => $ajkcid, 'isDefault' => $img['default'], 'hostId' => $img['hostid']);
         // 模拟上传参数
         if ($img['ajkcid'] > 0) {
             $tmp = array_merge($tmp, array('commPicId' => $img['ajkcid']));
         } else {
             $tmp = array_merge($tmp, array('id' => $img['imageid'], 'hash' => $img['hostid'], 'host' => $img['hostid'], 'exists' => $img['md5_exists'], 'exif' => serialize(array('copyright' => $img['exif_exists']['copyright'], 'dateTime' => $img['exif_exists']['dateTime'], 'fileDateTime' => $img['exif_exists']['fileDateTime'], 'fileSize' => $img['exif_exists']['fileSize'], "make" => $img['exif_exists']['make'], "model" => $img['exif_exists']['model'], "memo" => "", "mimeType" => $img['exif_exists']['mimeType'], "software" => $img['exif_exists']['software'], "xResolution" => $img['exif_exists']['xResolution'], "yResolution" => $img['exif_exists']['yResolution']))));
         }
         $picData[$prefix][] = $tmp;
         if ($img['default']) {
             $defaultImgID = $img['imageid'];
         }
     }
     $picData['defaultImgID'] = $defaultImgID;
     return $picData;
 }
Esempio n. 5
0
 /**
  * 房源默认图片 (默认优先封面图 -》 第一张室内图 -》 房型)
  * @param $propImage
  * @return mixed|string
  */
 private static function getThumbImg($propImage)
 {
     $src = '';
     $imgObj = '';
     if (isset($propImage['roomImg']) && count($propImage['roomImg']) > 0) {
         foreach ($propImage['roomImg'] as $roomImg) {
             if ($roomImg['default'] == 1) {
                 $imgObj = $roomImg;
                 break;
             }
         }
         // 没有默认显示第一张
         if (!$imgObj) {
             $imgObj = $propImage['roomImg'][0];
         }
     }
     if (!$imgObj && isset($propImage['moduleImg']) && count($propImage['moduleImg']) > 0) {
         foreach ($propImage['moduleImg'] as $moduleImg) {
             if ($moduleImg['default'] == 1) {
                 $imgObj = $moduleImg;
                 break;
             }
         }
         // 没有默认显示第一张
         if (!$imgObj) {
             $imgObj = $propImage['moduleImg'][0];
         }
     }
     if (!$imgObj && isset($propImage['commImg']) && count($propImage['commImg']) > 0) {
         foreach ($propImage['commImg'] as $commImg) {
             if ($commImg['default'] == 1) {
                 $imgObj = $commImg;
                 break;
             }
         }
         // 没有默认显示第一张
         if (!$imgObj) {
             $imgObj = $propImage['commImg'][0];
         }
     }
     if ($imgObj) {
         $ajkcid = $imgObj['ajkcid'];
         if ($ajkcid > 0) {
             $src = Bll_Image_UtilsImage::show_a_img_size($imgObj['hostid'], $imgObj['imageid'], $ajkcid, '420x315');
         } else {
             // pg:
             // http://pic1.dfs.pg.anjuke.test/display/hz/8c52b6ec43e292ca7457d14c65233c1c/420x315.jpg
             $src = 'http://pic' . $imgObj['hostid'] . '.ajkimg.com/display/hz/' . $imgObj['imageid'] . '/420x315.jpg';
         }
     }
     $src = empty($src) ? 'http://pages.anjukestatic.com/img/global/nopic_150x113.gif' : $src;
     return $src;
 }
Esempio n. 6
0
 /**
  * 获取房源默认图片
  * @param $proId
  * @return mixed|string
  */
 public static function getPropDefaultImgWithUrl($proId)
 {
     $src = '';
     $imgObj = Model_Image_HzImage::getDefaultImageByHouseId($proId);
     if ($imgObj) {
         $ajkcid = (int) $imgObj->ajkcid;
         if ($ajkcid > 0) {
             $src = Bll_Image_UtilsImage::show_a_img_size($imgObj->hostid, $imgObj->imageid, $ajkcid, '420x315');
         } else {
             $src = 'http://pic' . $imgObj->hostid . '.ajkimg.com/display/hz/' . $imgObj->imageid . '/420x315.jpg';
         }
     }
     $src = empty($src) ? 'http://pages.anjukestatic.com/img/global/nopic_150x113.gif' : $src;
     return $src;
 }