Example #1
0
 public function handlePost()
 {
     $this->request = APF::get_instance()->get_request();
     $brokerId = $this->request->getBrokerId();
     $cityId = $this->request->getBrokerCityId();
     $params = $this->request->get_parameters();
     $params['broker_id'] = $brokerId;
     $result = array();
     try {
         if ($this->action == 'edit') {
             $houseInfo = Bll_House_EsfEdit::getHouseBaseInfo($this->houseId);
             /** 违规房源不可以编辑 */
             if (isset($houseInfo['isIllegal']) && $houseInfo['isIllegal']) {
                 $this->redirect2Result(Const_PublishCode::UNKNOWN_ERROR, 'ajk', 'edit', $this->houseId, '已违规房源不可编辑');
             }
             $result = Bll_House_EsfEdit::saveHouseInfo($brokerId, $cityId, $this->houseId, $params);
         }
         if ($this->action == 'publish') {
             $result = Bll_House_EsfPublish::saveHouseInfo($brokerId, $params, $this->isComboBroker);
             if ($result['status'] == 'ok') {
                 $this->houseId = $result['houseId'];
             }
         }
         /** 委托房源发布 */
         if ($this->action == 'commission') {
             $result = Bll_House_EsfCommission::saveHouseInfo($brokerId, $cityId, $this->commissionId, $params, $this->isComboBroker);
             if ($result['status'] == 'ok') {
                 $this->houseId = $result['houseId'];
             }
         }
         if ($result['status'] != 'ok') {
             $this->redirect2Result(Const_PublishCode::PUBLISH_PROP_ERROR, 'ajk', $this->action, $this->houseId, $result['info']);
         }
     } catch (Exception $e) {
         $params['brokerId'] = self::$intBrokerID;
         APF::get_instance()->get_nlogger()->log(__CLASS__, $params);
         $this->redirect2Result(Const_PublishCode::PUBLISH_PROP_ERROR, 'ajk', $this->action, $this->houseId, $e->getMessage());
     }
     /** 立即推广 */
     if (isset($params['broker_action']) && $params['broker_action'] == 'publish') {
         /** 套餐推广 */
         if ($this->isComboBroker) {
             $spreadResult = Bll_Combo_HouseRelation::houseStartComboSpreadV2($brokerId, $cityId, array($this->houseId), Bll_Combo_HouseRelation::SITE_TYPE_AJK);
             if ($spreadResult['status'] != 1) {
                 switch ($spreadResult['status']) {
                     /** 没有套餐 */
                     case -1:
                     case -2:
                         $this->redirect2Result(Const_PublishCode::SPREAD_PROP_NO_COMBO, 'ajk', $this->action, $this->houseId, $spreadResult['msg']);
                         break;
                         /** 套餐未生效 */
                     /** 套餐未生效 */
                     case -3:
                         $this->redirect2Result(Const_PublishCode::SPREAD_PROP_COMBO_ACTIVE, 'ajk', $this->action, $this->houseId, $spreadResult['msg']);
                         break;
                         /** 推广房源数已满 */
                     /** 推广房源数已满 */
                     case -4:
                     case -5:
                         $this->redirect2Result(Const_PublishCode::SPREAD_PROP_COMBO_LIMIT, 'ajk', $this->action, $this->houseId, $spreadResult['msg']);
                         break;
                     default:
                         $this->redirect2Result(Const_PublishCode::SPREAD_PROP_COMBO_FAIL, 'ajk', $this->action, $this->houseId, $spreadResult['msg']);
                 }
             }
         } else {
             /** 定价推广 */
             if ($this->action == 'edit') {
                 /** 定价推广失败 房源已经推广 */
                 if (BLL_Plan_EsfPropFixedPlanRelation::isHouseOnline($cityId, $this->houseId)) {
                     $this->redirect2Result(Const_PublishCode::SPREAD_PROP_PLAN_IN, 'ajk', $this->action, $this->houseId, '房源已经推广');
                 }
             }
             $fixPlanList = BLL_Plan_EsfPropFixedPlanRelation::getBrokerValidPlan($brokerId);
             if (empty($fixPlanList)) {
                 $this->redirect2Result(Const_PublishCode::UNKNOWN_ERROR, 'ajk', $this->action, $this->houseId, '获取定价计划信息失败');
             }
             $fixPlan = $fixPlanList[0];
             /** 定价推广失败 已经超出推广房源上限 */
             if (!Bll_Broker_HzBroker::ajkPpcBrokerCanSpreadHouse($cityId, $brokerId)) {
                 $this->redirect2Result(Const_PublishCode::SPREAD_PROP_OUT_LIMIT, 'ajk', $this->action, $this->houseId, '已经超出推广房源上限');
             }
             $spreadResult = Bll_Ppc_ServiceAPI::fixPlanAddHouse($brokerId, $this->houseId, $fixPlan['id'], '23532');
             if (isset($spreadResult['status'])) {
                 if ($spreadResult['status'] != 'ok') {
                     $this->redirect2Result(Const_PublishCode::API_ERROR, 'ajk', $this->action, $this->houseId, $spreadResult['info']);
                 }
             } else {
                 $this->redirect2Result(Const_PublishCode::API_ERROR, 'ajk', $this->action, $this->houseId, '系统繁忙(推广房源超时)');
             }
             /** 定价推广失败 计划已经手动停止 */
             if ($fixPlan['viewTime'] == 1861891200) {
                 /** 定价推广失败 认证未通过 */
                 $brokerCheckState = Bll_Broker_BrokerCheckInfo::getCheckStateByBrokerId($brokerId);
                 if ($brokerCheckState != 1) {
                     $this->redirect2Result(Const_PublishCode::SPREAD_PROP_AUDITED_ERROR, 'ajk', $this->action, $this->houseId, '认证未通过');
                 }
                 $this->redirect2Result(Const_PublishCode::SPREAD_PROP_HANDLE_STOP, 'ajk', $this->action, $this->houseId, '计划已经手动停止');
             }
             /** 定价推广失败 账户余额不足,充值后自动推广 */
             if ($fixPlan['viewTime'] == 1893427200) {
                 $this->redirect2Result(Const_PublishCode::SPREAD_PROP_BALANCE_ERROR, 'ajk', $this->action, $this->houseId, '账户余额不足,充值后自动推广');
             }
         }
         /** 推广成功 */
         $this->redirect2Result(Const_PublishCode::HOUSE_SPREAD_SUCCESS, 'ajk', $this->action, $this->houseId);
     }
     /** 发布成功 */
     $this->redirect2Result(Const_PublishCode::HOUSE_SAVE_SUCCESS, 'ajk', $this->action, $this->houseId);
 }
