Beispiel #1
0
 /**
  * 获取房源默认图片
  *
  * @param int $houseId
  * @param array $baseImageInfo
  * @return string
  */
 private static function getThumbImageUrl($houseId, $baseImageInfo)
 {
     $houseDefaultImage = Bll_Ppc_ServiceAPI::getHouseDefaultImage($houseId);
     if (empty($houseDefaultImage)) {
         return static::getDefaultImageByBaseImage($baseImageInfo);
     }
     $imageDomain = APF::get_instance()->get_config('ImageDisplayURLBaseDomainDFS', 'image');
     /***  109X80    150X113 */
     if (!isset($houseDefaultImage['defImageInfoList']['defImageInfo']) || empty($houseDefaultImage['defImageInfoList']['defImageInfo'])) {
         return static::getDefaultImageByBaseImage($baseImageInfo);
     }
     $defaultImageInfo = $houseDefaultImage['defImageInfoList']['defImageInfo'][0];
     $defaultImageUrlInfo = explode(',', $defaultImageInfo['DEFIMAGE']);
     $hostId = 1;
     if (count($defaultImageUrlInfo) == 2) {
         list($hostId, $imageUrl) = $defaultImageUrlInfo;
     } else {
         return static::getDefaultImageByBaseImage($baseImageInfo);
     }
     //   'display/1c1a88a7e2ee70a694476c72f7a0dc07/420x315.jpg'
     // http://pic1.dfs.pg.anjuke.test/display/ce0ad50c22de0e757c177e1c7bcdef19/420x315.jpg
     $imageUrlParts = explode('/', $imageUrl);
     if (strlen($imageUrlParts[1]) == 32) {
         return sprintf('http://pic%d%s/display/%s/150x113.jpg', $hostId, $imageDomain, $imageUrlParts[1]);
     }
     return static::getDefaultImageByBaseImage($baseImageInfo);
 }