예제 #1
0
 /**
  * 针对定价计划的操作
  * 手动暂停,手动开启
  * option = stop or repeat
  * flag 1手动重新推,2限额调整重新推,3充值重新推
  */
 public static function option_fix_plan($broker_id, $plan_id, $option = 'stop', $flag = 1)
 {
     $flag_array = array('status' => 0, 'msg' => '');
     if (empty($broker_id) || empty($plan_id)) {
         $flag_array['msg'] = Const_HzErrorInfo::PARAMS;
         return $flag_array;
     }
     $plan_info = Dao_Broker_HzPlan::get_plan($plan_id);
     if (empty($plan_info)) {
         $flag_array['msg'] = Const_HzErrorInfo::PLANINFOERROR;
         return $flag_array;
     }
     if ($plan_info['user_id'] != $broker_id) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPUSERNULL;
         return $flag_array;
     }
     if ($option == 'repeat') {
         if ($plan_info['status'] == Const_HzPlan::SPREAD) {
             $flag_array['msg'] = Const_HzErrorInfo::PLANFIXING;
             return $flag_array;
         }
         $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($broker_id);
         if ($broker_info['profile_verify'] != 2) {
             Dao_Broker_HzPlan::update_plan_status($plan_id, Const_HzPlan::MANUALLY_PAUSE);
             $flag_array['msg'] = Const_HzErrorInfo::BROKERCHECK;
             return $flag_array;
         }
         $broker_money = Bll_PayAccount::get_broker_balance($broker_id);
         if ($broker_money <= 0) {
             Dao_Broker_HzPlan::update_plan_status($plan_id, Const_HzPlan::UPPERLIMIT);
             $flag_array['msg'] = Const_HzErrorInfo::PLANMONEY;
             return $flag_array;
         }
         $plan_cost = self::get_plan_clickinfo($broker_id, $plan_id);
         if ($plan_info['amount'] <= $plan_cost[$plan_id]['total_cost']) {
             Dao_Broker_HzPlan::update_plan_status($plan_id, Const_HzPlan::AUTOOVER);
             $flag_array['msg'] = Const_HzErrorInfo::PLANAMOUNT;
             return $flag_array;
         }
     }
     if ($option == 'stop' && $plan_info['status'] != Const_HzPlan::SPREAD) {
         $flag_array['msg'] = Const_HzErrorInfo::PLANSTOPING;
         return $flag_array;
     }
     $prop_option = $option == 'stop' ? Const_HzLog::MANUPAUSEPLANPROP : Const_HzLog::RESPREADPLANPROP;
     $status = $option == 'stop' ? Const_HzStatus::MANUALLY : Const_HzStatus::ONLINE;
     $plan_status = $option == 'stop' ? Const_HzPlan::MANUALLY_PAUSE : Const_HzPlan::SPREAD;
     $plan_option = $option == 'stop' ? Const_HzLog::MANUPAUSEPLAN : Const_HzLog::RESPREADPLAN;
     if ($option == 'repeat') {
         if ($flag == 1) {
             $plan_option = Const_HzLog::RESPREADPLAN;
         } else {
             if ($flag == 2) {
                 $plan_option = Const_HzLog::REPEATCHANGEPRICE;
             } else {
                 if ($flag == 3) {
                     $plan_option = Const_HzLog::REPEATRECHARGE;
                 }
             }
         }
     }
     $plannings = Dao_Broker_HzPlan::get_planning($plan_id);
     $proids = array();
     foreach ($plannings as $planning) {
         $proids[] = $planning['proid'];
     }
     $proids_str = implode(',', $proids);
     $proinfo = Dao_Broker_HzProp::get_prop($proids);
     foreach ($plannings as $planning) {
         $basic_info = $proinfo[$planning['proid']]['content_basic'];
         //更新房源计划信息
         if (Dao_Broker_HzProp::change_prop_status($planning['proid'], $status)) {
             //更新房源状态
             if (Dao_Broker_HzPlan::update_planning($planning['id'], $plan_status)) {
                 //更新关联关系
                 Dao_Broker_HzPlan::add_prop_log($planning['proid'], $prop_option, $basic_info['userid'], $plan_id, $basic_info['status'], $status);
                 //记房源日志
                 if ($status == Const_HzStatus::ONLINE && $basic_info['status'] != Const_HzStatus::ONLINE) {
                     //插入solr队列,房源上线
                     Dao_Broker_HzProp::into_prop_lucene($planning['proid'], $basic_info['cityid'], 1);
                 }
                 //记录房源下线日志
                 if ($status != Const_HzStatus::ONLINE && $basic_info['status'] == Const_HzStatus::ONLINE) {
                     //房源下线,插入solr队列
                     Dao_Broker_HzProp::into_prop_lucene($planning['proid'], $basic_info['cityid'], 2);
                     Dao_Broker_HzProp::ezft_assistant_log($planning['proid'], $basic_info['userid'], Const_HzPlan::SPREAD_TYPE, $basic_info['spread_type']);
                 }
                 //房源上下线日志
                 Dao_Broker_HzProp::add_updown_log($planning['proid'], $plan_id, Const_HzStatus::GOONLINE, $prop_option);
             }
         }
     }
     //更新计划
     Dao_Broker_HzPlan::update_plan_status($plan_id, $plan_status);
     //计划日志
     Dao_Broker_HzPlan::add_plan_log($plan_id, $proids_str, $plan_option, 1, $broker_id, 0, $plan_info['status'], $plan_status);
     $flag_array['status'] = 1;
     return $flag_array;
 }
