/**
  * 由于套餐变更 下掉多余房子
  * @param $brokerId
  * @param $shouldNum
  * @return array
  */
 public static function deleteExtraHouse($brokerId, $shouldNum)
 {
     $allReturn = array();
     // 转好租brokerid
     if (!($hzBrokerId = Model_Broker_HzMapping::get_hz_broker_id($brokerId))) {
         return Util_GlobalFunc::buildReturn(0, "租房-该经纪人:{$brokerId}获取不到租房经纪人id");
     }
     // 获取有效推广关系
     if (!($plannings = Model_Plan_HzPlanning::getPlanningLists(array('user_id' => $hzBrokerId, 'plan_type' => Const_HzPlan::SPREAD_TYPE, 'is_valid' => Const_HzPlan::SPREAD), 1000, array('proid', 'asc')))) {
         return Util_GlobalFunc::buildReturn(0, "租房-该经纪人:{$hzBrokerId}没有有效定价推广关系");
     }
     $num = count($plannings);
     //推广房源数
     echo '正在处理租房 hzBrokerId:' . $hzBrokerId . ',总推广房源数' . $num . ',api中允许推广数量' . $shouldNum . PHP_EOL;
     if ($num > $shouldNum) {
         // 应该下掉多余房子
         $offNum = $num - $shouldNum;
         foreach ($plannings as $key => $planning) {
             if ($offNum < $key + 1) {
                 break;
             }
             // 下房子动作
             $result = Bll_HzFixPlan::prop_out_fix($planning['user_id'], $planning['proid'], $planning['plan_id']);
             $allReturn[] = $result['msg'];
         }
     }
     return Util_GlobalFunc::buildReturn(1, $allReturn);
 }
Exemple #2
0
 /**
  * 查询经纪人新封顶模式信息
  * @param $params
  * @return bool|mixed
  */
 public static function getPpcBrokerLimitInfo($params)
 {
     $apiInfo = self::getBase('service-internal/rest/broker/showBrokerLimitConfig', $params);
     if (!$apiInfo || $apiInfo['status'] != 'ok' || !isset($apiInfo['data']['amountLimit'])) {
         // 获取好租brokerId
         $hzBrokerId = Model_Broker_HzMapping::get_hz_broker_id($params['brokerId']);
         // 取城市封顶
         if ($userInfo = Model_Broker_HzUsersSearch::getUserInfoByUserId($hzBrokerId)) {
             $cityId = $userInfo['cityId'];
             $cityTop = Model_City_CityTopConfig::getCityTopConfig($cityId, date("Ymd"));
         }
         if ($userInfo && $cityTop && $cityTop->money) {
             $cityopMoney = $cityTop->money;
         } else {
             $cityopMoney = -1;
         }
         // 如果一切ok, 无限额情况
         if ($apiInfo && !isset($apiInfo['data']['amountLimit'])) {
             $apiInfo['data']['amountLimit'] = $cityopMoney;
         } else {
             $apiInfo['status'] = 'ok';
             $apiInfo['data']['tempId'] = 0;
             $apiInfo['data']['tempName'] = '无限额';
             $apiInfo['data']['amountLimit'] = $cityopMoney;
             $apiInfo['data']['publishLimit'] = 80;
             $apiInfo['data']['promotionLimit'] = 50;
         }
     }
     return $apiInfo;
 }
