コード例 #1
0
 public function handle_request()
 {
     $data = $this->getWeshopPropsData();
     $idArr = array();
     $brokerIdArr = array();
     if (!empty($data)) {
         foreach ($data as $v) {
             $now = time();
             $createTime = date('Ymd', strtotime($v['createTime']));
             $expireTime = strtotime($createTime) + $this->expireTime * 24 * 3600 - 1;
             $this->setMyFlag($v['id']);
             if ($now > $expireTime) {
                 array_push($idArr, $v['id']);
                 array_push($brokerIdArr, $v['brokerId']);
             }
         }
         $brokerIdArr = array_unique($brokerIdArr);
         if (!empty($idArr)) {
             Model_Weshop_Props::deleteWeshopProps($idArr);
             Model_Weshop_PropImages::deleteWeShopPropImages($idArr);
             $this->deleteWeshopExtByBrokerIds($brokerIdArr, $idArr);
         } else {
             $this->stopFlag();
         }
     }
 }
コード例 #2
0
ファイル: PropDelete.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     if (Bll_Weshop::weshopPropsIsMaintain()) {
         return array('status' => 'error', 'message' => "系统维护中,请稍后再试!");
     }
     header("Access-Control-Allow-Origin: *");
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $propId = $this->_params['propId'];
     //获取房源信息
     $propInfo = Model_Weshop_Props::getWeshopProp($propId);
     if (empty($propInfo)) {
         throw new Exception_Property_NotFound();
     }
     if ($propInfo->brokerId != $brokerId) {
         throw new Exception_Prop_PropNotBelongBroker('brokerId' . $propInfo->brokerId);
     }
     //更新房源状态 删除
     $propInfo->status = 0;
     $propInfo->save();
     //获取房源图片 删除房源图片
     $oldImages = Model_Weshop_PropImages::getWeshopPropImages($propId);
     foreach ($oldImages as $image) {
         $image->isDelete = 1;
         //删除
         $image->save();
     }
     $weshopExtData = Bll_Weshop_WeshopPropExt::getDataByBrokerId($brokerId);
     $weshopExtId = 0;
     foreach ($weshopExtData as $v) {
         if ($v['weshopPropId'] == $propId) {
             $weshopExtId = $v['id'];
             break;
         }
     }
     Bll_Weshop_WeshopPropExt::deleteDataById($weshopExtId);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '删除成功'));
 }
