public function handle_request_internal() { $request = APF::get_instance()->get_request(); $params = $request->get_parameters(); $fields = array('commId', 'roomNum', 'fitmentId', 'area'); $apiParams = array('cityId' => static::$intBrokerCityID, 'brokerId' => static::$intBrokerID, 'operateState' => 1); foreach ($fields as $field) { if (!isset($params[$field]) || $params[$field] == '') { $this->responseJSON('error', array(), '参数不全'); return; } $apiParams[$field] = $params[$field]; } try { /** * @var $result Bll_Service_Client_HttpResponse */ $result = Bll_Service_Image::repeatImgMd5ByBrokerId($apiParams); $data = array(); if ($result->isFailed()) { $this->responseJSON('error', $data, '调用API超时'); return; } if ($result['status'] != 'ok') { $this->responseJSON('error', $data, '调用API失败'); return; } foreach ($result['imgMd5'] as $imgMd5) { $pathPart = explode('/', $imgMd5['path']); if (isset($pathPart[1]) && strlen($pathPart[1])) { $data[$pathPart[1]] = 1; } } $this->responseJSON('ok', $data, ''); } catch (Exception $e) { $this->responseJSON('error', array(), '参数错误'); } }
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()); } }
/** * 设置默认房源图片 * @param $ajkBrokerId * @param $aid * @param int $tradeType * @return array */ public static function setDefaultImage($ajkBrokerId, $aid, $tradeType = 2) { $response = Bll_Service_Image::hzSetDefaultImage(array('brokerid' => $ajkBrokerId, 'aid' => $aid, 'tradeType' => $tradeType)); if ($response->isFailed()) { return Util_GlobalFunc::buildReturn(0, '设置默认房源图片失败,请求内部API失败.'); } if ($response['status'] == 'error') { return Util_GlobalFunc::buildReturn(0, '设置默认房源图片失败,' . $response['info']); } return Util_GlobalFunc::buildReturn(1, 'success'); }