Exemple #3
0
 public function beforeHandlerRequest()
 {
     // 获取好租brokerId
     if (!($this->params['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($this->brokerId))) {
         $this->outPut(-1, '获取好租信息失败');
     }
 }
Exemple #4
0
 public function createThreeSiteAccountMust($userId, $ajkBrokerId)
 {
     //查询三网mapping
     $objMapping = Model_Payment_AccountMapping::getAccountMappingByUserId($userId);
     if (!$objMapping || !$objMapping->accountidAjk || !$objMapping->accountidHz || !$objMapping->accountidJp) {
         //获取安居客账户
         $objajkAccount = Model_Payment_AjkUserAccount::getAjkUserAccountByUserId($userId);
         if ($objajkAccount) {
             $ajkAccount = $objajkAccount->accountId;
         } else {
             $ajkAccount = $this->createAjkAccountId($userId);
         }
         //获取租房账户
         $hzBrokerId = Model_Broker_HzMapping::get_hz_broker_id($ajkBrokerId);
         $objHzAccount = Model_Payment_HzUsersAccountMapping::getHzUserAccountByUserId($hzBrokerId);
         if ($objHzAccount) {
             $hzAccount = $objHzAccount->accountId;
         } else {
             $hzAccount = $this->createHzAccountId($hzBrokerId);
         }
         //获取金铺账户
         $objJpMember = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($ajkBrokerId);
         $objJpAccount = Model_Payment_JpPayAccount::getAccountByBrokerId($objJpMember->id);
         if ($objJpAccount) {
             $jpAccount = $objJpAccount->account;
         } else {
             $jpAccount = $this->createJpAccountId($objJpMember->id);
         }
         //创建三网账号
         $this->doCreateThreeSiteAccountMust($userId, $ajkAccount, $hzAccount, $jpAccount, $objMapping);
     }
 }
 /**
  * init env
  * @param AJKRequest $request
  * @param array $out
  * @throws Exception
  */
 private static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     $route_matches = $request->get_router_matches();
     $out['proId'] = trim($route_matches[2], "/ \t\n\r\v");
     if (!$out['proId']) {
         throw new Exception('缺少房源Id参数');
     }
     // 获取好租brokerId
     $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']);
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU);
     $out['isBidCity'] = false;
     // 获取经纪人信息
     if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) {
         throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']');
     }
     // 身份是否通过
     $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']);
     // 获取套餐相关
     //$out['brokerLimitInfo'] = Bll_Broker_BrokerLimit::getPpcBrokerLimitInfo($out['ajkBrokerId'], Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ZF_SITE);
     // 获取经纪人主推房源
     $out['mainSpreadProIds'] = array();
     $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']);
     if ($mainSpreads) {
         foreach ($mainSpreads as $v) {
             $out['mainSpreadProIds'][$v->propId] = $v->propId;
         }
     }
 }
 /**
  * 手动暂停好租经纪人的定价计划
  *
  * @param int $hzBrokerId
  * @param int $cityId
  * @param array $fixPlan
  */
 private function stopHzFixPlan($hzBrokerId, $cityId, $fixPlan)
 {
     $ajkBrokerId = Model_Broker_HzMapping::get_ajk_broker_id($hzBrokerId);
     if ($ajkBrokerId == 0) {
         $this->logMsg(sprintf('经纪人[%d - %d - %d]获取经纪人ajkBrokerId失败。', $cityId, $hzBrokerId, $fixPlan['id']));
     }
     $this->logMsg(sprintf('经纪人[%d - %d - %d]的好租定价计划,处理开始。', $cityId, $ajkBrokerId, $hzBrokerId));
     $data = array('houseId' => 0, 'planId' => 0, 'brokerId' => $ajkBrokerId, 'cityId' => $cityId, 'type' => 207, 'remark' => '切新端口,暂停定价计划', 'flag' => 0, 'addDate' => time(), 'dealRemark' => '', 'operateId' => 0, 'from' => __METHOD__, 'siteType' => 2);
     $this->logMsg(json_encode($fixPlan));
     if ($fixPlan['status'] == Const_HzPlan::MANUALLY_PAUSE) {
         $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d]已经手动暂停,不做处理。', $cityId, $hzBrokerId, $ajkBrokerId, $fixPlan['id']));
         return;
     }
     if (false == Bll_HzFixPlan::stopPlanByHand($fixPlan['id'])) {
         $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d - %d]手动暂停失败。', $cityId, $hzBrokerId, $ajkBrokerId, $fixPlan['id'], $fixPlan['status']));
         return;
     }
     $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d - %d]手动暂停成功。', $cityId, $hzBrokerId, $ajkBrokerId, $fixPlan['id'], $fixPlan['status']));
     if ($fixPlan['status'] != Const_HzPlan::SPREAD) {
         $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d]已经暂停,不通知上下架。', $cityId, $hzBrokerId, $ajkBrokerId, $fixPlan['id']));
         return;
     }
     /**
      * 记录上下架队列
      */
     $data['planId'] = $fixPlan['id'];
     if (!Model_House_UpDown_Task::create($data, date('Ymd'))->save()) {
         $this->logMsg(sprintf('%s 记录上下架队列失败。', json_encode($data)));
     } else {
         $this->logMsg(sprintf('%s 记录上下架队列成功。', json_encode($data)));
     }
     $this->logMsg(sprintf('经纪人[%d - %d - %d]的好租定价计划,处理结束。', $cityId, $hzBrokerId, $hzBrokerId));
 }
 /**
  * init env
  * @param $request
  * @param $out
  * @throws Exception
  */
 private static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     // 获取好租brokerId
     $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']);
     // 获取账户余额
     $balance = Bll_Broker_HzBroker::getAccountInfo($out['ajkBrokerId'], 'balance');
     if (!$balance['status']) {
         throw new Exception_BllErrorException($balance['msg']);
     }
     $out['validMoney'] = $balance['msg'] ? round($balance['msg'] / 100, 2) : 0;
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU);
     $out['isBidCity'] = false;
     $out['isShowCaseCity'] = Bll_City::isShowCaseCity($out['cityId'], Const_Site::HAOZU);
     // 获取经纪人信息
     if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) {
         throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']');
     }
     // 身份是否通过
     $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']);
     // 获取套餐相关
     $out['brokerLimitInfo'] = Bll_Broker_BrokerLimit::getPpcBrokerLimitInfo($out['ajkBrokerId'], Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ZF_SITE);
     // 获取经纪人主推房源
     $out['mainSpreadProIds'] = array();
     $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']);
     if ($mainSpreads) {
         foreach ($mainSpreads as $v) {
             $out['mainSpreadProIds'][$v->propId] = $v->propId;
         }
     }
 }
 /**
  * 通知SOLR下架房源
  *
  * @param $cityId
  * @param $hzBrokerId
  * @param $houseId
  * @param int $ajkBrokerId
  */
 private function noticeComboSolr($cityId, $hzBrokerId, $houseId, $ajkBrokerId = 0)
 {
     if ($ajkBrokerId == 0) {
         $ajkBrokerId = Model_Broker_HzMapping::get_ajk_broker_id($hzBrokerId);
     }
     $result = Bll_Combo_NoticeSolrUpDown::noticeChoiceSolrZfAPI($cityId, $ajkBrokerId, $houseId, 2, Bll_Combo_NoticeSolrUpDown::SOLR_ACTION_DOWN, Bll_Combo_NoticeSolrUpDown::HLS_FROM_HOUSE_STATE_REPAIR);
     $this->setLog(sprintf('通知房源[%d]solr下架,result: %s', $houseId, json_encode($result)));
 }