コード例 #3
0
ファイル: PropEdit.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     if (Bll_Weshop::weshopPropsIsMaintain()) {
         return array('status' => 'error', 'message' => "系统维护中,请稍后再试!");
     }
     //更新房源数据库
     //header('Content-Type: application/json; charset=utf-8');
     header("Access-Control-Allow-Origin: *");
     $brokerId = $this->_params['brokerId'];
     $data = $this->_params;
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     //获取房源信息
     $imageUrl = 'http://pages.anjukestatic.com/img/mobile/app/weshop_prop_default.jpg';
     $propId = $data['propId'];
     $oldPropInfo = Model_Weshop_Props::getWeshopProp($propId);
     if (empty($oldPropInfo)) {
         throw new Exception_Property_NotFound();
     }
     if ($oldPropInfo->brokerId != $brokerId) {
         throw new Exception_Prop_PropNotBelongBroker('brokerId' . $oldPropInfo->brokerId);
     }
     $images = json_decode($data['imageJson'], true);
     $outdoorImage = json_decode($data['outdoorImageJson'], true);
     if (count($images) > 8) {
         throw new Exception_Prop_PropImageBeyondLimit();
     }
     if (mb_strlen($data['propDescription'], 'utf-8') > 500) {
         throw new Exception_Prop_PropDescriptionBeyondLimit();
     }
     $tagIds = explode(',', $data['tagIds']);
     if (count($tagIds) > 4) {
         throw new Exception_Prop_PropTagsBeyondLimit();
     }
     //小区信息
     $commInfo = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($data['commId']);
     if (empty($commInfo)) {
         throw new Exception_Property_CommNotFound(Const_APIStatus::E_COMM_NOT_EXISTS);
     }
     $propInfo = array();
     $propInfo['cityId'] = $brokerInfo->cityId;
     $propInfo['commId'] = $data['commId'];
     $propInfo['brokerId'] = $brokerId;
     $propInfo['areaId'] = substr($commInfo['areaCode'], 0, 8);
     $propInfo['blockId'] = $commInfo['areaCode'];
     $propInfo['price'] = $data['price'] > 0 ? $data['price'] : 0;
     $propInfo['acreage'] = $data['area'];
     $propInfo['room'] = $data['room'];
     $propInfo['hall'] = $data['hall'];
     $propInfo['toilet'] = $data['toilet'];
     $propInfo['description'] = json_encode($data['propDescription']);
     if (!empty($data['title'])) {
         $propInfo['title'] = trim($data['title']);
     }
     if (!empty($data['floor'])) {
         $propInfo['floor'] = intval($data['floor']);
     }
     if (!empty($data['totalFloor'])) {
         $propInfo['totalFloor'] = intval($data['totalFloor']);
     }
     $propInfo['tagIds'] = $data['tagIds'];
     $propInfo['status'] = 1;
     $res = Model_Weshop_Props::updateWeshopProps($propId, $propInfo);
     if (!$res) {
         throw new Exception_Property_NotFound();
     } else {
         //比较图片是否有修改
         $oldImages = Model_Weshop_PropImages::getWeshopPropImages($propId);
         $oldImageHashAndHost = $oldOutImageHashAndHost = array();
         foreach ($oldImages as $img) {
             if ($img->imageType == 1) {
                 $oldImageHashAndHost[] = $img->imageHash;
                 $oldImageHashAndHost[] = $img->imageHostId;
             } elseif ($img->imageType == 2) {
                 $oldOutImageHashAndHost[] = $img->imageHash;
                 $oldOutImageHashAndHost[] = $img->imageHostId;
             }
         }
         $newImageHashAndHost = $newOutImageHashAndHost = array();
         foreach ($images as $img) {
             $newImageHashAndHost[] = $img['hash'];
             $newImageHashAndHost[] = $img['host'];
         }
         $newOutImageHashAndHost[] = $outdoorImage['hash'];
         $newOutImageHashAndHost[] = $outdoorImage['host'];
         $compareImages = $this->compareImages($oldImageHashAndHost, $newImageHashAndHost);
         //无论是否有图片的变化 一定返回室内图片的第一张 作为默认图在列表显示
         if ($images) {
             $imageUrl = str_replace("240", "240c", str_replace("display", "display/e", Util_ImageUtils::getResizeURL($images[0]['hash'], $images[0]['host'], 290, 240)));
         }
         //不同 室内图
         if (!$compareImages) {
             //删除老图片插入新图片
             foreach ($oldImages as $image) {
                 if ($image->imageType == 1) {
                     $image->isDelete = 1;
                     //删除
                     $image->save();
                 }
             }
             //插入新图片
             if ($images) {
                 foreach ($images as $key => $img) {
                     $img_params['propId'] = $propId;
                     $img_params['imageHostId'] = $img['host'];
                     $img_params['imageHash'] = $img['hash'];
                     $img_params['isDelete'] = 0;
                     $img_params['isDefault'] = $key == 0 ? 1 : 0;
                     $img_params['imageType'] = 1;
                     //室内图
                     $img_params['createTime'] = date('Y-m-d H:i:s', time());
                     $img_params['updateTime'] = date('Y-m-d H:i:s', time());
                     //存储新图片
                     Model_Weshop_PropImages::insertWeshopPropImages($img_params);
                 }
             }
         }
         $compareOutImages = $this->compareImages($oldOutImageHashAndHost, $newOutImageHashAndHost);
         //不同 房型图
         if (!$compareOutImages) {
             //删除老图片插入新图片
             foreach ($oldImages as $image) {
                 if ($image->imageType == 2) {
                     $image->isDelete = 1;
                     //删除
                     $image->save();
                 }
             }
             //插入新图片
             if ($outdoorImage) {
                 $img_params['propId'] = $propId;
                 $img_params['imageHostId'] = $outdoorImage['host'];
                 $img_params['imageHash'] = $outdoorImage['hash'];
                 $img_params['isDelete'] = 0;
                 $img_params['isDefault'] = 0;
                 $img_params['imageType'] = 2;
                 //户型图
                 $img_params['createTime'] = date('Y-m-d H:i:s', time());
                 $img_params['updateTime'] = date('Y-m-d H:i:s', time());
                 //存储新图片
                 Model_Weshop_PropImages::insertWeshopPropImages($img_params);
             }
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('imageUrl' => $imageUrl, 'message' => '保存成功'));
 }
