Ejemplo n.º 1
0
 /**
  * 获取与某套房源对应的推荐竞价房源
  * 
  * 开通PPC竞价的城市专用
  * 
  * @param array $p_arrPropInfo 必需字段:房源ID,小区,价格,面积,房型(室)
  * @param int $p_intLimit
  */
 public function get_replaced_haopan_props($p_arrPropInfo, $p_intLimit)
 {
     apf_require_class("DAO_Property_PropSpread");
     $objPropSpread = new DAO_Property_PropSpread();
     $strCondition = "comm_id=? and status=? and bigprice>? and smallprice<? and tradetype=? order by comms_hpratio_a desc, createtime asc";
     $arrParams = array($p_arrPropInfo['COMMID'], 1, $p_arrPropInfo['PROPRICEINT'], $p_arrPropInfo['PROPRICEINT'], 1);
     $arrPropSpreads = $objPropSpread->getPropSpreadList($strCondition, $arrParams);
     $totalNum = 0;
     $arrResult = array();
     foreach ($arrPropSpreads as $SpreadItem) {
         if ($totalNum >= $p_intLimit) {
             break;
         }
         $arrPropCompareInfo = $this->compare_property_data($p_arrPropInfo, $SpreadItem['PROP_ID']);
         if (!empty($arrPropCompareInfo)) {
             $arrResult[] = $arrPropCompareInfo;
             $totalNum++;
         }
     }
     return $arrResult;
 }
Ejemplo n.º 2
0
 /**
  * @param $ajkPropSpread
  * @param int $doBucket 0-不处理,1-坑位数加一,-1-坑位数减一
  * @return bool
  * 精选计算排名
  */
 public function choiceComputeRank($ajkPropSpread, $doBucket = 0)
 {
     //查询价格段id
     $priceInfo = Model_House_EsfPrice::get_price($ajkPropSpread['cityId'], $ajkPropSpread['proPriceInt']);
     if (empty($priceInfo)) {
         $this->setMsg('未知的价格段;cityId:' . $ajkPropSpread['cityId'] . ';proPriceInt:' . $ajkPropSpread['proPriceInt']);
         return false;
     }
     //获取坑位表信息
     $BucketInfo = Model_Choice_EsfBidBucket::get_bucket_info($ajkPropSpread['commId'], $priceInfo['id']);
     if (empty($BucketInfo)) {
         $this->setMsg('未知的坑位表信息;');
         return false;
     }
     //更新坑的位数
     if ($doBucket == 1) {
         //坑位剩余数加一
         if (false == Model_Choice_EsfBidBucket::decrement_used_num($ajkPropSpread['commId'], $priceInfo['id'])) {
             $this->setMsg('坑位剩余数加一失败;');
             return false;
         }
     } elseif ($doBucket == -1) {
         //坑位剩余数减一
         if (Model_Choice_EsfBidBucket::increment_used_num($ajkPropSpread['commId'], $priceInfo['id']) == false) {
             $this->setMsg('坑位剩余数减一失败;');
             return false;
         }
     }
     //根据小区id,价格段获取
     $ajkPropspreadList = Model_Plan_AjkPropspread::getAjkPropspreadByBucket($ajkPropSpread['commId'], $ajkPropSpread['smallprice'], $ajkPropSpread['bigprice'], 2);
     if (empty($ajkPropspreadList)) {
         $this->setMsg('未获取到同小区、价格段的房源。commId:' . $ajkPropSpread['commId'] . ';smallprice:' . $ajkPropSpread['smallprice'] . ';bigprice:' . $ajkPropSpread['bigprice']);
         return true;
     }
     $PropSpread = new DAO_Property_PropSpread();
     //遍历坑里面的数据,计算排名
     foreach ($ajkPropspreadList as $key => $list) {
         if ($key < $BucketInfo['maxOnlineNum']) {
             //预期推广中的数据
             if ($list['status'] == 11) {
                 //更新排队中的数据位推广中
                 Model_Plan_AjkPropspread::setAjkPropspreadById($list['id'], 1);
                 //记录竞价第一次推广的日志
                 $PropSpread->getFirstSpreadLogDao($list['propId'], 2);
                 if (empty($PropSpread)) {
                     $PropSpread->addFirstSpreadLogDao($list['propId'], 2);
                 }
                 //通知solr队列
                 $this->choiceUpDownSendSolr(array('city_id' => $list['cityId'], 'broker_id' => $list['brokerId'], 'pro_id' => $list['propId'], 'flag' => 1, 'hpratio' => $list['offer'], 'comms_hpratio_a' => $list['commsHpratioA'], 'comms_hpratio' => $list['commsHpratio'], 'hpstarttime' => $list['spreadstartdate'], 'hpendtime' => $list['spreadenddate'], 'hpplanid' => $list['id'], 'update_time' => time(), 'from_type' => 151));
                 //记录房源日志
                 Model_Log_HouseLogNew::create(array('houseId' => $list['propId'], 'planId' => $list['id'], 'brokerId' => $list['brokerId'], 'cityId' => $list['cityId'], 'type' => 14, 'changeType' => '40' . $this->qInfo['actionId'], 'remark' => '计划' . $ajkPropSpread['id'] . $this->actionStr[$this->qInfo['actionId']] . ';重新计算价格段内排名,精选推广', 'operatorId' => $this->qInfo['operationId'], 'siteType' => 1), date('Ymd'))->save();
                 $this->setMsg('planId:' . $list['id'] . '变更为推广');
             }
         } else {
             //预期排队的数据
             continue;
             /**
              * if($list['status'] == 1){
              * //更新推广中的数据位为排队中
              * Model_Plan_AjkPropspread::setAjkPropspreadById($list['id'],11);
              * //通知solr队列
              * $this->choiceUpDownSendSolr(array(
              * 'city_id'=>$list['cityId'],//城市ID
              * 'broker_id'=>$list['brokerId'],//经纪人ID
              * 'pro_id'=>$list['propId'],//房源ID
              * 'flag'=>2,//操作类型
              * 'hpratio'=>$list['offer'],//好盘系数
              * 'comms_hpratio_a'=>$list['commsHpratioA'],//小区好盘系数a
              * 'comms_hpratio'=>$list['commsHpratio'],//小区好盘系数
              * 'hpstarttime'=>$list['spreadstartdate'],//开始展示时间
              * 'hpendtime'=>$list['spreadenddate'],//结束展示时间
              * 'hpplanid'=>$list['id'],//推广计划ID
              * 'update_time'=>time(),//更新时间
              * 'from_type'=>152,//标记类型
              * ));
              * //记录房源日志
              * Model_Log_HouseLogNew::create(array(
              * 'houseId' => $list['propId'],
              * 'planId' => $list['id'],
              * 'brokerId' => $list['brokerId'],
              * 'cityId' => $list['cityId'],
              * 'type' => 15,//13-精选排队中,14-精选推广,15-取消精选推广,16-取消精选排队
              * 'changeType' => '40'.$this->qInfo['actionId'],
              * 'remark' => '计划'.$ajkPropSpread['id'].$this->actionStr[$this->qInfo['actionId']].';重新计算价格段内排名,精选排队中',
              * 'operatorId' => $this->qInfo['operationId'],
              * 'siteType' => 1,
              * ),date('Ymd'))->save();
              *
              * $this->setMsg('planId:'.$list['id'].'变更为排队中');
              * }
              */
         }
     }
     return true;
 }