Example #1
0
 public function handle_request_combo()
 {
     $propIds = $this->_params['propIds'];
     $brokerId = $this->brokerId;
     $cityId = $this->cityId;
     if (!is_array($propIds)) {
         $propIds = strstr($propIds, ",") === false ? array($propIds) : explode(',', $propIds);
     }
     // 房源有效性验证等
     $prop = Model_House_HzProp::getPropsByPropIds($propIds);
     $newPropIds = array();
     // 验证房源是否已经被删除
     foreach ($prop as $propId => $value) {
         if ($value['status'] > 0 && !in_array($value['status'], array(6, 99, 100))) {
             $newPropIds[$propId] = $propId;
         }
     }
     if (empty($newPropIds)) {
         throw new Exception('房源不存在');
     }
     $result = Bll_Combo_HouseRelation::houseStartComboSpreadV2($brokerId, $cityId, $newPropIds, Bll_Combo_HouseRelation::SITE_TYPE_HZ);
     if ($result['status'] == 1) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('msg' => '套餐立即推广成功'));
     } else {
         switch ($result['status']) {
             case -1:
                 $msg = '尚未购买套餐,请购买套餐';
                 break;
             case -2:
                 $msg = '尚未购买套餐,请购买套餐';
                 break;
             case -4:
                 $msg = '推广房源数超过上限';
                 break;
             case -5:
                 $msg = '推广房源数超过上限';
                 break;
             default:
                 $msg = $result['msg'];
         }
         return Util_MobileAPI::error_tmp($result['status'], $msg);
     }
 }
Example #2
0
 public function afterPost()
 {
     // 推广
     if ($this->ctx['html_action'] == 'publish') {
         //伪登陆不能推广
         if ($this->ctx['isManagerCookie']) {
             $this->redirect2Result(Const_PublishCode::PSEUDO_ERROR, $this->site, $this->action, $this->ctx['proId']);
         }
         if (Bll_City::isComboCity($this->ctx['cityId'])) {
             // 套餐推广
             $spreadResult = Bll_Combo_HouseRelation::houseStartComboSpreadV2($this->ctx['ajkBrokerId'], $this->ctx['cityId'], $this->ctx['proId'], Bll_Combo_HouseRelation::SITE_TYPE_HZ);
         } else {
             // 双证审核未通过 不能推广
             // 获取经纪人信息
             $brokerInfo = Model_Broker_HzUsersSearch::getUserInfoByUserId($this->ctx['hzBrokerId']);
             // 身份是否通过
             $this->ctx['isPassVerify'] = $brokerInfo && Bll_Broker_HzBroker::isPassVerify($brokerInfo['profileVerify']);
             //if (!$isPassVerify)
             //    $this->redirect2Result(Const_PublishCode::NOT_PASS_VERIFY, $this->site, $this->action, $this->ctx['proId']);
             // 获取账户余额
             $balance = Bll_Broker_HzBroker::getAccountInfo($this->ctx['ajkBrokerId'], 'balance');
             $this->ctx['validMoney'] = $balance && $balance['msg'] ? round($balance['msg'] / 100, 2) : 0;
             //if (!$validMoney)
             //   $this->redirect2Result(Const_PublishCode::NOT_MONEY, $this->site, $this->action, $this->ctx['proId']);
             // ppc推广
             $spreadResult = Bll_Plan_Fix_HzFix::addPropToPlan($this->ctx['planId'], $this->ctx['proId'], $this->ctx['cityId'], $this->ctx['ajkBrokerId']);
         }
         // 推广出错
         if ($spreadResult['status'] <= 0) {
             $this->redirect2Result(Const_PublishCode::SPREAD_PROP_HANDLE_STOP, $this->site, $this->action, $this->ctx['proId'], $spreadResult['msg']);
         }
     }
     //++++++ others actions
     // 委托
     if (isset($this->ctx['isCommission']) && $this->ctx['isCommission']) {
         // 房源发布成功,回写委托信息
         if ($this->ctx['commission'] && $this->ctx['proId']) {
             Bll_House_HzHouse::updateCommission($this->ctx['commissionId'], $this->ctx['proId']);
         }
     }
 }