コード例 #4
0
 public function handle_request()
 {
     //取任务 weshop_prop_queue 表中status 为0;
     $props = Model_Weshop_PropQueue::getProps($this->per);
     //处理任务
     foreach ($props as $prop) {
         //weshop_prop_queue 表中status 为1;
         Model_Weshop_PropQueue::updatePropStatus($prop, Model_Weshop_PropQueue::PROP_START);
         $propInfo = Bll_Ppc_ServiceAPI::getHouseInfo($prop['propId']);
         $params = array();
         $params['cityId'] = $prop['cityId'];
         $params['commId'] = $propInfo['property']['CommId'];
         $params['brokerId'] = $prop['brokerId'];
         $params['areaId'] = substr($propInfo['property']['AreaCode'], 0, 8);
         $params['blockId'] = $propInfo['property']['AreaCode'];
         $params['price'] = $propInfo['property']['ProPrice'];
         $params['acreage'] = $propInfo['property']['AreaNum'];
         $params['room'] = $propInfo['property']['RoomNum'];
         $params['hall'] = $propInfo['property']['HallNum'];
         $params['toilet'] = $propInfo['property']['ToiletNum'];
         $propDescription = $propInfo['property']['sale']['AddExplan'];
         $propDescription = str_replace('<p>', "", $propDescription);
         $propDescription = str_replace('</p>', "", $propDescription);
         $propDescription = trim($propDescription);
         $params['description'] = json_encode($propDescription);
         $params['title'] = $propInfo['property']['ProName'];
         $params['floor'] = $propInfo['property']['ProFloor'];
         $params['totalFloor'] = $propInfo['property']['FloorNum'];
         $params['status'] = 1;
         $params['createTime'] = date('Y-m-d H:i:s', time());
         $params['updateTime'] = date('Y-m-d H:i:s', time());
         $result = Model_Weshop_Props::insertWeshopProps($params);
         //更新weshop_prop_queue 表中status;
         if (!$result) {
             Model_Weshop_PropQueue::updatePropStatus($prop, Model_Weshop_PropQueue::PROP_FAILED);
             //导入失败
         } else {
             Model_Weshop_PropQueue::updatePropStatus($prop, Model_Weshop_PropQueue::PROP_SUCCESS);
             //导入成功
             $tmp = array('weshopPropId' => $result->id, 'brokerId' => $prop['brokerId'], 'propId' => $prop['propId']);
             Model_Weshop_PropsFilter::insertRecord($tmp);
         }
         //存储图片 默认图 区分 室内图8张 户型图 1张
         if ($propInfo['attachments']['attachments']) {
             $propImageNum = 0;
             $outdoorImageNum = 0;
             $images = $propInfo['attachments']['attachments'];
             foreach ($images as $image) {
                 if ($image['DataType'] == 2) {
                     if ($propImageNum >= 8) {
                         continue;
                     }
                     if ($propImageNum == 0) {
                         $img_params['isDefault'] = 1;
                     } else {
                         $img_params['isDefault'] = 0;
                     }
                     $img_params['imageType'] = 1;
                     //室内图
                     $propImageNum += 1;
                 } else {
                     if ($image['DataType'] == 3) {
                         if ($outdoorImageNum >= 1) {
                             continue;
                         }
                         $img_params['imageType'] = 2;
                         //户型图
                         $outdoorImageNum += 1;
                     }
                 }
                 $img_params['propId'] = $result->id;
                 $img_params['imageHostId'] = $image['host_id'];
                 $img_params['imageHash'] = $image['FileName'];
                 $img_params['isDelete'] = 0;
                 $img_params['createTime'] = date('Y-m-d H:i:s', time());
                 $img_params['updateTime'] = date('Y-m-d H:i:s', time());
                 //存储图片
                 Model_Weshop_PropImages::insertWeshopPropImages($img_params);
             }
         }
     }
 }
