public static function &getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Esempio n. 2
0
 private static function prepareWorkLog(&$out)
 {
     $out['BrokerWorkLogInfo'] = array();
     $startDate = date('Ymd', $out['beginDateUnix']);
     $endDate = date('Ymd', $out['endDateUnix']);
     if ($startDate > $endDate) {
         return;
     }
     $tempBrokerStatisticsInfoList = Model_Broker_HzComboBrokerDay::getBrokerStatistics($out['ajkBrokerId'], $startDate, $endDate);
     if (empty($tempBrokerStatisticsInfoList)) {
         return;
     }
     $total = array('TotalPropNum' => 0, 'TotalClickNum' => 0, 'TotalAmount' => 0, 'rentProp' => 0, 'rentGoodProp' => 0, 'rentNewProp' => 0, 'rentNewGoodProp' => 0, 'rentVppv' => 0, 'rentBidProp' => 0, 'rentBidVppv' => 0, 'rentBidCost' => 0, 'rentBidNewProp' => 0, 'rentBidNewGoodProp' => 0, 'rentBidGoodProp' => 0);
     $dateList = static::getDateList($out['beginDateUnix'], $out['endDateUnix']);
     $adPriceInfo = static::getBrokerPriceInfo($out['ajkBrokerId'], $startDate, $endDate);
     $adClickInfo = static::getBrokerAdClickInfo($out['ajkBrokerId'], $startDate, $endDate);
     $brokerStatisticsInfoList = array();
     // 初始化
     for ($i = strtotime($startDate); $i <= strtotime($endDate); $i = $i + 86400) {
         $brokerStatisticsInfoList[date('Ymd', $i)] = array('_DayDate' => date('Y-m-d', $i));
     }
     foreach ($tempBrokerStatisticsInfoList as $brokerStatisticsInfo) {
         $date = $brokerStatisticsInfo['dayDate'];
         $brokerStatisticsInfo['_DayDate'] = $dateList[$date];
         $brokerStatisticsInfo['TotalPropNum'] = $brokerStatisticsInfo['rentProp'] + $brokerStatisticsInfo['rentBidProp'];
         $brokerStatisticsInfo['TotalClickNum'] = $brokerStatisticsInfo['rentVppv'] + $brokerStatisticsInfo['rentBidVppv'];
         $brokerStatisticsInfo['TotalAmount'] = $brokerStatisticsInfo['rentBidCost'];
         /**
          * 总计
          */
         $total['TotalPropNum'] += $brokerStatisticsInfo['TotalPropNum'];
         $total['TotalClickNum'] += $brokerStatisticsInfo['TotalClickNum'];
         $total['TotalAmount'] += $brokerStatisticsInfo['TotalAmount'];
         $total['rentProp'] += $brokerStatisticsInfo['rentProp'];
         $total['rentGoodProp'] += $brokerStatisticsInfo['rentGoodProp'];
         $total['rentNewProp'] += $brokerStatisticsInfo['rentNewProp'];
         $total['rentNewGoodProp'] += $brokerStatisticsInfo['rentNewGoodProp'];
         $total['rentVppv'] += $brokerStatisticsInfo['rentVppv'];
         $total['rentBidProp'] += $brokerStatisticsInfo['rentBidProp'];
         $total['rentBidGoodProp'] += $brokerStatisticsInfo['rentBidGoodProp'];
         $total['rentBidVppv'] += $brokerStatisticsInfo['rentBidVppv'];
         $total['rentBidCost'] += $brokerStatisticsInfo['rentBidCost'];
         $total['rentBidNewProp'] += $brokerStatisticsInfo['rentBidNewProp'];
         $total['rentBidNewGoodProp'] += $brokerStatisticsInfo['rentBidNewGoodProp'];
         /**
          * 橱窗
          */
         $brokerStatisticsInfo['propsSum'] = $adPriceInfo[$date]['propsSum'];
         $brokerStatisticsInfo['quantityCount'] = $adClickInfo[$date]['quantityCount'];
         $brokerStatisticsInfo['price'] = $adPriceInfo[$date]['price'];
         $total['propsSum'] += $adPriceInfo[$date]['propsSum'];
         $total['quantityCount'] += $adClickInfo[$date]['quantityCount'];
         $total['price'] += $adPriceInfo[$date]['price'];
         $brokerStatisticsInfoList[$date] = $brokerStatisticsInfo;
     }
     $BrokerWorkLogInfo = array('data' => array_reverse($brokerStatisticsInfoList), 'total' => $total);
     $out['BrokerWorkLogInfo'] = $BrokerWorkLogInfo;
 }
 /**
  * 检测套餐是否有推广房源
  * @param $dateIndex
  * @param $dataBase
  * @return array
  */
 public function checkHasComboBrokerHouses($dateIndex, $dataBase)
 {
     $result = array('stauts' => false, 'data' => '');
     if ($dataBase == Const_ShowcaseOrders::SALE_DB) {
         $data = Model_Broker_AjkComboBrokerDay::getInstance()->getSaleByDayDate($dateIndex);
     } elseif ($dataBase == Const_ShowcaseOrders::RENT_DB) {
         $data = Model_Broker_HzComboBrokerDay::getInstance()->getRentByDayDate($dateIndex);
     }
     if (!empty($data)) {
         $result['status'] = true;
         $result['data'] = $data;
     }
     return $result;
 }