Exemple #9
0
 public function beforeHandlerRequest()
 {
     if (!Bll_City::isBidCity($this->cityId, Const_Site::HAOZU)) {
         $this->outPut(-1, '未开通竞价业务');
     }
     // 获取好租brokerId
     if (!($this->params['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($this->brokerId))) {
         $this->outPut(-1, '获取好租信息失败');
     }
 }
Exemple #10
0
 /**
  * 基础权限判断模块
  */
 public function basicCheck()
 {
     $ajkBrokerId = $this->requestObj->getBrokerId();
     $cityId = $this->requestObj->getBrokerCityId();
     $this->ctx = $this->requestObj->get_parameters();
     // 非登陆者
     if (!$ajkBrokerId) {
         $this->responseObj->redirect(Uri_MemberUrl::build_login_url($this->currentUrl));
     }
     if (!($hzBrokerId = Model_Broker_HzMapping::get_hz_broker_id($ajkBrokerId))) {
         $this->redirect2Result(Const_PublishCode::UNKNOWN_ERROR, $this->site, $this->action);
     }
     $routeMatches = $this->requestObj->get_router_matches();
     $this->ctx['proId'] = isset($routeMatches[3]) ? (int) $routeMatches[3] : 0;
     $this->ctx['isEdit'] = (int) ($this->ctx['proId'] > 0);
     // ppc 没有计划 初始化个
     $planId = 0;
     $planStatus = 1;
     if (!($isComboCity = Bll_City::isComboCity($cityId))) {
         $validFixPlans = Bll_Plan_Fix_HzFix::getValidPlansByBrokerId($hzBrokerId);
         if (empty($validFixPlans)) {
             $createPlanResult = Bll_Plan_Fix_HzFix::createPlan($ajkBrokerId, $cityId, '定价推广组');
             if (!$createPlanResult['status']) {
                 $this->redirect2Result(Const_PublishCode::CREATE_PLAN_ERROR, $this->site, $this->action);
             }
             $planId = $createPlanResult['msg']['id'];
         } else {
             $planId = $validFixPlans[0]['id'];
             $planStatus = $validFixPlans[0]['status'];
         }
     }
     $this->ctx['hzBrokerId'] = $hzBrokerId;
     $this->ctx['ajkBrokerId'] = $ajkBrokerId;
     $this->ctx['isFixCity'] = (int) (!$isComboCity);
     $this->ctx['isComboCity'] = (int) $isComboCity;
     $this->ctx['cityId'] = $cityId;
     // 发房数判断
     $propNums = count(Bll_House_HzHouse::getValidPropsByBrokerIdEx($this->ctx['ajkBrokerId'], $this->ctx['cityId'], false));
     // 获取套餐相关
     //        $brokerLimitInfo = Bll_Broker_BrokerLimit::getPpcBrokerLimitInfo($ajkBrokerId, Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ZF_SITE);
     $proLimitInfo = Bll_Onoff_Prop::getPropLimit($this->ctx['cityId'], "hz");
     if (!$this->ctx['isEdit'] && $propNums >= $proLimitInfo['data']['publishLimit']) {
         $this->redirect2Result(Const_PublishCode::PUBLISH_OUT_OF_LIMIT, $this->site, $this->action);
     }
     // 伪登陆操作限制
     $managerCookie = $this->requestObj->get_cookie('manager_id');
     $this->ctx['isManagerCookie'] = $managerCookie ? true : false;
     $this->ctx['planId'] = $planId;
     $this->ctx['planStatus'] = $planStatus;
     $this->ctx['brokerLimitInfo'] = $proLimitInfo['data'];
     $this->ctx['debug'] = isset($_GET['debug']) ? trim($_GET['debug']) : false;
     return true;
 }
 public function dealTask($task)
 {
     // 获取ajkBrokerId
     if (!($ajkBrokerId = Model_Broker_HzMapping::get_ajk_broker_id($task['userid']))) {
         printf('获取二手房brokerId失败, hzBrokerId: %s ' . PHP_EOL, $task['userid']);
         return false;
     }
     // 重新通知上下架房子删除
     Bll_Combo_HouseRelation::notifyHouseUpDownTask($ajkBrokerId, $task['proid'], $task['cityid'], Bll_Combo_HouseRelation::SITE_TYPE_HZ, 105, '房源状态为4,由job通知上下架房子删除', __METHOD__, $ajkBrokerId);
     printf('房源 %s 成功通知上下架队列' . PHP_EOL, $task['proid']);
     return true;
 }
Exemple #12
0
 /**
  * @param AJKRequest $request
  * @param array $out
  * @throws Exception
  */
 public static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     // 获取好租brokerId
     $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']);
     // 获取账户余额
     /*$balance = Bll_Broker_HzBroker::getAccountInfo($out['ajkBrokerId'], 'balance');
       if (!$balance['status'])
           throw new Exception_BllErrorException($balance['msg']);
       $out['validMoney'] = $balance['msg'] ? round($balance['msg'] / 100, 2) : 0;
       */
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU);
     $out['isBidCity'] = false;
     $out['isShowCaseCity'] = Bll_City::isShowCaseCity($out['cityId'], Const_Site::HAOZU);
     $out['bidTip'] = '精选';
     // 获取经纪人信息
     if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) {
         throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']');
     }
     // 身份是否通过
     $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']);
     // 获取该经纪人房源
     $out['props'] = Bll_House_HzHouse::getValidPropsByBrokerIdEx($out['ajkBrokerId'], $out['cityId']);
     // 获取改经纪人所有房源质量
     //$out['propsQuality'] = Model_Stats_HzPropQuality::getPropsquality(array_keys($out['props']));
     $out['propsQuality'] = static::getHzPropsQuality($out['props']);
     if (count($out['props']) > 0) {
         foreach ($out['props'] as $proId => $prop) {
             $out['props'][$proId]['proId'] = $proId;
             // 获取剩余时间
             $out['props'][$proId]['leftDays'] = Bll_House_HzHouse::getLeftDays($prop['created']);
             // 是否手机房源
             $out['props'][$proId]['isMobileProp'] = Bll_House_HzHouse::isMobileProp($prop['from'] ? $prop['from'] : '');
         }
     }
     // 获取经纪人主推房源
     $out['mainSpreadProIds'] = array();
     $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']);
     if ($mainSpreads) {
         foreach ($mainSpreads as $v) {
             $out['mainSpreadProIds'][$v->propId] = $v->propId;
         }
     }
 }
 /**
  * 修复 `broker_mapping` 表
  *
  * @param $hzBrokerId
  * @param $ajkBrokerId
  * @return bool
  */
 private function repairBrokerMapping($hzBrokerId, $ajkBrokerId)
 {
     $ajkBrokerIdTmp = Model_Broker_HzMapping::get_ajk_broker_id($hzBrokerId);
     $hzBrokerIdTmp = Model_Broker_HzMapping::get_hz_broker_id(${$ajkBrokerId});
     /** 经纪人映射关系正确 */
     if ($ajkBrokerId == $ajkBrokerIdTmp && $hzBrokerId == $hzBrokerIdTmp) {
         return true;
     }
     Model_Broker_HzMapping::deleteByHzBrokerId($hzBrokerId);
     Model_Broker_HzMapping::deleteByAjkBrokerId($ajkBrokerId);
     if (Model_Broker_HzMapping::addMapping($hzBrokerId, $ajkBrokerId) == 1) {
         $this->log(sprintf('经纪人关系(%d, %d)映射添加成功', $hzBrokerId, $ajkBrokerId));
         return true;
     }
     $this->log(sprintf('经纪人关系(%d, %d)映射添加失败', $hzBrokerId, $ajkBrokerId));
     return false;
 }
 private function hzAction($brokerId, $params)
 {
     // 获取好租brokerId
     $hzBrokerId = Model_Broker_HzMapping::get_hz_broker_id($brokerId);
     if (empty($hzBrokerId)) {
         return false;
     }
     $houseId = $params['propId'];
     $dateStr = $params['date'];
     $date = str_replace('.', '', $dateStr);
     //获取租房精选点击明细
     $getChoiceClickDetails = Model_Choice_HzPropClickDetails::getChoiceClickDetailsInfo($hzBrokerId, $houseId, $date);
     $result = array();
     foreach ($getChoiceClickDetails as $click) {
         $result[] = date('H:i:s', $click['clickTime']);
     }
     echo json_encode($result);
     return false;
 }
