Ejemplo n.º 1
0
 public static function &getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
 /**
  * 修复定价推广房源总数
  *
  * @param int $startId
  * @param int $date
  */
 private function repairePropCount($startId, $date)
 {
     $fixedSalePPCList = Model_House_PpcdsStatsBrokerDay::getFixedSalePpcByDayDateEx($startId, $date);
     if (empty($fixedSalePPCList)) {
         $this->logMsg(sprintf('没有获取到[%d]定价推广房源总数', $date));
         file_put_contents($this->_doneFile, 'YES');
         return;
     }
     foreach ($fixedSalePPCList as $fixedSalePPC) {
         $this->setCursor($fixedSalePPC['id']);
         $this->logMsg(sprintf('开始导入定价推广房源总数 id=%d brokerId=%d cityId=%d fixedSalePpc=%d', $fixedSalePPC['id'], $fixedSalePPC['brokerId'], $fixedSalePPC['cityId'], $fixedSalePPC['fixedSalePpc']));
         $marketReport = Model_Stats_AjkPropStatsMarketReport::getBrokerMarketReport($fixedSalePPC['brokerId'], $date);
         if (empty($marketReport)) {
             $data = array('brokerId' => $fixedSalePPC['brokerId'], 'propCount' => $fixedSalePPC['fixedSalePpc'], 'dayDate' => $date);
             if (Model_Stats_AjkPropStatsMarketReport::create($data)->save() == 1) {
                 $this->logMsg(sprintf('新增定价推广房源总数成功 brokerId=%d cityId=%d fixedSalePpc=%d', $fixedSalePPC['brokerId'], $fixedSalePPC['cityId'], $fixedSalePPC['fixedSalePpc']));
             } else {
                 $this->logMsg(sprintf('新增定价推广房源总数成功 brokerId=%d cityId=%d fixedSalePpc=%d', $fixedSalePPC['brokerId'], $fixedSalePPC['cityId'], $fixedSalePPC['fixedSalePpc']));
             }
             continue;
         }
         if (1 == Model_Stats_AjkPropStatsMarketReport::updatePropCountById($marketReport['id'], $fixedSalePPC['fixedSalePpc'])) {
             $this->logMsg(sprintf('更新定价推广房源总数成功 brokerId=%d cityId=%d fixedSalePpc=%d', $fixedSalePPC['brokerId'], $fixedSalePPC['cityId'], $fixedSalePPC['fixedSalePpc']));
         } else {
             $this->logMsg(sprintf('更新定价推广房源总数失败 brokerId=%d cityId=%d fixedSalePpc=%d', $fixedSalePPC['brokerId'], $fixedSalePPC['cityId'], $fixedSalePPC['fixedSalePpc']));
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * 检查是否有推广房源
  * @param $dateIndex
  * @param $dataBase
  * @return array|int
  */
 public function checkHasBrokerHouses($dateIndex, $dataBase)
 {
     $result = array('stauts' => false, 'data' => '');
     if ($dataBase == Const_ShowcaseOrders::SALE_DB) {
         $data = Model_House_PpcdsStatsBrokerDay::getInstance()->getFixedSalePpcByDayDate($dateIndex);
     } elseif ($dataBase == Const_ShowcaseOrders::RENT_DB) {
         $data = Model_House_PropPromotionData::getInstance()->getFixPropNumByReportDate($dateIndex);
     }
     if (!empty($data)) {
         $result['status'] = true;
         $result['data'] = $data;
     }
     return $result;
 }