예제 #2
0
 public static function change_bid_offer($plan_id, $new_offer)
 {
     $flag_array = array('status' => 0, 'msg' => '');
     $plan_info = Dao_Broker_HzPlan::get_plan($plan_id);
     if (empty($plan_info)) {
         $flag_array['msg'] = Const_HzErrorInfo::NULLPLAN;
         return $flag_array;
     }
     $planning = Dao_Broker_HzPlan::get_planning($plan_id, Const_HzPlan::BID_TYPE, 1);
     $planning = $planning[0];
     if (empty($planning)) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPFIXNULL;
         return $flag_array;
     }
     if ($planning['unit_price'] == $new_offer) {
         $flag_array['status'] = 1;
         return $flag_array;
     }
     $bid_min_offer = self::get_bid_minoffer($planning['proid']);
     if ($new_offer < $bid_min_offer) {
         $flag_array['msg'] = Const_HzErrorInfo::BIDOFFERFAIL;
         return $flag_array;
     }
     if ($new_offer > $plan_info['amount']) {
         $flag_array['msg'] = Const_HzErrorInfo::BIDOFFERTOP;
         return $flag_array;
     }
     $log_option = Const_HzLog::BIDUPDATE;
     if (Dao_Broker_HzPlan::update_planning_offer($planning['id'], $new_offer)) {
         //更新出价
         Dao_Broker_HzPlan::add_plan_log($plan_id, $planning['proid'], $log_option, 2, $planning['user_id'], 0, $plan_info['status'], $plan_info['status']);
         //记录日志
         Dao_Broker_HzProp::into_prop_lucene($planning['proid'], $planning['city_id'], 1);
         //更新房源
         $flag_array['status'] = 1;
         return $flag_array;
     }
     $flag_array['msg'] = Const_HzErrorInfo::DATAFAIL;
     return $flag_array;
 }
예제 #3
0
 /**
  * 通知solr处理
  *
  * <ol>
  * <li>
  * 当房源日志type为房源更新(4),房源推广(5)时,14-精选推广,通知solr更新
  * </li>
  * <li>
  * 当房源日志type为取消推广(6),第二天推广(7),取消第二天推广(12)时,15-取消精选推广,16-取消精选排队通知solr删除
  * </li>
  * </ol>
  */
 public function noticeSolrZf($record)
 {
     $type = $record['type'];
     if ($type == 4 || $type == 5 || $type == 14) {
         $updateType = 1;
         //add
     } elseif ($type == 6 || $type == 7 || $type == 12 || $type == 15 || $type == 16) {
         //租房比较坑爹,定价、竞价其中任意一个还在推广都不能通知下
         //查询房源状态 TODO 需要换成查询计划
         // 最好取master。 如延迟是致命的
         $hz_pro_info = Model_House_HzProp::get_prop_info_by_prop_id($record['houseId'], true);
         if ($hz_pro_info['contentBasic']['status'] == 1) {
             //房源在推广
             $updateType = 1;
             //add
         } else {
             $updateType = 2;
             //delete
         }
     } else {
         //记录处理日志
         $this->setLog('不需要做solr处理' . __METHOD__);
         return true;
     }
     $result = Dao_Broker_HzProp::into_prop_lucene($record['houseId'], $record['cityId'], $updateType);
     if ($result) {
         $tmp_str = '';
         if ($updateType == 1 && in_array($type, array(6, 7, 12))) {
             $tmp_str = ' 竞价或精选还在推广';
         }
         //记录处理日志
         $this->setLog('solr处理成功 ' . $tmp_str);
         return true;
     } else {
         //记录处理日志
         $this->setLog('房源[%d]solr处理失败 ');
         return false;
     }
 }