Exemple #15
0
 /**
  * 租房精选房源取消推广
  * 1. 维护计划状态
  * 2. 通知solr上下
  */
 public static function choicePropOutBid($broker_id, $proid)
 {
     $flag_array = array('status' => 0, 'msg' => '');
     //获取精选 房源、计划关系表信息(promotion_prop_planning)
     $planning = Dao_Broker_HzPlan::get_prop_all_planning($proid, Const_HzPlan::BID_TYPE);
     if (empty($planning)) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPFIXNULL;
         return $flag_array;
     }
     //根据计划查询精选计划的信息
     $plan_info = Dao_Broker_HzPlan::get_plan($planning[0]['plan_id']);
     if (empty($plan_info)) {
         $flag_array['msg'] = Const_HzErrorInfo::NULLPLAN;
         return $flag_array;
     }
     //判断计划是否为该经纪人的
     if ($plan_info['user_id'] != $broker_id) {
         $flag_array['msg'] = Const_HzErrorInfo::PLANINFOERROR;
         return $flag_array;
     }
     //获取精选计划的冻结号
     $sn = Dao_Broker_HzPlan::get_bid_sn($plan_info['id']);
     $sn = $sn['sn'];
     if (empty($sn)) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPERROR;
         return $flag_array;
     }
     //获取精选花费
     // $amount = $plan_info['total_consume'];
     $amount = $plan_info['amount'] - $plan_info['total_consume'];
     $note = urlencode('推广房源' . $proid);
     $user_id = Bll_HzBroker::get_userid_by_hzbrokerid($broker_id);
     /** 精选结算 调用3次 */
     $charge_sn = false;
     $unfreezeOrderData = array('userId' => $user_id, 'proId' => $proid, 'serialNumber' => $sn, 'planId' => $plan_info['id'], 'amount' => $amount);
     $unfreezeOrder = Bll_Ppc_BidUnfreeze::createHzOrder($unfreezeOrderData);
     for ($i = 0; $i < 3 && !$charge_sn; $i++) {
         $charge_sn = Bll_PayAccount::cancel_frozen($user_id, $amount, $proid, Const_PaymentApp::HZ_CHOICE, $sn, $note, true);
     }
     if (!$charge_sn) {
         $unfreezeOrder->fail();
         $flag_array['msg'] = Const_HzErrorInfo::CHARGEFAIL;
         // 此处不需要block,由job保证此处解冻正确
         //return $flag_array;
     } else {
         $unfreezeOrder->complete();
     }
     //查询房源信息
     $proInfo = Model_House_HzProp::get_prop_info_by_prop_id($proid);
     //房源违规的、删除的不能更新房源状态
     $prop_status = $proInfo['contentBasic']['status'];
     // 兼容新套餐
     $ajkBrokerId = Model_Broker_HzMapping::get_ajk_broker_id($broker_id);
     if (Bll_Broker_HzBroker::isComboBroker($ajkBrokerId)) {
         /** 判断房源是否在套餐推广中 */
         if (!Bll_Combo_HouseRelation::getOnlineRelationByHouseId($proid, Bll_Combo_HouseRelation::SITE_TYPE_HZ)) {
             $prop_status = Const_HzStatus::OUTLINE;
         }
     } else {
         //查询房源是否在计划里面
         $fix_planning = Dao_Broker_HzPlan::get_prop_planning($proid, Const_HzPlan::SPREAD_TYPE);
         if (!in_array($proInfo['contentBasic']['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) {
             if (empty($fix_planning)) {
                 //房源不在计划里面
                 $prop_status = Const_HzStatus::OUTLINE;
                 //房源不在计划里面
             } elseif ($fix_planning[0]['is_valid'] == Const_HzPlan::SPREAD) {
                 $prop_status = Const_HzStatus::ONLINE;
                 //定价正在推广
             } elseif ($fix_planning[0]['is_valid'] == Const_HzPlan::UPPERLIMIT) {
                 //定价非推广(没钱状态)
                 $prop_status = Const_HzStatus::NOCASH;
                 //房源没钱
             } else {
                 $prop_status = Const_HzStatus::MANUALLY;
                 //房源状态更新为9手动停止
             }
         }
     }
     //维护精选关联关系
     if (!Dao_Broker_HzPlan::update_planning($planning[0]['id'], Const_HzPlan::MENUOVER)) {
         $flag_array['msg'] = Const_HzErrorInfo::UPDATAPLANNINGFAIL;
         return $flag_array;
     }
     //维护计划状态
     if (!Dao_Broker_HzPlan::update_plan_status($plan_info['id'], Const_HzPlan::MENUOVER)) {
         $flag_array['msg'] = Const_HzErrorInfo::UPDATAPLANFAIL;
         return $flag_array;
     }
     //通知solr
     if ($prop_status == Const_HzStatus::ONLINE) {
         //定价正在推广
         Dao_Broker_HzProp::into_prop_lucene($proid, $planning[0]['city_id'], 1);
         //竞价下,定价还在线。则更新上
     } else {
         Dao_Broker_HzProp::into_prop_lucene($proid, $planning[0]['city_id'], 2);
         //下线房源
     }
     $flag_array['status'] = 1;
     return $flag_array;
 }
Exemple #16
0
 /**
  * 将单个房源从定价组中移除
  */
 public static function prop_out_fix($broker_id, $proid, $plan_id)
 {
     $flag_array = array('status' => 0, 'msg' => '');
     $proinfo = Dao_Broker_HzProp::get_prop($proid);
     if (empty($proinfo[$proid])) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPNULL;
         return $flag_array;
     }
     $plan_info = Dao_Broker_HzPlan::get_plan($plan_id);
     if (empty($plan_info)) {
         $flag_array['msg'] = Const_HzErrorInfo::NULLPLAN;
         return $flag_array;
     }
     if ($plan_info['user_id'] != $broker_id) {
         $flag_array['msg'] = Const_HzErrorInfo::PLANINFOERROR;
         return $flag_array;
     }
     if ($proinfo[$proid]['content_basic']['userid'] != $plan_info['user_id']) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPUSERNULL;
         return $flag_array;
     }
     $planning = Dao_Broker_HzPlan::get_check_planning($proid, $plan_id);
     if (empty($planning)) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPFIXNULL;
         return $flag_array;
     }
     //写入定价上下架队列表
     $ProPlanChangeApiBll = Bll_ProPlanChangeApiBll::get_instance();
     $ajkBrokerId = Model_Broker_HzMapping::get_ajk_broker_id($broker_id);
     $ProPlanChangeApiBll->insertProPlanChange(array('broker_id' => $ajkBrokerId, 'pro_id' => $proid, 'plan_id' => $plan_id, 'type' => 'pro_del_from_plan', 'from' => 'hz_' . __CLASS__ . '_' . __FUNCTION__, 'remark' => json_encode(array('fix' => array('plan_status' => 1))), 'site_type' => 2), $ajkBrokerId);
     $bid = Dao_Broker_HzPlan::get_prop_planning($proid, Const_HzPlan::BID_TYPE, '1');
     if (!empty($bid)) {
         //停止竞价
         $deleteBidResult = Bll_HzBidPlan::delete_bid($broker_id, $bid[0]['plan_id'], $proid);
     }
     $log_option = Const_HzLog::PAUSEPLAN;
     $new_is_valid = Const_HzPlan::MENUPAUSE;
     $basic_info = $proinfo[$proid]['content_basic'];
     //更新房源计划信息
     if (Dao_Broker_HzProp::change_prop_status($proid, Const_HzStatus::OUTLINE)) {
         //更新房源状态
         if (Dao_Broker_HzPlan::update_planning($planning[0]['id'], $new_is_valid)) {
             //更新关联关系
             Dao_Broker_HzPlan::add_prop_log($proid, $log_option, $basic_info['userid'], $plan_id, $basic_info['status'], Const_HzStatus::OUTLINE);
             //记房源日志
             if ($basic_info['status'] == Const_HzStatus::ONLINE) {
                 //插入solr队列,房源下线
                 Dao_Broker_HzProp::into_prop_lucene($proid, $basic_info['cityid'], 2);
                 //写日志
                 Dao_Broker_HzProp::ezft_assistant_log($planning[0]['proid'], $basic_info['userid'], Const_HzPlan::SPREAD_TYPE, $basic_info['spread_type']);
                 Dao_Broker_HzProp::add_updown_log($planning[0]['proid'], $plan_id, Const_HzStatus::GOOFFLINE, $log_option);
             }
             $flag_array['status'] = 1;
             return $flag_array;
         }
     }
     $flag_array['msg'] = Const_HzErrorInfo::DATAFAIL;
     return $flag_array;
 }