コード例 #5
0
 public function handle_request_internal()
 {
     if (Bll_Weshop::weshopPropsIsMaintain()) {
         return array('status' => 'error', 'message' => "系统维护中,请稍后再试!");
     }
     header("Access-Control-Allow-Origin: *");
     //获取房源 获取房源图片
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     //获取房源信息
     $propId = $this->_params['propId'];
     $propInfo = Model_Weshop_Props::getWeshopProp($propId);
     if (empty($propInfo)) {
         throw new Exception_Property_NotFound(Const_APIStatus::E_PROP_INFO_FAILED);
     }
     //小区信息
     $commInfo = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($propInfo->commId, 2);
     $city_set = APF::get_instance()->get_config("city_set", "multicity");
     $cityPinYin = $city_set[$brokerInfo->cityId]['pinyin'];
     $row = array();
     $row['propId'] = $propId;
     $row['floor'] = $propInfo->floor;
     $row['totalFloor'] = $propInfo->totalFloor;
     $row['commId'] = $propInfo->commId;
     $row['commName'] = $commInfo['commName'];
     $row['commLocation'] = $commInfo['commLocal'];
     $row['sosolat'] = $commInfo['sosolat'];
     //纬度
     $row['sosolng'] = $commInfo['sosolng'];
     //经度
     //$areaId = substr($commInfo['areaCode'], 0, 8);
     //$areaInfo = Model_City_TypeCode::getTypeName($areaId);
     //$row['areaName'] = $areaInfo->typeName;
     $blockId = $commInfo['areaCode'];
     $blockInfo = Bll_Commtype_Api::getInfoByTypeCode($blockId);
     $areaInfo = Bll_Commtype_Api::getInfoByTypeId($blockInfo['parentId']);
     $row['areaName'] = $areaInfo['typeName'];
     $row['blockName'] = $blockInfo['typeName'];
     $row['room'] = $propInfo->room;
     $row['hall'] = $propInfo->hall;
     $row['toilet'] = $propInfo->toilet;
     $row['area'] = $propInfo->acreage;
     $row['areaUnit'] = '平米';
     $row['price'] = intval($propInfo->price);
     $row['priceUnit'] = '万';
     $isJson = Util_String::isJson($propInfo->description);
     $row['propDescription'] = $isJson ? json_decode($propInfo->description) : $propInfo->description;
     $row['title'] = $propInfo->title ? $propInfo->title : $row['commName'] . ' ' . $row['room'] . '室' . $row['hall'] . '厅' . ' ' . $row['area'] . '平' . ' ' . $row['price'] . '万';
     $row['cityPinYin'] = $cityPinYin;
     //从数据库取房源特色id
     $tagIds = $propInfo->tagIds;
     $tagIds = explode(',', $tagIds);
     $allTags = APF::get_instance()->get_config('weshop_tags');
     $propTags = array();
     foreach ($tagIds as $tagId) {
         $tagId = trim($tagId);
         if ($tagId) {
             $tag = array();
             $tag['tagId'] = $tagId;
             $tag['tagName'] = $allTags[$tagId];
             $propTags[] = $tag;
         }
     }
     $row['tags'] = $propTags;
     //获取房源图片
     $propImages = Model_Weshop_PropImages::getWeshopPropImages($propId);
     $row['propImages'] = $row['outdoorImage'] = array();
     foreach ($propImages as $propImage) {
         $image = array();
         $image['host'] = $propImage->imageHostId;
         $image['hash'] = $propImage->imageHash;
         $url = Util_ImageUtils::getResizeURL($propImage->imageHash, $propImage->imageHostId, 290, 240);
         $url = str_replace("display", "display/e", $url);
         //无水印格式
         $url = str_replace("240", "240c", $url);
         //图片url 加c
         $image['smallImageUrl'] = $url;
         $url = Util_ImageUtils::getResizeURL($propImage->imageHash, $propImage->imageHostId, 600, 600);
         $url = str_replace("display", "display/e", $url);
         //无水印格式
         $image['bigImageUrl'] = $url;
         //区分户型图和室内图
         if ($propImage->imageType == 1) {
             $row['propImages'][] = $image;
         } elseif ($propImage->imageType == 2) {
             $row['outdoorImage'][] = $image;
         }
     }
     $row['cityId'] = $brokerInfo->cityId;
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $row);
 }