예제 #4
0
 public function dealTask($task)
 {
     $solrOnProId = $task['id'];
     //1:老端口房源(安居客经纪人发的租房房源)
     //3:租房经纪人房源
     //0:个人房源
     $from = $task['from'];
     if ($from == 1) {
         return true;
     }
     // 查主表获取cityId 如果没有则标记邮件发出
     $propInfo = Model_House_HzProp::get_prop_info_by_prop_id($solrOnProId);
     if ($propInfo && $propInfo['contentBasic']['status'] == 1) {
         $this->proceLog .= 'remark 房源推广中';
         return true;
     }
     // 房源没有或者不在线 通知solr下  且发邮件
     $type = 2;
     if ($from == 0) {
         $type = 1;
     }
     // 个人房源
     // 如果新端口 走中间件
     if (Bll_City::isComboCity($task['city_id'])) {
         Bll_Combo_NoticeSolrUpDown::noticeComboSolrHzAPI($task['city_id'], $propInfo['contentBasic']['userid'], $solrOnProId, 2, $type);
     } else {
         Dao_Broker_HzProp::into_prop_lucene($solrOnProId, $task['city_id'], 2, $type);
     }
     if (empty($propInfo)) {
         $this->proceLog .= 'remark 房源未找到';
         $this->emptyPropIds[] = $solrOnProId;
     } else {
         $this->proceLog .= 'remark 房源非推广 status:' . $propInfo['contentBasic']['status'];
         $this->errorPropIds = $solrOnProId;
     }
     return true;
 }
예제 #5
0
 /**
  * @param $ajkPropSpread
  * @param int $doBucket 0-不处理,1-坑位数加一,-1-坑位数减一
  * @return bool
  * 精选计算排名
  */
 public function choiceComputeRank($blockId, $priceId)
 {
     //获取坑位表信息
     $bucketInfo = Model_Choice_HzBidBucket::get_bucket_info($blockId, $priceId);
     if (empty($bucketInfo)) {
         return array('未知的坑位表信息,blockId:' . $blockId . ' priceId:' . $priceId);
     }
     //获取坑里面的推广、排队的计划
     $bidPlanInfo = Model_Plan_HzPlanBasic::getChoiceQueuePlanByBucket($blockId, $priceId, array(Const_HzPlan::SPREAD, Const_HzPlan::WAITING));
     if (empty($bidPlanInfo)) {
         return array('未获取到同板块、价格段的房源。blockId:' . $blockId . ' priceId:' . $priceId);
     }
     $tmpRemark = array();
     //遍历坑里面的数据,计算排名
     foreach ($bidPlanInfo as $key => $list) {
         $broker = Model_Broker_MainBusiness::getMainBusinessByHzBrokerId($list['user_id'], false);
         if ($key < $bucketInfo['maxOnlineNum']) {
             //预期推广中的数据
             if ($list['status'] == Const_HzPlan::WAITING) {
                 //更新租房排队中的计划为推广中
                 Model_Plan_HzPlanBasic::updatePlanStatus($list['id'], Const_HzPlan::SPREAD);
                 //更新租房排队中的计划为推广中
                 Model_Plan_HzPlanning::updatePlanningByPlanId($list['id'], Const_HzPlan::SPREAD, Const_HzPlan::BID_TYPE);
                 //查询精选关系表信息(获取到房源id)
                 $bidPlanProInfo = Model_Plan_HzPlanning::getPlanByPlanId($list['id']);
                 if (!empty($bidPlanProInfo)) {
                     //更新房源状态
                     Dao_Broker_HzProp::change_prop_status($bidPlanProInfo['proid'], Const_HzStatus::ONLINE);
                 }
                 //通知solr队列上
                 Dao_Broker_HzProp::into_prop_lucene($bidPlanProInfo['proid'], $bidPlanProInfo['city_id'], 1);
                 //记录房源日志
                 Model_Log_HouseLogNew::create(array('houseId' => $bidPlanProInfo['proid'], 'planId' => $bidPlanProInfo['plan_id'], 'brokerId' => $broker['ajkBrokerid'], 'cityId' => $bidPlanProInfo['city_id'], 'type' => 14, 'changeType' => '40' . self::$qInfo['actionId'], 'remark' => '计划' . self::$qInfo['planId'] . self::$actionStr[self::$qInfo['actionId']] . ';重新计算价格段内排名,精选推广', 'operatorId' => self::$qInfo['operationId'], 'siteType' => 2), date('Ymd'))->save();
                 $tmpRemark[] = 'planId:' . $bidPlanProInfo['plan_id'] . '变更为推广';
             }
         }
         /* else { //预期排队的数据
                         if ($list['status'] == Const_HzPlan::SPREAD) {
                             //更新租房排队中的计划为推广中
                             Model_Plan_HzPlanBasic::updatePlanStatus($list['id'], Const_HzPlan::WAITING);
                             //更新租房排队中的计划为推广中
                             Model_Plan_HzPlanning::updatePlanningByPlanId($list['id'], Const_HzPlan::WAITING, Const_HzPlan::BID_TYPE);
                             //查询精选关系表信息(获取到房源id)
                             $bidPlanProInfo = Model_Plan_HzPlanning::getPlanByPlanId($list['id']);
                             if (!empty($bidPlanProInfo)) {
                                 //查询定价的信息,定价推广中的话,房源状态更新为1
                                 $fixPlanProInfo = Model_Plan_HzPlanning::getBrokerPro($bidPlanProInfo['proid'], Const_HzPlan::SPREAD_TYPE);
                                 if (isset($fixPlanProInfo[0]['is_valid']) && $fixPlanProInfo[0]['is_valid'] == Const_HzPlan::SPREAD) {
                                     $proStatus = Const_HzStatus::ONLINE; //推广
                                     //更新房源状态
                                     Dao_Broker_HzProp::change_prop_status($bidPlanProInfo['proid'], $proStatus);
                                 }
                             }
         
                             //通知solr队列上
                             Dao_Broker_HzProp::into_prop_lucene($bidPlanProInfo['proid'], $bidPlanProInfo['city_id'], $proStatus);
                             //记录房源日志
                             Model_Log_HouseLogNew::create(array(
                                 'houseId' => $bidPlanProInfo['proid'],
                                 'planId' => $bidPlanProInfo['plan_id'],
                                 'brokerId' => $broker['ajkBrokerid'],
                                 'cityId' => $bidPlanProInfo['city_id'],
                                 'type' => 13, //13-精选排队中,14-精选推广,15-取消精选推广,16-取消精选排队
                                 'changeType' => '40' . self::$qInfo['actionId'],
                                 'remark' => '计划' . self::$qInfo['planId'] . self::$actionStr[self::$qInfo['actionId']] . ';重新计算价格段内排名,精选排队中',
                                 'operatorId' => self::$qInfo['operationId'],
                                 'siteType' => 2,
                             ), date('Ymd'))->save();
         
                             $tmpRemark[] = 'planId:' . $bidPlanProInfo['plan_id'] . '变更为排队中';
                         }
                     }
                     */
     }
     if (empty($tmpRemark)) {
         $tmpRemark[] = '未找到需要变更的计划';
     }
     return $tmpRemark;
 }