Exemple #17
0
 /**
  * 精选房源设置
  *
  * @param $ajk_broker_id
  * @param $city_id
  * @param $prop_id
  * @param array $params
  *
  * @return array
  */
 public static function hz_setting_post($ajk_broker_id, $city_id, $prop_id, $params = array())
 {
     //获取精选推广预算
     $brokerInfo = Bll_BrokerBaseBll::get_instance()->get_broker_info($ajk_broker_id);
     $brokerCompanyId = $brokerInfo['BaseInfo']['COMPANYID'];
     $choiceSet = APF::get_instance()->get_config('choice_set');
     if (isset($choiceSet[$brokerCompanyId]) && !empty($choiceSet[$brokerCompanyId])) {
         $min_budget = $choiceSet[$brokerCompanyId]['hz']['HZ_CHOICE_MIN_BUDGET'];
         $max_budget = $choiceSet[$brokerCompanyId]['hz']['HZ_CHOICE_MAX_BUDGET'];
     } else {
         $min_budget = $choiceSet['default']['hz']['HZ_CHOICE_MIN_BUDGET'];
         $max_budget = $choiceSet['default']['hz']['HZ_CHOICE_MAX_BUDGET'];
     }
     if ($params['budget'] < $min_budget || $params['budget'] > $max_budget) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '推广预算,最低' . $min_budget . '安币,最高' . $max_budget . '安币');
     }
     $result = array();
     $hz_broker_id = Model_Broker_HzMapping::get_hz_broker_id($ajk_broker_id);
     if (0 == $hz_broker_id) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '您不是好租经纪人');
     }
     /** 判断房源是否可以精选 */
     $checkProp = Bll_HzBidPlan::checkPropCanChoice($ajk_broker_id, $city_id, $prop_id);
     if ($checkProp['err_no'] != 0) {
         return $checkProp;
     }
     /** 防并发 */
     if (false === self::rejectSameRequest(Bll_Plan_Bid_Choice::SITE_HAOZU, $ajk_broker_id, $prop_id)) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '系统繁忙(code:-906)');
     }
     /** 获取房源基本信息 */
     $propInfo = Model_House_HzProp::get_prop_info_by_prop_id($prop_id);
     /** 获取点击单价 */
     try {
         /**
          * @var Bll_Service_Client_HttpResponse $clickPrice
          */
         for ($i = 0; $i < 3; $i++) {
             $clickPrice = Bll_Service_Choice::hzClickPrice(array('brokerId' => $ajk_broker_id, 'cityId' => $city_id, 'price' => (int) $propInfo['contentBasic']['pricenum'], 'blockId' => $propInfo['contentBasic']['blockid']));
             if ($clickPrice->isSucceeded()) {
                 break;
             }
         }
         if (!$clickPrice->isSucceeded() || $clickPrice['status'] == 'error') {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '系统繁忙(code:-' . __LINE__ . ')');
         }
         if ($params['budget'] * 100 < $clickPrice['realTradeAmount']) {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '推广预算不能小于点击单价');
         }
         /** 点击单价不能小于当前系统内的单价 防止恶意操作 */
         if ($params['price'] < $clickPrice['realTradeAmount'] / 100) {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '点击单价错误');
         }
     } catch (Exception $e) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '系统繁忙(code:-' . __LINE__ . ')');
     }
     $block_id = $propInfo['contentBasic']['blockid'];
     $priceIntervalInfo = Model_House_HzPriceChoice::get_price($city_id, $propInfo['contentBasic']['pricenum']);
     if (empty($priceIntervalInfo)) {
         $logContent = sprintf('%s ajkBrokerId=%d hzBrokerId=%d cityId=%d propId=%d blockId=%d priceNum=%s %s', date('Y-m-d H:i:s'), $ajk_broker_id, $hz_broker_id, $city_id, $prop_id, $block_id, $propInfo['contentBasic']['pricenum'], '好租城市的价格段获取失败');
         APF::get_instance()->get_nlogger()->log('好租城市的价格段', $logContent);
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '系统烦忙(code:-' . __LINE__ . ')');
     }
     /** 获取坑位信息 提前判断坑位状态 没有的话会自动初始化一个 */
     $bucketInfo = Bll_Choice_HzBidBucket::getBucketInfo($block_id, $priceIntervalInfo['id']);
     if (empty($bucketInfo)) {
         return array('err_no' => self::BID_WAIT_FAIL, 'err_msg' => '精选房源推广失败');
     }
     /** 精选房源展示推广 */
     if (isset($params['show']) && $params['show'] == 1) {
         $result = array('err_no' => self::BID_SHOW_SUCCESS, 'err_msg' => '精选房源推广成功');
         if ($bucketInfo['usedNum'] >= $bucketInfo['maxOnlineNum']) {
             return array('err_no' => self::BID_SHOW_FAIL, 'err_msg' => '精选房源推广失败');
         }
         /** 展示位 坑位自增 */
         $lockBucket = Model_Choice_HzBidBucket::increment_used_num_online($block_id, $priceIntervalInfo['id']);
         if (!$lockBucket) {
             return array('err_no' => self::BID_SHOW_FAIL, 'err_msg' => '精选房源推广失败');
         }
     } else {
         $result = array('err_no' => self::BID_WAIT_SUCCESS, 'err_msg' => '精选房源推广成功');
         if ($bucketInfo['usedNum'] >= $bucketInfo['totalNum']) {
             return array('err_no' => self::BID_WAIT_FAIL, 'err_msg' => '推广位已满!');
         }
         /** 排队位置 坑位自增 */
         $lockBucket = Model_Choice_HzBidBucket::increment_used_num($block_id, $priceIntervalInfo['id']);
         if (!$lockBucket) {
             return array('err_no' => self::BID_WAIT_FAIL, 'err_msg' => '精选房源推广失败');
         }
     }
     /** 往冻结队列里添加记录,获取request id*/
     $bidFreezeOrder = new Bll_Plan_BidFreezeOrderNum(date('Y'));
     $ajk_user_id = Bll_Broker_MainBusiness::getDataByEsfId($ajk_broker_id)->memberId;
     $requestId = $bidFreezeOrder->getRequestId(Bll_Plan_BidFreezeOrderNum::HZ, $ajk_user_id, date('Y'), 0, $prop_id);
     /** 冻结金额 */
     $freezeResult = self::hz_bid_freeze($ajk_broker_id, $params['budget'] * 100, $requestId, sprintf('好租精选房源冻结,propId: %d', $prop_id));
     if (!$freezeResult->isSucceeded() || $freezeResult['status'] == 'error') {
         Model_Choice_HzBidBucket::decrement_used_num($block_id, $priceIntervalInfo['id']);
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => isset($freezeResult['info']) ? $freezeResult['info'] : '冻结金额失败');
     }
     $sn = $freezeResult['data']['sn'];
     if (!isset($params['plan_id']) || empty($params['plan_id'])) {
         $createdRemark = sprintf('经纪人开始精选房源推广 SN:%s', $sn);
         $resultPlan = Bll_Plan_Bid_HzBid::add_plan($hz_broker_id, $prop_id, $params['price'], $params['budget'], $block_id, $city_id, $sn, $ajk_broker_id);
         /** 添加计划失败 */
         if ($resultPlan['error_code'] != 0) {
             Model_Choice_HzBidBucket::decrement_used_num($block_id, $priceIntervalInfo['id']);
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => $resultPlan['error_message']);
         }
         $planId = $resultPlan['planId'];
     } else {
         $createdRemark = sprintf('经纪人重新推广精选房源 SN:%s', $sn);
         /** 更新精选房源计划预算 */
         $planId = $params['plan_id'];
         $resultPlan = Bll_Plan_Bid_HzBid::update_bid($hz_broker_id, $planId, $prop_id, $params['price'], $params['budget'], $city_id, $sn, $ajk_broker_id);
         if ($resultPlan['error_code'] != 0) {
             Model_Choice_HzBidBucket::decrement_used_num($block_id, $priceIntervalInfo['id']);
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => $resultPlan['error_message']);
         }
         $planId = $resultPlan['planId'];
     }
     $result['rank'] = Bll_Plan_Bid_HzBid::getChoiceWaitPosition($planId, $city_id, $block_id, $priceIntervalInfo['id']);
     /** 精选房源成功 */
     $actionQueueData = array('siteType' => Model_Choice_ActionQueue::ENUM_HAOZU, 'brokerId' => $ajk_broker_id, 'planId' => $planId, 'proId' => $prop_id, 'actionId' => Model_Choice_ActionQueue::ENUM_BEGIN_BY_HAND, 'createTime' => time(), 'createRemark' => $createdRemark, 'operationId' => $ajk_broker_id, 'ip' => $params['ip']);
     Model_Choice_ActionQueue::addBidQueen($actionQueueData);
     $bidFreezeOrder->updateRequestComplete($requestId, $sn, $planId);
     return $result;
 }
