Ejemplo n.º 1
0
 /**
  * 页面参数post提交
  */
 public function handlePost()
 {
     $params = $this->requestObj->get_parameters();
     $params['ajkBrokerId'] = $this->ctx['ajkBrokerId'];
     $params['cityId'] = $this->ctx['cityId'];
     $propPostData = Bll_House_HzPublish::buildPropPostData($params);
     if (!$propPostData['status']) {
         $this->redirect2Result(Const_PublishCode::UNKNOWN_ERROR, $this->site, $this->action, $this->ctx['proId']);
     } else {
         $propPostData = $propPostData['msg'];
     }
     if ($this->ctx['isEdit']) {
         // 更新
         $propPostData['proid'] = $this->ctx['proId'];
         $result = Bll_House_HzHouse::updateHouse($propPostData);
         // 注入调试信息
         if ($this->ctx['debug'] && $this->ctx['debug'] == 'prop') {
             echo '房源更新' . PHP_EOL;
             echo 'post参数' . PHP_EOL;
             print_r($propPostData);
             echo 'api结果' . PHP_EOL;
             print_r($result);
             die;
         }
         if (!$result['status']) {
             $this->redirect2Result(Const_PublishCode::API_ERROR, $this->site, $this->action, $this->ctx['proId'], $result['msg']);
         }
     } else {
         // 发房
         $result = Bll_House_HzHouse::addHouse($propPostData);
         // 注入调试信息
         if ($this->ctx['debug'] && $this->ctx['debug'] == 'prop') {
             echo '房源发布' . PHP_EOL;
             echo 'post参数' . PHP_EOL;
             print_r($propPostData);
             echo 'api结果' . PHP_EOL;
             print_r($result);
             die;
         }
         if (!$result['status']) {
             $this->redirect2Result(Const_PublishCode::API_ERROR, $this->site, $this->action, $this->ctx['proId'], $result['msg']);
         } else {
             $this->ctx['proId'] = $result['msg']['proid'];
         }
     }
     // 图片数据预处理
     $postApiImages = Bll_House_HzPublish::buildPostImagesForApi($params, $this->ctx['images']);
     // 兼容图片全部删除的问题
     if ($postApiImages) {
         // 图片请求api
         $addImageResult = Bll_Image_HzHouseImage::addImage($this->ctx['ajkBrokerId'], $this->ctx['proId'], $postApiImages);
         // 注入调试信息
         if ($this->ctx['debug'] && $this->ctx['debug'] == 'image') {
             echo '图片请求' . PHP_EOL;
             echo 'post参数' . PHP_EOL;
             print_r($postApiImages);
             echo 'api结果' . PHP_EOL;
             print_r($addImageResult);
             die;
         }
         if (!$addImageResult['status']) {
             $this->redirect2Result(Const_PublishCode::HOUSE_SAVE_SUCCESS, $this->site, $this->action, $this->ctx['proId'], $addImageResult['msg']);
         }
     }
     $this->ctx['html_action'] = $params['html_action'];
     return true;
 }
Ejemplo n.º 2
0
 /**
  * 中介图片地址拼接
  * @param $hostid	图片hostid
  * @param $filename	图片地址
  * @param $flg		old:images1 ; new:pic1
  * @params int $brokerid 在pic域名下的房源图片打印经纪人名水印
  */
 public static function get_dfs_url($hostid, $filename, $flg = 'new', $brokerid = '')
 {
     if ('new' == $flg) {
         // Bll_Image_HzHouseImage::getGenerateImgUrlBaseDomain()
         $img_domain = APF::get_instance()->get_config("pic_server_domain");
         //$base_domain	= APF::get_instance()->get_config("pic_server_base_domain");
         $base_domain = Bll_Image_HzHouseImage::getGenerateImgUrlBaseDomain();
         $filename = preg_replace("/(.*)(display)(.*)/", '$1display/hz$3', $filename);
     } elseif ('old' == $flg) {
         $img_domain = APF::get_instance()->get_config("ajk_image_server_domain", 'ajkconfig');
         $base_domain = APF::get_instance()->get_config("ajk_image_server_base_domain", 'ajkconfig');
         $base_domain = substr($base_domain, 1);
         $filename = preg_replace('/(http:\\/\\/.*\\/)?(property|community)(.*)/', '$1haozu/$2$3', $filename);
     }
     $url = "http://" . $img_domain . $hostid . "." . $base_domain . "/" . $filename;
     if ($brokerid && 'new' == $flg) {
         $url = preg_replace("/(.*)(display)\\/(.*)\\/(.*)/", '$1display/$3_' . $brokerid . '/$4', $url);
     }
     return $url;
 }
Ejemplo n.º 3
0
 /**
  * 获取图库 (对外)
  * @param $type 1:小区相册图片;2:小区房型图
  * @param $commId
  * @param $roomNum
  * @param $limit
  * @return array
  */
 public static function getCommPic($type, $commId, $roomNum, $limit = 20)
 {
     $list = array('COMMPIC' => array(), 'MODELPIC' => array());
     if ($type == 1 || $type == 'all') {
         if ($list['COMMPIC'] = Bll_Image_HzHouseImage::getCommAlbum($commId, 1, $limit)) {
             foreach ($list['COMMPIC'] as $k => $image) {
                 $list['COMMPIC'][$k]['IMGURL'] = $image['smallSrc'];
                 $list['COMMPIC'][$k]['AID'] = $image['info']['aid'];
                 $list['COMMPIC'][$k]['BIGIMGURL'] = $image['bigSrc'];
                 $list['COMMPIC'][$k]['commPicId'] = $image['aid'];
             }
         }
     }
     if (($type == 2 || $type == 'all') && !$roomNum) {
         if ($list['MODELPIC'] = Bll_Image_HzHouseImage::getCommAlbum($commId, 2, $limit)) {
             foreach ($list['MODELPIC'] as $k => $image) {
                 $list['MODELPIC'][$k]['IMGURL'] = $image['smallSrc'];
                 $list['MODELPIC'][$k]['AID'] = $image['info']['aid'];
                 $list['MODELPIC'][$k]['BIGIMGURL'] = $image['bigSrc'];
                 $list['MODELPIC'][$k]['commPicId'] = $image['aid'];
             }
         }
     }
     if (($type == 2 || $type == 'all') && $roomNum > 0) {
         if ($list['MODELPIC'] = Bll_Image_HzHouseImage::getCommRoomImg($commId, $roomNum, $limit)) {
             foreach ($list['MODELPIC'] as $k => $image) {
                 $list['MODELPIC'][$k]['IMGURL'] = $image['smallSrc'];
                 $list['MODELPIC'][$k]['AID'] = $image['info']['aid'];
                 $list['MODELPIC'][$k]['BIGIMGURL'] = $image['bigSrc'];
                 $list['MODELPIC'][$k]['commPicId'] = $image['aid'];
             }
         }
     }
     return $list;
 }
Ejemplo n.º 4
0
 /**
  * 获取公共图库
  * type 1:小区相册图片;2:小区房型图
  * @return array
  */
 public function do_getCommPic()
 {
     $list = Bll_Image_HzHouseImage::getCommPic($this->params['type'], $this->params['commId'], (int) $this->params['roomNum']);
     return Util_GlobalFunc::buildReturn(1, $list);
 }
Ejemplo n.º 5
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;
 }