コード例 #6
0
ファイル: Props.php プロジェクト: emilymwang8/ajk-broker
 public function getPropDefaultImage($propId)
 {
     $defaultImages = Model_Weshop_PropImages::getWeshopDefaultImage($propId);
     $keyDefaultImages = array();
     foreach ($defaultImages as $defaultImage) {
         $keyDefaultImages[$defaultImage->propId] = $defaultImage;
     }
     return $keyDefaultImages;
 }
コード例 #7
0
 public function handle_request_internal()
 {
     if (Bll_Weshop::weshopPropsIsMaintain()) {
         return array('status' => 'error', 'message' => "系统维护中,请稍后再试!");
     }
     header("Access-Control-Allow-Origin: *");
     $brokerId = $this->_params['brokerId'];
     $propIds = explode(',', $this->_params['propIds']);
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     //房源表查寻后 添加到队列表
     $propsInfos = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $brokerInfo->cityId);
     if (count($propIds) == 1) {
         //插入 房源列表  并返回
         $propInfo = Bll_Ppc_ServiceAPI::getHouseInfo($propIds[0]);
         if ($propInfo) {
             $params = array();
             $params['cityId'] = $propInfo['property']['CityId'];
             $params['commId'] = $propInfo['property']['CommId'];
             $params['brokerId'] = $brokerId;
             $params['areaId'] = substr($propInfo['property']['AreaCode'], 0, 8);
             $params['blockId'] = $propInfo['property']['AreaCode'];
             $params['price'] = $propInfo['property']['ProPrice'];
             $params['acreage'] = $propInfo['property']['AreaNum'];
             $params['room'] = $propInfo['property']['RoomNum'];
             $params['hall'] = $propInfo['property']['HallNum'];
             $params['toilet'] = $propInfo['property']['ToiletNum'];
             $propDescription = $propInfo['property']['sale']['AddExplan'];
             $propDescription = str_replace('<p>', "", $propDescription);
             $propDescription = str_replace('</p>', "", $propDescription);
             $propDescription = trim($propDescription);
             $params['description'] = json_encode($propDescription);
             $params['title'] = $propInfo['property']['ProName'];
             $params['floor'] = $propInfo['property']['ProFloor'];
             $params['totalFloor'] = $propInfo['property']['FloorNum'];
             $params['status'] = 1;
             $params['createTime'] = date('Y-m-d H:i:s', time());
             $params['updateTime'] = date('Y-m-d H:i:s', time());
             $result = Model_Weshop_Props::insertWeshopProps($params);
             //存储图片 默认图 区分 室内图8张 户型图 1张
             $imageUrl = '';
             if ($propInfo['attachments']['attachments']) {
                 $propImageNum = 0;
                 $outdoorImageNum = 0;
                 $images = $propInfo['attachments']['attachments'];
                 foreach ($images as $image) {
                     if ($image['DataType'] == 2) {
                         if ($propImageNum >= 8) {
                             continue;
                         }
                         if ($propImageNum == 0) {
                             $img_params['isDefault'] = 1;
                             //默认图
                             $url = Util_ImageUtils::getResizeURL($image['FileName'], $image['host_id'], 290, 240);
                             //(拼好小图)
                             $imageUrl = str_replace("240", "240c", $url);
                             //无水印格式
                         } else {
                             $img_params['isDefault'] = 0;
                         }
                         $img_params['imageType'] = 1;
                         //室内图
                         $propImageNum += 1;
                     } else {
                         if ($image['DataType'] == 3) {
                             if ($outdoorImageNum >= 1) {
                                 continue;
                             }
                             $img_params['imageType'] = 2;
                             //户型图
                             $outdoorImageNum += 1;
                         }
                     }
                     $img_params['propId'] = $result->id;
                     $img_params['imageHostId'] = $image['host_id'];
                     $img_params['imageHash'] = $image['FileName'];
                     $img_params['isDelete'] = 0;
                     $img_params['createTime'] = date('Y-m-d H:i:s', time());
                     $img_params['updateTime'] = date('Y-m-d H:i:s', time());
                     //存储图片
                     Model_Weshop_PropImages::insertWeshopPropImages($img_params);
                 }
             }
             if ($result) {
                 //插入 weshop_prop_ext表
                 $tmp = array('weshopPropId' => $result->id, 'brokerId' => $brokerId, 'propId' => $propIds[0]);
                 Model_Weshop_PropsFilter::insertRecord($tmp);
                 //区域板块
                 $areaAndBlockIds = array();
                 $areaId = $params['areaId'];
                 $blockId = $params['blockId'];
                 $areaAndBlockIds[] = $areaId;
                 $areaAndBlockIds[] = $blockId;
                 $commTypeInfos = Bll_Community_CommunityGardener::getCommTypeInfo($areaAndBlockIds);
                 $previewUrl = Bll_Weshop::getPropPreviewUrl(array('brokerId' => $brokerId, 'propId' => $result->id));
                 return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propId' => $result->id, 'title' => $propInfo['property']['ProName'], 'areaName' => $commTypeInfos[$areaId], 'blockName' => $commTypeInfos[$blockId], 'commId' => $propInfo['property']['CommId'], 'commName' => $propInfo['property']['CommName'], 'room' => $propInfo['property']['RoomNum'], 'hall' => $propInfo['property']['HallNum'], 'toilet' => $propInfo['property']['ToiletNum'], 'price' => $propInfo['property']['ProPrice'], 'priceUnit' => '万', 'area' => $propInfo['property']['AreaNum'], 'areaUnit' => '平米', 'propDescription' => $propDescription, 'previewUrl' => $previewUrl, 'imageUrl' => $imageUrl));
             }
         }
     }
     //插入队列表
     foreach ($propsInfos as $propsInfo) {
         if ($propsInfo['brokerId'] == $brokerId) {
             $params = array();
             $params['brokerId'] = $brokerId;
             $params['propId'] = $propsInfo['proId'];
             $params['cityId'] = $brokerInfo->cityId;
             $params['status'] = 0;
             $params['addTime'] = date('Y-m-d H:i:s', time());
             $params['updateTime'] = date('Y-m-d H:i:s', time());
             Model_Weshop_PropQueue::insertWeshopPropQueue($params);
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '导入成功'));
 }