Exemple #18
0
 public static function deleteByAjkBrokerId($brokerId)
 {
     try {
         return Model_Broker_HzMapping::data_access()->force_master()->filter('ajkBrokerId', $brokerId)->delete();
     } catch (Exception $e) {
         return 0;
     }
 }
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     //经纪人信息
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $communityList = array();
     $cityId = $brokerInfo->cityId;
     $hzBrokerId = Model_Broker_HzMapping::get_hz_broker_id($brokerId);
     if (Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         /** 租房 */
         $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
         //套餐列表
         $propIds = array();
         foreach ($comboList as $combo) {
             $propIds[] = $combo['houseId'];
         }
         if ($propIds && $hzBrokerId) {
             $hzPropList = Model_House_HzPropSearch::getPropList($propIds, $hzBrokerId, $cityId);
             //房源信息
             foreach ($hzPropList as $list) {
                 //过滤无效房源
                 if (in_array($list['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) {
                     continue;
                 }
                 $row = array();
                 $row['commId'] = $list['commid'];
                 $row['commName'] = $list['commname'];
                 $communityList[$list['commid']] = $row;
             }
         }
         /** 二手房 */
         $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
         if ($comboSpreadHouseList) {
             //获取房源信息
             $propIds = array_keys($comboSpreadHouseList);
             $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
             foreach ($propsInfo as $prop) {
                 $row = array();
                 $row['commId'] = $prop->commId;
                 $row['commName'] = $prop->commName;
                 $communityList[$prop->commId] = $row;
             }
         }
     } else {
         //定价的情况
         $brokerProps = Bll_Broker_HzBroker::getBrokerProps($brokerId, $cityId);
         // 获取房源关系列表
         if ($brokerProps['status']) {
             /** 租房*/
             $brokerProps = $brokerProps['msg'];
             $plans = $brokerProps['plans'][0];
             //定价计划
             $plannings = $brokerProps['plannings'];
             //计划房源关系
             $propsTemp = $brokerProps['props'];
             //定价房源
             if (empty($plans)) {
                 $hzPropList = array();
             } else {
                 $hzPropList = array();
                 foreach ($propsTemp as $prop) {
                     $hzPropList[$prop['proId']] = $prop;
                 }
                 foreach ($plannings as $key => $planning) {
                     // 非有效 过滤掉
                     if (!Bll_HzFixPlan::isValidPlanning($planning['isValid'])) {
                         unset($hzPropList[$planning['proId']]);
                     }
                 }
             }
             foreach ($hzPropList as $prop) {
                 $row = array();
                 $row['commId'] = $prop['commId'];
                 $row['commName'] = $prop['commName'];
                 $communityList[$prop['commId']] = $row;
             }
         }
         /** 二手房*/
         //获取经纪人有效定价计划  计划表
         $fixSpreadPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($brokerId);
         $fixPlanId = $fixSpreadPlanList[0]['id'];
         //关系表中获取房源;
         if ($fixPlanId) {
             $relations = Model_Plan_AjkFixRelation::getRelationListByPlanId($fixPlanId, $cityId);
             $propIds = array();
             foreach ($relations as $relation) {
                 $propIds[] = $relation['proId'];
             }
             if ($propIds) {
                 $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
                 foreach ($propsInfo as $prop) {
                     $row = array();
                     $row['commId'] = $prop->commId;
                     $row['commName'] = $prop->commName;
                     $communityList[$prop->commId] = $row;
                 }
             }
         }
     }
     //对小区按首字母排序
     $communityList = $this->communitySortByCommCode($communityList);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('communityList' => array_values($communityList)));
 }