예제 #6
0
 public function dealTask($task, $solrProIds)
 {
     $proId = $task['proid'];
     if (in_array($proId, $solrProIds)) {
         return true;
     }
     // 没有则通知solr上  且发邮件
     // 如果新端口 走中间件
     if (Bll_City::isComboCity($task['cityid'])) {
         Bll_Combo_NoticeSolrUpDown::noticeComboSolrHzAPI($task['city_id'], $task['userid'], $proId, 2);
     } else {
         Dao_Broker_HzProp::into_prop_lucene($proId, $task['cityid'], 1);
     }
     $this->errorPropIds[] = $proId;
     return true;
 }
예제 #7
0
 /**
  * @param $proId
  * @param $blockId
  * @param $areaId
  * @param $cityId
  * @return array
  */
 public static function changePropBlock($proId, $blockId, $areaId, $cityId)
 {
     $allReturn = array();
     if (Dao_Broker_HzProp::changePropBlock($proId, $blockId, $areaId)) {
         $allReturn[] = "租房房源ID: " . $proId . ",房源信息更新成功";
         // rebuild solr
         // 在定价
         if (Dao_Broker_HzPlan::get_prop_planning($proId, 1, 1)) {
             $allReturn[] = "租房房源ID: " . $proId . ",房源信息定价需要rebuild";
             if (Dao_Broker_HzProp::into_prop_lucene($proId, $cityId, 1)) {
                 $allReturn[] = "租房房源ID: " . $proId . ",房源信息定价rebuild成功";
             } else {
                 return self::buildReturn(0, "租房房源ID: " . $proId . ",房源信息定价rebuild失败");
             }
         }
         // 在竞价
         if (Dao_Broker_HzPlan::get_prop_planning($proId, 2, 1)) {
             $allReturn[] = "租房房源ID: " . $proId . ",房源信息竞价需要rebuild";
             if (Dao_Broker_HzProp::into_prop_lucene($proId, $cityId, 1)) {
                 $allReturn[] = "租房房源ID: " . $proId . ",房源信息竞价rebuild成功";
             } else {
                 return self::buildReturn(0, "租房房源ID: " . $proId . ",房源信息竞价rebuild失败");
             }
         }
     } else {
         return self::buildReturn(0, "租房房源ID: " . $proId . ",房源信息更新失败");
     }
     return self::buildReturn(1, $allReturn);
 }