Example #3
0
 /**
  * @return bool
  * post之后的处理
  */
 public function afterPost()
 {
     $loudouLogResultType = $url = '';
     $params = APF::get_instance()->get_request()->get_parameters();
     $resultCode = Const_PublishCode::HOUSE_SAVE_SUCCESS;
     if ($params['goto_next_step'] == 'planFix') {
         // 添加至定价计划
         $arrResult = Bll_Plan_JpPlanManage::getInstance()->addHouseToSpread($this->jpMemberId, $this->officeId, intval($params['fix_plan_id']));
         if ($arrResult['success'] == true) {
             $loudouLogResultType = Bll_Loudou_Log::RESULT_TYPE_FIX_SUCCESS;
             $resultCode = Const_PublishCode::HOUSE_SPREAD_SUCCESS;
         } else {
             // 添加定价计划失败,跳转
             switch ($arrResult['err_code']) {
                 case Const_PublishCode::SPREAD_PROP_OUT_LIMIT:
                     // 房源定价推广失败 - 已经超出推广房源上限(定价推广房源已满50套)
                     $loudouLogResultType = Bll_Loudou_Log::RESULT_TYPE_FIX_FAILED_HOUSE_MAX_LIMIT;
                     break;
                 case Const_PublishCode::SPREAD_PROP_HANDLE_STOP:
                     // 房源定价推广失败 - 定价推广计划手动停止
                     $loudouLogResultType = Bll_Loudou_Log::RESULT_TYPE_FIX_FAILED_PLAN_MANUALLY_STOPPED;
                     break;
                 case Const_PublishCode::SPREAD_PROP_BALANCE_ERROR:
                     // 房源定价推广失败 - 账户余额不足
                     $loudouLogResultType = Bll_Loudou_Log::RESULT_TYPE_FIX_FAILED_NO_BALANCE;
                     break;
                 case Const_PublishCode::SPREAD_PROP_AUDITED_ERROR:
                     // 房源定价推广失败 - 认证未通过
                     $loudouLogResultType = Bll_Loudou_Log::RESULT_TYPE_FIX_FAILED_AUDITED_FAILED;
                     break;
                 case Const_PublishCode::SPREAD_PROP_BUDGET_OVER:
                     // 房源定价推广失败 - 定价计划限额花完
                     $loudouLogResultType = Bll_Loudou_Log::RESULT_TYPE_FIX_FAILED_PLAN_NO_BUDGET;
                     break;
                 default:
                     $arrResult['err_code'] = Const_PublishCode::UNKNOWN_ERROR;
                     break;
             }
             $resultCode = $arrResult['err_code'];
         }
     } elseif ($params['goto_next_step'] == 'planCombo') {
         $comboResult = Bll_Combo_HouseRelation::houseStartComboSpreadV2($this->brokerId, $this->cityId, $this->officeId, Bll_Combo_HouseRelation::SITE_TYPE_JP);
         //todo 错误提示
         if ($comboResult['status'] == 1) {
             $loudouLogResultType = Bll_Loudou_Log::RESULT_TYPE_FIX_SUCCESS;
             $resultCode = Const_PublishCode::HOUSE_SPREAD_SUCCESS;
         } else {
             switch ($comboResult['status']) {
                 case -1:
                 case -2:
                     $resultCode = Const_PublishCode::SPREAD_PROP_NO_COMBO;
                     break;
                 case -3:
                     $resultCode = Const_PublishCode::SPREAD_PROP_COMBO_ACTIVE;
                     break;
                 case -4:
                 case -5:
                     $resultCode = Const_PublishCode::SPREAD_PROP_COMBO_LIMIT;
                     break;
                 case -6:
                     $resultCode = Const_PublishCode::SPREAD_PROP_COMBO_FAIL;
                     break;
             }
             $loudouLogResultType = Bll_Loudou_Log::RESULT_TYPE_FIX_FAILED_OTHERS;
         }
     } elseif ($params['goto_next_step'] == 'justSaveHouse') {
         $loudouLogResultType = Bll_Loudou_Log::RESULT_TYPE_SAVE_SUCCESS;
         $resultCode = Const_PublishCode::HOUSE_SAVE_SUCCESS;
     }
     $loudouLogHoustType = Bll_Loudou_Log::jinpuHouseType('office', 'rent');
     $this->logGiveArr[] = array('func' => array('Bll_Loudou_log', 'add'), 'params' => array($loudouLogHoustType, $loudouLogResultType, Bll_Loudou_Log::SOURCE_TYPE_FORM));
     $this->redirect2Result($resultCode, self::SITE_JP, $this->act, $this->officeId);
     return true;
 }
Example #4
0
 /**
  * 房源加入套餐推广
  * @return array
  */
 public function do_addPropToCombo()
 {
     return Bll_Combo_HouseRelation::houseStartComboSpreadV2($this->params['brokerId'], $this->params['cityId'], $this->params['proIds'], Bll_Combo_HouseRelation::SITE_TYPE_AJK);
 }
Example #5
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 #6
0
 /**
  * 房源开始套餐推广
  */
 public function do_houseCombo()
 {
     $houseIds = explode(',', $this->params['houseIds']);
     foreach ($houseIds as $k => $houseId) {
         $house = Bll_House_JpHouseInfo::getHouseInfoById($houseId, true);
         if (empty($house) || $house['base']->isDelete || $house['info']->isExpired || $house['info']->isIllegal || $house['info']->memberId != $this->jpBrokerId) {
             unset($houseIds[$k]);
             continue;
         }
         $houseComboInfo = Model_Combo_HouseRelation::data_access('jp')->filter('houseId', $house['base']->id)->find_only();
         if ($houseComboInfo->state == Model_Combo_HouseRelation::ENUM_HOUSE_ONLINE) {
             unset($houseIds[$k]);
             continue;
         }
     }
     if (empty($houseIds)) {
         $this->outPut(0, '房源信息有误,请重新选择房源');
     }
     return Bll_Combo_HouseRelation::houseStartComboSpreadV2($this->brokerId, $this->cityId, $houseIds, Bll_Combo_HouseRelation::SITE_TYPE_JP);
 }