コード例 #8
0
ファイル: PropImages.php プロジェクト: emilymwang8/ajk-broker
 public static function getWeshopPropImages($propId)
 {
     return Model_Weshop_PropImages::data_access()->filter('propId', $propId)->filter('isDelete', 0)->sort('id', 'asc')->find();
 }
コード例 #9
0
ファイル: PropCreate.php プロジェクト: emilymwang8/ajk-broker
 public function handle_request_internal()
 {
     if (Bll_Weshop::weshopPropsIsMaintain()) {
         return array('status' => 'error', 'message' => "系统维护中,请稍后再试!");
     }
     //存储房源  存储图片
     $brokerId = $this->_params['brokerId'];
     $data = $this->_params;
     //header('Content-Type: application/json; charset=utf-8');
     $images = json_decode($data['imageJson'], true);
     if (count($images) > 8) {
         throw new Exception_Prop_PropImageBeyondLimit();
     }
     if (mb_strlen($data['propDescription'], 'utf-8') > 500) {
         throw new Exception_Prop_PropDescriptionBeyondLimit();
     }
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $tagIds = explode(',', $data['tagIds']);
     if (count($tagIds) > 4) {
         throw new Exception_Prop_PropTagsBeyondLimit();
     }
     $tmpBrokerIds = array(1471136);
     // ios5.2 加急审核
     if ($data['tagIds'] == 2 && $data['cv'] == 5.2 && in_array($data['brokerId'], $tmpBrokerIds)) {
         return array();
     }
     //小区信息
     $commInfo = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($data['commId']);
     if (empty($commInfo)) {
         throw new Exception_Property_CommNotFound(Const_APIStatus::E_COMM_NOT_EXISTS);
     }
     $propInfo = array();
     $propInfo['cityId'] = $brokerInfo->cityId;
     $propInfo['commId'] = $data['commId'];
     $propInfo['brokerId'] = $brokerId;
     $propInfo['areaId'] = substr($commInfo['areaCode'], 0, 8);
     $propInfo['blockId'] = $commInfo['areaCode'];
     $propInfo['price'] = $data['price'] > 0 ? $data['price'] : 0;
     $propInfo['acreage'] = $data['area'];
     $propInfo['room'] = $data['room'];
     $propInfo['hall'] = $data['hall'];
     $propInfo['toilet'] = $data['toilet'];
     $propInfo['description'] = json_encode($data['propDescription']);
     if (!empty($data['title'])) {
         $propInfo['title'] = trim($data['title']);
     }
     if (!empty($data['floor'])) {
         $propInfo['floor'] = intval($data['floor']);
     }
     if (!empty($data['totalFloor'])) {
         $propInfo['totalFloor'] = intval($data['totalFloor']);
     }
     $propInfo['tagIds'] = $data['tagIds'];
     //特色
     $propInfo['status'] = 1;
     $propInfo['createTime'] = date('Y-m-d H:i:s', time());
     $propInfo['updateTime'] = date('Y-m-d H:i:s', time());
     //存储房源
     $result = Model_Weshop_Props::insertWeshopProps($propInfo);
     $propId = $result->id;
     //$areaInfo = Model_City_TypeCode::getTypeName($propInfo['areaId']);
     //$areaName = $areaInfo->typeName;
     //$blockInfo = Model_City_TypeCode::getTypeName($propInfo['blockId']);
     //$blockName = $blockInfo->typeName;
     $areaInfo = Bll_Commtype_Api::getInfoByTypeCode($propInfo['areaId']);
     $areaName = $areaInfo['typeName'];
     $blockInfo = Bll_Commtype_Api::getInfoByTypeCode($propInfo['blockId']);
     $blockName = $blockInfo['typeName'];
     $imageUrl = '';
     if ($images) {
         foreach ($images as $key => $img) {
             $img_params['propId'] = $propId;
             $img_params['imageHostId'] = $img['host'];
             $img_params['imageHash'] = $img['hash'];
             $img_params['isDelete'] = 0;
             if ($key == 0) {
                 $img_params['isDefault'] = 1;
                 $url = Util_ImageUtils::getResizeURL($img_params['imageHash'], $img_params['imageHostId'], 290, 240);
                 //(拼好小图)
                 $imageUrl = str_replace("240", "240c", $url);
                 //无水印格式
             } else {
                 $img_params['isDefault'] = 0;
             }
             $img_params['createTime'] = date('Y-m-d H:i:s', time());
             $img_params['updateTime'] = date('Y-m-d H:i:s', time());
             $img_params['imageType'] = 1;
             //室内图
             //存储图片
             Model_Weshop_PropImages::insertWeshopPropImages($img_params);
         }
     }
     //户型图
     if (!empty($data['outdoorImageJson'])) {
         $outdoorImages = json_decode($data['outdoorImageJson'], true);
         if (!empty($outdoorImages)) {
             $img_params['propId'] = $propId;
             $img_params['imageHostId'] = $outdoorImages['host'];
             $img_params['imageHash'] = $outdoorImages['hash'];
             $img_params['isDelete'] = 0;
             $img_params['isDefault'] = 0;
             $img_params['createTime'] = date('Y-m-d H:i:s', time());
             $img_params['updateTime'] = date('Y-m-d H:i:s', time());
             $img_params['imageType'] = 2;
             //户型图
             //存储图片
             Model_Weshop_PropImages::insertWeshopPropImages($img_params);
         }
     }
     header("Access-Control-Allow-Origin: *");
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propId' => $propId, 'title' => $propInfo['title'] ? $propInfo['title'] : $commInfo['commName'] . ' ' . $result->room . '室' . $result->hall . '厅' . ' ' . $result->acreage . '平' . ' ' . intval($result->price) . '万', 'areaName' => $areaName, 'blockName' => $blockName, 'commId' => $commInfo['commId'], 'commName' => $commInfo['commName'], 'room' => $result->room, 'hall' => $result->hall, 'toilet' => $result->toilet, 'price' => intval($result->price), 'priceUnit' => '万', 'area' => $result->acreage, 'areaUnit' => '平米', 'propDescription' => json_decode($propInfo['description']), 'previewUrl' => Bll_Weshop::getPropPreviewUrl(array('brokerId' => $brokerId, 'propId' => $propId)), 'imageUrl' => $imageUrl));
 }