Exemple #20
0
 /**
  * 经纪人手动删除计划
  * 修改计划的状态为 Const_HzPlan::DELETE
  * 修改房源的状态为
  * @param $ajkBrokerId
  * @param $planId
  * @return array
  */
 public static function deleteChoicePlan($ajkBrokerId, $planId)
 {
     $hzBrockId = Model_Broker_HzMapping::get_hz_broker_id($ajkBrokerId);
     $result = array('status' => 'ok');
     $planInfo = Model_Plan_HzPlanBasic::get_plan_by_id($planId);
     if (empty($planInfo)) {
         return array('status' => 'error', 'msg' => '没有找到计划。');
     }
     if ($planInfo['user_id'] != $hzBrockId) {
         return array('status' => 'error', 'msg' => '计划不属于当前经纪人。');
     }
     if ($planInfo['status'] == Const_HzPlan::SPREAD || $planInfo['status'] == Const_HzPlan::WAITING) {
         return array('status' => 'error', 'msg' => '计划必须先停止才能删除。');
     }
     /** 更新计划状态为手工删除状态 */
     Bll_HzBidPlan::updatePlanStatus($planId, Const_HzPlan::DELETE);
     // Bll_HzBidPlan::deletePlan($planId);
     Model_Plan_HzPlanning::updatePropPlanStatusByPlanId($planId, Const_HzPlan::DELETE);
     return $result;
 }
 /**
  * 根据好租经纪人Id获取二手房经纪人Id
  *
  * @param int $hzBrokerId
  * @return int
  */
 private function getAjkBrokerId($hzBrokerId)
 {
     $ajkBrokerId = Model_Broker_HzMapping::get_ajk_broker_id($hzBrokerId);
     return intval($ajkBrokerId);
 }
