예제 #1
0
 /**
  * 根据金铺的BrokerId 获取 二手房的BrokerId
  *
  * @param int $jpBrokerId
  * @return int
  * @throws Exception
  */
 public static function getAjkBrokerIdByJpBrokerId($jpBrokerId)
 {
     $brokerInfo = Model_Broker_JpBroker::getJpBrokerInfoByPk($jpBrokerId);
     if (is_null($brokerInfo)) {
         throw new Exception(sprintf('没有获取到经纪人信息[%d]', $jpBrokerId));
     }
     return intval($brokerInfo->ajkMemberId);
 }
예제 #2
0
 /**
  * 经纪人操作添加记录
  */
 public function logHouseOperation($houseId, $memberId, $title, $comment = '')
 {
     if (!empty($comment) && strlen($comment) > 2000) {
         $comment = substr($comment, 0, 2000);
     }
     $houseInfo = Model_House_JpHouseIdx::getPropInfoByPk($houseId);
     $DBmember = Model_Broker_JpBroker::getJpBrokerInfoByPk($memberId);
     $PLog = new Model_Log_JpHouseOperation();
     $PLog->house_id = $houseId;
     $PLog->house_type = $houseInfo->houseType;
     $PLog->member_id = $memberId;
     $PLog->operator_id = $memberId;
     $PLog->operator_name = $DBmember->realName;
     $PLog->title = $title;
     $PLog->comment = $comment;
     $PLog->save();
 }
예제 #3
0
 /**
  * 把房源从定价推广中移除
  * @param $objHouse
  * @param int $p_intMemberId
  * @param $log_type:1,手动停止 2,房源过期
  * @return mixed
  */
 public static function removeFixHouseFromSpread($objHouse, $memberId = 0, $log_type = 1)
 {
     $arrResult = Bll_Plan_JpPlanManage::getInstance()->checkSpreadInfo($objHouse->fixSpreadId, $memberId);
     if (!$arrResult['success']) {
         return $arrResult;
     }
     $objSpread = $arrResult['data'];
     //更新计划内房源数
     $objSpread->houseNum = $objSpread->houseNum - 1 > 0 ? $objSpread->houseNum - 1 : 0;
     $objSpread->save();
     //添加统计和队列
     if ($objSpread->status == Model_Plan_Jp::ENUM_STATUS_ONLINE) {
         $jpBrokerInfo = Model_Broker_JpBroker::getJpBrokerInfoByPk($memberId);
         //写入定价上下架队列表
         $ProPlanChangeApiBll = Bll_ProPlanChangeApiBll::get_instance();
         $ProPlanChangeApiBll->insertProPlanChange(array('broker_id' => $jpBrokerInfo->ajkMemberId, 'pro_id' => $objHouse->id, 'plan_id' => $objSpread->id, 'type' => 'pro_del_from_plan', 'from' => 'jp_' . __FUNCTION__, 'remark' => json_encode(array('is_house_online' => $objSpread->status == 2, 'no_budget_date' => $objSpread->noBudgetDate)), 'site_type' => 3), $jpBrokerInfo->ajkMemberId);
         //下架房源
         self::updateHouseIsList($objHouse->id, $objHouse->houseType, 0);
         //记录房源操作
         $intTitle = Const_CrmHouseLog::V_OPERATION_TITLE_OUT_SHELVES;
         $intComment = Const_CrmHouseLog::V_OPERATION_COMMENT_HOUSE_SPREAD_OFFLINE;
         Bll_Log_JpHouse::getInstance()->logHouseOperation($objHouse->id, $objHouse->memberId, $intTitle, $intComment);
         //记录日志
         Bll_Log_JpPlan::getInstance()->writeSpreadHouseLog(1, $objHouse->id, $objHouse->fixSpreadId, 2);
         //更新solr
         Bll_House_JpHouseInfo::updateHouseToSolr(1, $objHouse->id, 1);
         //TO 初始化房源统计日志
         Bll_House_JpBwAnalysis::getInstance()->openSaveBluewhaleHouse($objHouse->id, date('Y-m-d'), $objHouse->fixSpreadId, $objSpread->type);
         //定价房源下线日志
         if ($log_type == 1) {
             $house_log = Model_Log_JpHouseUpDown::ENUM_BID_MEMBER_HOUSE_STOP;
         } elseif ($log_type == 2) {
             $house_log = Model_Log_JpHouseUpDown::ENUM_JOB_HOUSE_EXPIRE;
         }
         Bll_Log_JpHouse::getInstance()->writeHouseLog($objHouse->id, $objHouse->fixSpreadId, 0, $objHouse->memberId, $house_log);
     } else {
         Bll_Log_JpPlan::getInstance()->writeSpreadHouseLog(0, $objHouse->id, $objHouse->fixSpreadId, 2);
     }
     //解除定价推广
     $objHouse->fixSpreadId = 0;
     $objHouse->save();
     return array('success' => true, 'data' => '操作成功');
 }
예제 #4
0
 /**
  * @param $memberId
  * @param $forceMaster
  * @return array
  * @throws Exception
  */
 public function getBrokerFixPlans($memberId, $forceMaster = false)
 {
     $planObj = Model_Plan_Jp::data_access();
     if ($forceMaster) {
         $planObj->force_master();
     }
     $plans = $planObj->filter('memberId', $memberId)->filter('type', Model_Plan_Jp::ENUM_TYPE_FIX)->filter('isDelete', Model_Plan_Jp::ENUM_IS_DELETE_NO)->get_all();
     if (empty($plans)) {
         //定价计划查不到,需要创建
         $memberInfo = Model_Broker_JpBroker::getJpBrokerInfoByPk($memberId);
         $params = array();
         $params['memberId'] = $memberId;
         $params['budget'] = 1000;
         $params['name'] = '定价推广组';
         $params['cityId'] = BLL_House_JpHouseManage::getMemberCityId($memberInfo->cityId);
         $plans = $this->addFixPlan($params);
     }
     return $plans;
 }