Example #2
0
 /**
  * 获取房源信息
  *
  * @param int $houseId
  * @return array
  * @throws Exception
  */
 public static function getHouseBaseInfo($houseId)
 {
     //房源特色标签,房源视频,公共图库,房源图片,经纪人,小区,扩展信息,房源描述信息
     $rsl = bindec(11000011);
     $houseInfo = Bll_Service_House_EsfHouseInfo::getHouseBaseInfo($houseId, $rsl);
     if (false === $houseInfo) {
         throw new Exception('获取房源信息失败(系统繁忙)');
     }
     if ($houseInfo['status'] != 'ok') {
         throw new Exception('获取房源信息失败');
     }
     $property = $houseInfo['property'];
     $tagResult = $houseInfo['tagResult'];
     $houseAge = $property['sale']['HouseAge'];
     if ($houseAge == 0) {
         $houseAge = date('Y');
     } elseif ($houseAge < 200) {
         $houseAge = date('Y') - $houseAge + 1;
     }
     $houseBaseInfo = array('community_id' => $property['CommId'], 'community_name' => $property['CommName'], 'house_id' => $property['ProId'], 'AreaNum' => $property['AreaNum'], 'ProPrice' => $property['ProPrice'], 'minDownPay' => $property['sale']['HouseBelong'], 'houseAge' => $houseAge, 'RoomNum' => $property['RoomNum'], 'HallNum' => $property['HallNum'], 'ToiletNum' => $property['ToiletNum'], 'useType' => $property['UseType'], 'fitment' => $property['FitmentId'], 'houseori' => $property['sale']['HouseOri'], 'ProFloor' => $property['ProFloor'], 'FloorNum' => $property['FloorNum'], 'ProName' => htmlspecialchars($property['ProName']), 'AddExplan' => htmlspecialchars($property['sale']['AddExplan']), 'commissionType' => $property['CommitionType'], 'isFullFive' => $property['sale']['MortBank'], 'isOnly' => $property['sale']['AidReturn'], 'userDefined' => $property['UserDefined'], 'ProPrivateTag' => Bll_House_EsfEdit::parsePrivateTag($tagResult['TagId']), 'fileNo' => htmlspecialchars($property['sale']['HouseCard']), 'isIllegal' => $property['IsVisible'] == 0 && $property['ExpireWorker'] != 'propertyReport');
     return $houseBaseInfo;
 }