Exemple #22
0
 /**
  * 获取好租经纪人的ID
  *
  * @param int $ajkBrokerId
  * @return int
  */
 public static function getBrokerIdByAjkBrokerId($ajkBrokerId)
 {
     return Model_Broker_HzMapping::get_hz_broker_id($ajkBrokerId);
 }
 /**
  * 根据租房经纪人ID获取二手房经纪人ID
  * @param $brokerId
  * @return int
  */
 public static function getAjkBrokerByhzBrokerId($brokerId)
 {
     return Model_Broker_HzMapping::get_ajk_broker_id($brokerId);
 }
 private function moveHzPPCFixPlanRelation($cityId, $hzBrokerId, $fixPlan)
 {
     $ajkBrokerId = Model_Broker_HzMapping::get_ajk_broker_id($hzBrokerId);
     if ($ajkBrokerId == 0) {
         $this->logMsg(sprintf('经纪人[%d - %d]没有获取到二手房经纪人ID。', $cityId, $hzBrokerId));
         return;
     }
     $fixPlanId = $fixPlan['id'];
     $fixPlanHouseRelationList = Model_Plan_HzPlanning::getHouseFixPlanRelation($hzBrokerId, $fixPlanId);
     if (empty($fixPlanHouseRelationList)) {
         $this->logMsg(sprintf('经纪人[%d - %d - %d - %d]没有获取到好租定价计划房源', $cityId, $ajkBrokerId, $hzBrokerId, $fixPlanId));
         return;
     }
     foreach ($fixPlanHouseRelationList as $fixPlanHouseRelation) {
         $comboHouseRelation = Bll_Combo_HouseRelation::getRelationByHouseId($fixPlanHouseRelation['proid'], Model_Combo_HouseRelation::SITE_TYPE_HZ);
         if (!empty($comboHouseRelation)) {
             if ($comboHouseRelation['state'] == Model_Combo_HouseRelation::ENUM_COMBO_EXPIRE) {
                 $this->logMsg(sprintf('房源[%d]的套餐关系存在id[%d],且state==205', $fixPlanHouseRelation['proid'], $comboHouseRelation['id']));
                 continue;
             }
             if (1 == Bll_Combo_HouseRelation::updateComboStatusById($comboHouseRelation['id'], Model_Combo_HouseRelation::ENUM_COMBO_EXPIRE, Model_Combo_HouseRelation::SITE_TYPE_HZ)) {
                 $this->logMsg(sprintf('房源[%d]的套餐关系存在id[%d],更新成功', $fixPlanHouseRelation['proid'], $comboHouseRelation['id']));
             } else {
                 $this->logMsg(sprintf('房源[%d]的套餐关系存在id[%d],更新失败', $fixPlanHouseRelation['proid'], $comboHouseRelation['id']));
             }
             continue;
         }
         $data = array('houseId' => $fixPlanHouseRelation['proid'], 'brokerId' => $ajkBrokerId, 'cityId' => $cityId, 'state' => Model_Combo_HouseRelation::ENUM_COMBO_EXPIRE, 'created' => $fixPlanHouseRelation['last_update']);
         if (1 == Model_Combo_HouseRelation::create($data, Model_Combo_HouseRelation::SITE_TYPE_HZ)->save()) {
             $this->logMsg(sprintf('房源[%d]转移成功', $fixPlanHouseRelation['proid']));
         } else {
             $this->logMsg(sprintf('房源[%d]转移失败', $fixPlanHouseRelation['proid']));
         }
     }
 }
Exemple #25
0
 /**
  * 获取好租点击量
  *
  * @param $params
  * @return array
  */
 private function do_hz_click($params)
 {
     $params['houseid'] = trim($params['houseid'], ',');
     if (empty($params['houseid'])) {
         return array();
     }
     $request = APF::get_instance()->get_request();
     $ajkBrokerId = $request->getBrokerId();
     $brokerId = Model_Broker_HzMapping::get_hz_broker_id($ajkBrokerId);
     $cityId = $request->getBrokerCityId();
     $propId = explode(',', $params['houseid']);
     $clicks = Bll_Plan_Bid_PropClick::getPropClicksByPropId($propId, $brokerId, $cityId);
     return $clicks;
 }