Exemplo n.º 1
0
 public function handle_request()
 {
     $splitSuffix = Model_Config_huTablesUploadStatus::getSollyXunPanPropResultSplitSuffix();
     if ($splitSuffix != date("Ymd")) {
         return false;
     }
     $cursor = $this->getFlag();
     if (empty($cursor['id'])) {
         $cursor['id'] = 0;
     }
     $i = 0;
     while ($i < self::CIRCOUNT) {
         $i++;
         //读取bi数据
         $data = Model_Stats_AjkSollyHouseResult::data_access($splitSuffix)->filter_by_op('id', '>', $cursor['id'])->limit(self::LIMIT)->get_all();
         if (empty($data)) {
             $this->removeFlag();
             $this->setShStopFlag();
             return false;
         }
         //更新游标
         $cursor['id'] = $data[self::LIMIT - 1]['id'];
         $this->setFlag($cursor);
         //设置log
         $log = array('time' => date('Ymd h:i:s'), 'id' => $cursor['id']);
         $this->setLog(json_encode($log));
         $propIds = array();
         foreach ($data as $k => $v) {
             $propIds[] = $v['propId'];
         }
         //取出表中已存在的propId
         $extPropIds = Model_Activity_Res_SollyXunpanPropResult::data_access()->load_field('propId')->filter_by_op('propId', 'in', $propIds)->get_all();
         $tmp = array();
         foreach ($extPropIds as $v) {
             $tmp[$v['propId']] = $v['propId'];
         }
         //将不存在的propId插入表中
         foreach ($data as $k => $v) {
             if (empty($tmp[$v['propId']])) {
                 $insertData = array('propId' => $v['propId'], 'logTime' => date("Ymd"), 'cityId' => $v['cityId'], 'rankStar' => $v['rankStar'], 'dataFrom' => 0);
                 Model_Activity_Res_SollyXunpanPropResult::insertData($insertData);
             }
         }
         unset($data);
     }
 }
Exemplo n.º 2
0
 public static function getRankFromBrokerAndBI($houseIds)
 {
     $houseSollyResult = array();
     //查询经纪人表中的rank
     $houseSollyResultA = Model_Activity_Res_SollyXunpanPropResult::getPropRank($houseIds);
     //取出没有查询到rank的houseIds
     $tmp = array();
     $propIdsTmp = array();
     foreach ($houseSollyResultA as $v) {
         $propIdsTmp[] = $v['propId'];
     }
     foreach ($houseIds as $v) {
         if (!in_array($v, $propIdsTmp)) {
             $tmp[] = $v;
         }
     }
     if (empty($tmp)) {
         return $houseSollyResultA;
     }
     //当有houseIds的rank在经纪人表中查不到时
     $splitSuffix = Model_Config_huTablesUploadStatus::getSollyXunPanPropResultSplitSuffix();
     $houseSollyResultB = Model_Stats_AjkSollyHouseResult::getHouseSollyResult($tmp, $splitSuffix);
     if (empty($houseSollyResultB)) {
         return $houseSollyResultA;
     }
     //将BI中的数据插入经纪人表中
     foreach ($houseSollyResultB as $v) {
         $data = array('propId' => $v['propId'], 'logTime' => date("Y-m-d", time()), 'cityId' => $v['cityId'], 'rankStar' => $v['rankStar'], 'dataFrom' => 0);
         Model_Activity_Res_SollyXunpanPropResult::insertData($data);
     }
     $houseSollyResult = array_merge($houseSollyResultA, $houseSollyResultB);
     return $houseSollyResult;
 }
Exemplo n.º 3
0
 /**
  * 获得BI数据统计
  * @return array|string
  */
 private function getBIDataTotal()
 {
     $this->splitSuffix = Model_Config_huTablesUploadStatus::getSollyXunPanPropResultSplitSuffix();
     return Model_Stats_AjkSollyHouseResult::getHouseSollyResultTotal($this->splitSuffix);
 }