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; }
/** * 增加money产生的公共动作 * @param string $descript * @throws Exception_BllErrorException */ private function addMoneyCommon($descript = '') { // 上线前判断余额 Jackin $userId = Bll_Broker_MainBusiness::getDataByEsfId($this->params['ajk_broker_id'])->memberId; try { $balanceInfo = Bll_Service_Payment::balance(Const_PaymentApp::HZ_DEFAULT, array('userId' => $userId)); } catch (Exception $e) { throw new Exception_BllErrorException(sprintf('调用api失败: %s userId=%d broker_id=%d ajk_broker_id=%d', $e->getMessage(), $userId, $this->params['broker_id'], $this->params['ajk_broker_id'])); } if ($balanceInfo['status'] == 'error') { throw new Exception_BllErrorException(sprintf('%s ajkBrokerId(%d) 获取余额失败', $descript, $this->params['ajk_broker_id'])); } elseif ($balanceInfo['data']['balance'] <= 0) { throw new Exception_BllErrorException(sprintf('%s ajkBrokerId(%d) 余额(%d)不足', $descript, $this->params['ajk_broker_id'], $balanceInfo['data']['balance'])); } $this->allReturn = array(sprintf('hz:%s ajkBrokerId(%d) 当前余额(%d) ', $descript, $this->params['ajk_broker_id'], $balanceInfo['data']['balance'])); //获取刷爆$descript的计划 $plans = Dao_Broker_HzPlan::get_broker_plan($this->params['broker_id'], 7); if (empty($plans)) { $this->allReturn[] = '没有获取到 status=7 的计划'; return; } $plan_ids = array(); foreach ($plans as $plan) { $plan_ids[] = $plan['id']; } // 获取所有房子并上线 $plans_props = Bll_HzFixPlan::get_plan_props($plan_ids, $this->params['city_id']); if (empty($plans_props)) { $this->allReturn[] = sprintf('没有获取到计划(%s)的房源', implode(',', $plan_ids)); return; } foreach ($plans_props as $plan_id => $props) { // 更新计划状态 if (Bll_HzPropBll::switchUpOrDown()) { if (!Dao_Broker_HzPlan::update_plan_status($plan_id, Const_HzPlan::SPREAD)) { $this->allReturn[] = "更新计划[{$plan_id}]数据失败"; } } else { $this->allReturn[] = "开关关闭,计划[{$plan_id}]数据不再更新"; } // 记录计划上线日志 $data = Bll_HzFixPlanBll::build_plan_log($this->params, 8, "{$descript},计划上线", $this->params['broker_id']); if (!Model_House_UpDown_PlanLog::create($data, date('m'))->save()) { $this->allReturn[] = "{$descript},计划[{$plan_id}]上线写入失败"; } else { $this->allReturn[] = "{$descript},计划[{$plan_id}]上线写入"; } foreach ($props['props'] as $prop) { if (Bll_HzPropBll::switchUpOrDown()) { if (Dao_Broker_HzProp::change_prop_status($prop['proid'], Const_HzStatus::ONLINE) && Model_Plan_HzPlanning::updatePlanningByPropId($prop['proid'], Const_HzPlan::SPREAD, Const_HzPlan::SPREAD_TYPE)) { $this->allReturn[] = "房源{$prop['proid']}上线成功"; } else { $this->allReturn[] = "房源{$prop['proid']}上线失败"; } } else { $all_return[] = "开关关闭,房源[{$prop['proid']}]状态不改变"; } $data = Bll_HzPropBll::build_prop_log($this->params, 5, "房源上线", $this->params['broker_id']); $data['planId'] = $plan_id; $data['houseId'] = $prop['proid']; if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) { $this->allReturn[] = "房源{$prop['proid']}上线日志写入失败"; } else { $this->allReturn[] = "房源{$prop['proid']}上线日志写入"; } } } }
/** * 处理comms业务功能 * @param $action */ public static function dealActionComms($action) { $allResult = array(); //添加去重数组,为更新租房commid=0的数据做准备 $blockInfoArr = array(); foreach ($action['comms'] as $comm) { $blockInof = Bll_HzProp::getBlockByTypeCode($comm['new_block_code'], array(0, 1), true); // 判断小区solr是否ok $ajkBlock = Dao_Broker_HzProp::getAjkBlockInfo($comm['new_block_code']); if (!$ajkBlock) { return self::buildReturn(0, '二手房没有该板块:' . $comm['new_block_code']); } if (!Bll_HzProp::isCommSolrUpdated($ajkBlock['TypeId'], $ajkBlock['ParentId'], $blockInof['cityid'], $comm['community_id'], $comm['community_name'])) { return self::buildReturn(0, '租房小区solr还没更新完,动作id:' . $action['id'] . ' 小区id:' . $comm['community_id']); } if ($blockInof) { $result = Bll_HzProp::updatePropBlock($blockInof['id'], $blockInof['parentid'], $blockInof['cityid'], $comm['community_id']); if (!$result['status']) { // 更新动作表 if (!Bll_Cms_BlockChange::updateCommAction($comm['s_id'], $action['id'], 3, '处理失败')) { return self::buildReturn(0, '更新动作表失败,动作id:' . $action['id']); } return $result; } $allResult = array_merge($allResult, $result['msg']); } // 更新动作表 if (!Bll_Cms_BlockChange::updateCommAction($comm['s_id'], $action['id'], 1, '处理成功')) { return self::buildReturn(0, '更新动作表失败,动作id:' . $action['id']); } $temp = array(); $temp['new_code'] = $comm['new_block_code']; $temp['old_code'] = $comm['block_code']; $temp['city_id'] = $comm['city_id']; $blockInfoArr[$temp['old_code'] . '_' . $temp['new_code']] = $temp; } if (!empty($blockInfoArr)) { Bll_Cms_BlockChange::insertCommList($blockInfoArr); } return self::buildReturn(1, $allResult); }
/** * 删除经纪人定价组 * @param $broker_id * @param $plan_id * @return array */ public static function delete_broker_plan($broker_id, $plan_id) { //删除价组 条件判断 $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::NULLPLAN; return $flag_array; } if ($plan_info['user_id'] != $broker_id) { $flag_array['msg'] = Const_HzErrorInfo::PLANINFOERROR; return $flag_array; } // 已删除 if ($plan_info['status'] == Const_HzPlan::MANUALLY_PAUSE) { $flag_array['msg'] = Const_HzErrorInfo::PLANINFOERROR; return $flag_array; } $plannings = Dao_Broker_HzPlan::get_planning($plan_id); $proids = array(); foreach ($plannings as $planning) { $proids[] = $planning['proid']; } $prop_option = Const_HzLog::DELPLANPROP; $status = Const_HzStatus::OUTLINE; // 房源更新状态 $plan_status = Const_HzPlan::MANUALLY_PAUSE; // 计划状态 $plan_option = Const_HzLog::DELPLAN; $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); //记房源日志 // TODO 停止竞价 // TODO 下solr //记录房源下线日志 if ($status != Const_HzStatus::ONLINE && $basic_info['status'] == Const_HzStatus::ONLINE) { 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; }
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; }
/** * 通知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; } }
/** * 警告:未得到授权,不能使用。所有者:caoyang * 本方法为租房架构变更,房源状态维护的过渡期中临时方法。有效到2014-10-01。 * * 根据当前定价、竞价(精选)的状态维护房源的状态 * 1.房源的状态为:违规-6,删除-99、100的时候房源的状态不被更新 * 2.定价、竞价(精选)任意一个推广时房源状态为1 * 3.房源不在定价计划中的时候状态需要维护成2、4 * * @param $hzProId * @return mixed */ public static function bulidHzProStatu($hzProId) { /** 房源信息初步判断 */ //查询房源信息 $proInfo = Model_House_HzProp::get_prop_info_by_prop_id($hzProId); if (empty($proInfo)) { //房源信息不存在 return ''; } if (in_array($proInfo['contentBasic']['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) { //房源状态为违规的、删除的不能更新房源状态 return ''; } /** 定价、竞价(精选)数据准备 */ //查询租房定价、竞价(精选)关系数据 $fixPlanning = array(); //定价关系数据 $bidPlanning = array(); //竞价(精选)关系数据 $comboRelation = array(); // 套餐关系数据 //$isComboBroker = Bll_Broker_HzBroker::isComboBroker($proInfo['contentBasic']['user_id']); $planning = Model_Plan_HzPlanning::data_access()->filter('proid', $hzProId)->get_all(); foreach ($planning as $list) { //定价 if ($list['plan_type'] == Const_HzPlan::SPREAD_TYPE) { $fixPlanning = $list; } //竞价(精选) if ($list['plan_type'] == Const_HzPlan::BID_TYPE) { $bidPlanning = $list; } } //查询租房竞价(精选)计划状态 if (empty($bidPlanning)) { $bidPlanInfo = array(); } else { $bidPlanInfo = Model_Plan_HzPlanBasic::get_plan_by_id($bidPlanning['plan_id']); } //查询租房定价计划状态 if (empty($fixPlanning)) { $fixPlanInfo = array(); } else { $fixPlanInfo = Model_Plan_HzPlanBasic::get_plan_by_id($fixPlanning['plan_id']); } //查询套餐关系 $comboRelation = Bll_Combo_HouseRelation::getRelationByHouseId($hzProId); /** 计算出房源状态应该更新成什么样 */ /** * 1. 非定价推广(计划删除、或房源不在计划里面)proStatus=2 * 2. 定价推广:proStatus=1 * 3. 定价非推广(房源在计划中) * 3.1 竞价(精选)非推广 * 3.1.1 定价计划没钱 proStatus=13 * 3.1.1 定价其他 proStatus=9 * 3.2 竞价(精选)推广 proStatus=1 */ if ($comboRelation) { return Dao_Broker_HzProp::change_prop_status($hzProId, Bll_Combo_HouseRelation::isRelationOnline($comboRelation['state']) ? Const_HzStatus::ONLINE : Const_HzStatus::OUTLINE); } else { //定价计划不存在、计划标记为删除、计划不是正常状态(1、2、5、7、9) if (empty($fixPlanInfo) || $fixPlanInfo['flag'] == 0 || !in_array($fixPlanInfo['status'], array(Const_HzPlan::SPREAD, Const_HzPlan::AUTOOVER, Const_HzPlan::AWAIT, Const_HzPlan::UPPERLIMIT, Const_HzPlan::MANUALLY_PAUSE))) { return Dao_Broker_HzProp::change_prop_status($hzProId, Const_HzStatus::OUTLINE); //房源不在计划里面 } //定价房源不在计划里面、非有效的关系(1、2、5、7、9) if (empty($fixPlanning) || !in_array($fixPlanning['is_valid'], array(Const_HzPlan::SPREAD, Const_HzPlan::AUTOOVER, Const_HzPlan::AWAIT, Const_HzPlan::UPPERLIMIT, Const_HzPlan::MANUALLY_PAUSE))) { return Dao_Broker_HzProp::change_prop_status($hzProId, Const_HzStatus::OUTLINE); //房源不在计划里面 } //定价计划推广中 if ($fixPlanInfo['status'] == Const_HzPlan::SPREAD) { return Dao_Broker_HzProp::change_prop_status($hzProId, Const_HzStatus::ONLINE); //房源正在推广 } //竞价(精选)计划不存在、计划标记为删除、计划不是正常状态(1、2、5、7、9、13) //竞价(精选)房源不在计划里面、非有效的关系(1、2、5、7、9、13) if (empty($bidPlanInfo) || $bidPlanInfo['flag'] == 0 || !in_array($bidPlanInfo['status'], array(Const_HzPlan::SPREAD, Const_HzPlan::AUTOOVER, Const_HzPlan::AWAIT, Const_HzPlan::UPPERLIMIT, Const_HzPlan::MANUALLY_PAUSE, Const_HzPlan::WAITING)) || empty($bidPlanning) || !in_array($bidPlanning['is_valid'], array(Const_HzPlan::SPREAD, Const_HzPlan::AUTOOVER, Const_HzPlan::AWAIT, Const_HzPlan::UPPERLIMIT, Const_HzPlan::MANUALLY_PAUSE, Const_HzPlan::WAITING))) { if ($fixPlanInfo['status'] == Const_HzPlan::UPPERLIMIT) { //计划没钱 return Dao_Broker_HzProp::change_prop_status($hzProId, Const_HzStatus::NOCASH); //房源没钱 } else { return Dao_Broker_HzProp::change_prop_status($hzProId, Const_HzStatus::MANUALLY); //房源状态更新为9手动停止 } } //竞价(精选)推广 if ($bidPlanInfo['status'] == Const_HzPlan::SPREAD) { return Dao_Broker_HzProp::change_prop_status($hzProId, Const_HzStatus::ONLINE); //房源正在推广 } } //以上逻辑都没走到,记录当时错误情况 file_put_contents("/data1/logs/bulidHzProStatu.log", date('Y-m-d H:i:s') . " " . $hzProId . " " . json_encode($fixPlanInfo) . " " . json_encode($fixPlanning) . " " . json_encode($bidPlanInfo) . " " . json_encode($bidPlanning) . "\n", FILE_APPEND); return false; }
/** * @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; }
/** * 房源是否违规 * * @return bool */ public function isIllegal() { $propIds = array($this->propId); $out_list = Dao_Broker_HzProp::get_outlist($propIds); if ($out_list) { return true; } $out_list_broker = Dao_Broker_HzProp::get_outlist_broker($propIds); if ($out_list_broker) { return true; } return false; }
public function handle_request_internal() { /* @params planId :计划id @params resType :默认为0,0表示不取计划房源信息,1为取房源信息 @params from :来源 @success return 该计划id的信息 */ if (!isset($this->_params['brokerId'])) { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_BROKERID_MISS); } $brokerId = $this->_params['brokerId']; //根据安居客经纪人ID获取好租经纪人ID $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId); if ($brokerId_hz) { $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz); if (!Bll_City::isBidCity($broker_info['cityid'])) { return array('status' => 'ok', 'data' => array('propertyList' => array())); } } if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { //获取套餐推广房源列表 $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1); if (!empty($comboList)) { foreach ($comboList as $combo) { $comboIds[$combo['houseId']] = 1; } //获取竞价房源 去除竞价房源 $validBidPlans = Model_Plan_HzPlanBasic::getBidPlansByBrokerId($brokerId_hz); $planIds = array(); if (!empty($validBidPlans)) { foreach ($validBidPlans as $plan) { if ($plan['flag'] == 1 && $plan['status'] != Const_HzPlan::DELETE) { $planIds[] = $plan['id']; } } if (!empty($planIds)) { $bidPlannings = Model_Plan_HzPlanning::getPlanningByPlanIds($planIds); } if (!empty($bidPlannings)) { foreach ($bidPlannings as $bid) { unset($comboIds[$bid['proid']]); } } } //$propertyList = Model_House_HzProp::getPropsByPropIds(array_keys($comboIds)); $propertyList = Dao_Broker_HzProp::get_prop(array_keys($comboIds)); if (!empty($propertyList)) { foreach ($propertyList as $key => $list) { if ($list['content_basic']['quality'] != 1) { unset($propertyList[$key]); } } } $result = $propertyList; } else { $result = array(); } //去除竞价房源和非多图房源 } else { $result = Bll_HzBidPlan::get_canbid_props($brokerId_hz); } $return = array(); $return["status"] = "ok"; $return["data"]['propertyList'] = array(); if (!empty($result)) { $proprow = array(); foreach ($result as $propertyList) { $proprow["id"] = $propertyList['proid']; $proprow["title"] = $propertyList['content_basic']['title']; $proprow["commId"] = $propertyList['content_basic']['commid']; $proprow["commName"] = $propertyList['content_basic']['commname']; $proprow["roomNum"] = $propertyList['content_basic']['roomnum']; $proprow["hallNum"] = $propertyList['content_basic']['hallnum']; $proprow["toiletNum"] = $propertyList['content_basic']['toilnetnum']; $proprow["area"] = round($propertyList['content_basic']['areanum']); $proprow["price"] = round($propertyList['content_basic']['pricenum']); $proprow["isMoreImg"] = $propertyList['content_basic']['quality'] ? 1 : 0; $proprow["priceUnit"] = "元"; $return["data"]['propertyList'][] = $proprow; unset($proprow); } unset($result); } return $return; }
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; }
public static function get_outprop_ids($broker_id, $city_id) { if (empty($broker_id) || empty($city_id)) { return array(); } $table = Dao_Broker_HzProp::b_broker_search_tb($city_id); $sql = "select proid,status from {$table} where userid=? and cityid=? and status in (2,6) and ispkg=10;"; $stmt = APF_DB_Factory::get_instance()->get_pdo('rent_slave')->prepare($sql); $stmt->execute(array($broker_id, $city_id)); $re = $stmt->fetchAll(); return $re; }
/** * 获取房源的违规信息 * @param $props 二维数组 array( * 15835566 => array($propInfo) * ) * @return array */ public static function checkAndGetPropsIllegalInfos($props) { if (empty($props)) { return array(); } $illegalProIds = array(); foreach ($props as $prop) { if (!self::isIllegalProp($prop['status'])) { continue; } if (isset($prop['propId']) && $prop['propId']) { $prop['proId'] = $prop['propId']; } $illegalProIds[] = isset($prop['proid']) ? $prop['proid'] : $prop['proId']; } if (empty($illegalProIds)) { return $props; } // 查询用户举报的违规信息 if ($reportIllegalsProps = Dao_Broker_HzProp::get_outlist($illegalProIds)) { foreach ($reportIllegalsProps as $reportIllegalsProp) { $props[$reportIllegalsProp['proid']]['isIllegal'] = true; $props[$reportIllegalsProp['proid']]['reason'] = $reportIllegalsProp['operate_info']; $props[$reportIllegalsProp['proid']]['operateTime'] = $reportIllegalsProp['$reportIllegalsProp']; } } // 查询其他违规信息 if ($otherIllegalsProps = Dao_Broker_HzProp::get_outlist_broker($illegalProIds)) { foreach ($otherIllegalsProps as $otherIllegalsProp) { $props[$otherIllegalsProp['proid']]['isIllegal'] = true; $reason = json_decode($otherIllegalsProp['content'], true); $props[$otherIllegalsProp['proid']]['reason'] = empty($reason['reseaon']) ? $otherIllegalsProp['filterkeyword'] : $reason['reseaon']; $props[$otherIllegalsProp['proid']]['operateTime'] = $otherIllegalsProp['updated']; } } return $props; }