/**
  * 统计房源在线时长
  *
  * @param int $brokerId
  * @param int $propId
  * @param int $propStatus
  */
 public function countHouseOnlineStatistics($brokerId, $propId, $propStatus)
 {
     $this->logMessage(sprintf('开始统计房源在线时长: brokerId=%d, propId=%d, propStatus=%d', $brokerId, $propId, $propStatus));
     $propChangeLogList = Model_House_HzProChangeLog::getChangeListLogByProId($propId, date('Ymd', strtotime('-1 day')));
     /** 如果房源没有操作日志,且房源在线,则去计划表查询,如果计划在线则24小时在线否则不记录 */
     if (empty($propChangeLogList) && $propStatus == Const_HzStatus::ONLINE) {
         $this->logMessage(sprintf('房源(%d)在线,但是昨天没有操作记录', $propId));
         $propPlannings = Model_Plan_HzPlanning::getPlanningByPropId($propId);
         foreach ($propPlannings as $propPlanning) {
             if ($propPlanning['is_valid'] != Const_HzPlan::SPREAD) {
                 continue;
             }
             $propPromotionTime = array('propId' => $propId, 'brokerId' => $brokerId, 'planId' => $propPlanning['plan_id'], 'planType' => $propPlanning['plan_type'], 'onlineDate' => date('Ymd', strtotime('-1 day')), 'onlineHour' => 24.0, 'minOnlineDatetime' => date('Y-m-d H:i:s', $this->yesterdayStartTimeStamp), 'maxOfflineDatetime' => date('Y-m-d H:i:s', $this->yesterdayEndTimeStamp));
             $this->savePropPromotionTime($propPromotionTime);
         }
         return;
     }
     $propChangeInfo = array();
     /** 只使用最后一个记录 */
     foreach ($propChangeLogList as $propChangeLog) {
         $propChangeInfo[$propChangeLog['type']] = $propChangeLog;
     }
     foreach ($propChangeLogList as $spreadType => $lastPropChangeLog) {
         /** 最后一条记录为上架操作 */
         if ($lastPropChangeLog['action'] == Model_House_HzProChangeLog::HOUSE_CHANGE_ACTION_UP) {
             $onlineHour = $lastPropChangeLog['time'] + ($this->yesterdayEndTimeStamp - strtotime($lastPropChangeLog['logTime']));
             $minOnlineDatetime = $lastPropChangeLog['logTime'];
             $maxOfflineDatetime = date('Y-m-d H:i:s', $this->yesterdayEndTimeStamp);
         } else {
             /** 最后一条数据为下架操作 */
             if ($lastPropChangeLog['time'] == 0) {
                 $onlineHour = strtotime($lastPropChangeLog['logTime']) - $this->yesterdayStartTimeStamp;
             } else {
                 $onlineHour = $lastPropChangeLog['time'];
             }
             $minOnlineDatetime = date('Y-m-d H:i:s', $this->yesterdayStartTimeStamp);
             $maxOfflineDatetime = $lastPropChangeLog['logTime'];
         }
         $onlineHour = $onlineHour > 86400 ? 86400 : $onlineHour;
         $propPromotionTime = array('propId' => $propId, 'brokerId' => $brokerId, 'planId' => $lastPropChangeLog['spreadId'], 'planType' => $spreadType, 'onlineDate' => date('Ymd', strtotime('-1 day')), 'onlineHour' => round($onlineHour / 60, 1), 'minOnlineDatetime' => $minOnlineDatetime, 'maxOfflineDatetime' => $maxOfflineDatetime);
         $this->savePropPromotionTime($propPromotionTime);
     }
 }