Example #1
0
 public static function &getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Example #2
0
 /**
  * 获取job数据
  * @return array
  */
 protected function getJobData()
 {
     return Bll_Broker_ShowcaseLogs::getInstance()->getAdSetLogMoreThanId($this->id, $this->jobYm, $this->limit, $this->jobType);
 }
Example #3
0
 public function handle_request()
 {
     $adBrokerList = $this->getRequestData();
     foreach ($adBrokerList as $val) {
         $data = array();
         $this->setMyFlag($val['id']);
         //            $priceList = Bll_Broker_ShowcaseConsumeQuery::getInstance()->getBrokerQuery($val['brokerId'],$this->yDate,$this->nDate,$this->_dateBase);
         //            $price = 0;
         //            if($priceList){
         //                foreach($priceList as $plist){
         //                    $price += $plist['realAccount'];
         //                }
         //            }
         $priceList = Bll_Broker_ShowcaseConsumeQuery::getInstance()->getBrokerQueryV2($val['brokerId'], $this->yDate, $this->_dateBase);
         $price = 0;
         if ($priceList) {
             foreach ($priceList as $plist) {
                 $price += $plist['amount'];
             }
         }
         $time = date('Y-m-d 00:10:00', strtotime($this->yDate));
         $propList = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerTimeHouse($val['brokerId'], $time, $this->nDate, $this->_dateBase);
         $props = $propstmp = array();
         if ($propList) {
             foreach ($propList as $hlist) {
                 if (!in_array($hlist['propId'], $props)) {
                     $props[] = $hlist['propId'];
                 }
             }
         }
         $tpropList = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerTimeHouse($val['brokerId'], $this->nDate, 0, $this->_dateBase);
         if ($tpropList) {
             $propstmp = $this->aryMerger($tpropList, $propstmp);
         }
         $propShowList = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdPropShowInfo($val['brokerId'], $this->_dateBase);
         if ($propShowList) {
             $propstmp = $this->aryMerger($propShowList, $propstmp, 2);
         }
         if ($propstmp) {
             foreach ($propstmp as $newval) {
                 if ($newval['flag'] != 1) {
                     if (!in_array($newval['propId'], $props)) {
                         $props[] = $newval['propId'];
                     }
                 }
             }
         }
         $brokerInfo = new Model_Broker_AjkBrokerExtend();
         $info = $brokerInfo->getDataByBrokerId($val['brokerId']);
         $data['brokerId'] = $val['brokerId'];
         $data['cityId'] = $info['cityId'];
         $data['dayDate'] = $this->yDate;
         $data['createTime'] = time();
         $data['updateTime'] = date('Y-m-d H:i:s');
         $data['propsSum'] = count($props);
         $data['price'] = $price;
         $lastid = Bll_Broker_ShowcaseLogs::getInstance()->addAdStatusLog($data, $this->_dateBase);
         if (!$lastid) {
             $mailSubject = $this->yDate . $this->_dateBaseName . '插入出错问题';
             $mailBody = $this->_dateBaseName . '的' . $val['id'] . ',经纪人id:' . $val['brokerId'] . '执行时间:' . date('Y-m-d H:i:s');
             Bll_Broker_ShowcaseCommon::getInstance()->sendMail($mailSubject, $mailBody, $this->mailArr);
         }
     }
 }