public static function &getInstance() { if (self::$_instance === null) { self::$_instance = new self(); } return self::$_instance; }
public function getTasks() { $condition = array(array('id', '>', $this->lastFlagId)); $sort = array('id', 'asc'); if ($this->_dataBase == Const_ShowcaseOrders::SALE_DB) { $tasks = Model_Broker_AdPropsChangeSaleLog::getList($this->lastFlagYM, $condition, $this->limit, $sort); } else { $tasks = Model_Broker_AdPropsChangeRentLog::getList($this->lastFlagYM, $condition, $this->limit, $sort); } return $tasks; }
public function getBrokerTimeHouse($brokerId, $sdate, $edate, $dataBase) { $ary = $tmp = array(); if ($dataBase == Const_ShowcaseOrders::SALE_DB) { $ary = Model_Broker_AdPropsChangeSaleLog::getInstance()->getTimeProp($brokerId, $sdate, $edate); } elseif ($dataBase == Const_ShowcaseOrders::RENT_DB) { $ary = Model_Broker_AdPropsChangeRentLog::getInstance()->getTimeProp($brokerId, $sdate, $edate); } else { return false; } if ($ary) { foreach ($ary as $val) { $pos = strpos($val['reason'], '展示表'); if ($pos !== false) { $tmp[] = $val; } } } return $tmp; }
/** * 插入房源操作日志 * @param $proId * @param $brokerId * @param $cityId * @param $type * @param $flag */ private function insertProLog($proId, $brokerId, $cityId, $type, $flag) { //插入日志表 $logData = array(); $logData['brokerId'] = $brokerId; $logData['cityId'] = $cityId; $logData['propId'] = $proId; $logData['reason'] = $flag == Const_ShowcaseOrders::PRO_CHANGE_LOG_FLAG_IN ? Const_ShowcaseOrders::PRO_CHANGE_LOG_REASON_SHOW_UP : Const_ShowcaseOrders::PRO_CHANGE_LOG_REASON_SHOW_DOWN; $logData['type'] = $type; $logData['flag'] = $flag; $logData['createTime'] = time(); if ($this->jobType == Const_ShowcaseOrders::SALE_DB) { Model_Broker_AdPropsChangeSaleLog::getInstance()->insertOne($logData); } else { Model_Broker_AdPropsChangeRentLog::getInstance()->insertOne($logData); } }
/** * 删除展示房源信息 * @param $brokerId 二手房经纪人ID * @param $cityId 城市ID * @param bool $sendShowcase 是否发送橱窗取消消息 * @param bool $sendProMsg 是否发送房源上架消息 */ private function deleteBrokerShowPro($brokerId, $cityId, $sendShowcase = true, $sendProMsg = true) { if ($sendShowcase) { Bll_Broker_ShowcaseAdSetPro::getInstance()->sendAdProChangeMes($brokerId, $cityId, array(Const_ShowcaseOrders::SHOWCASE_CANCEL), array(), $this->jobType, $this->jobYm); } $proInfos = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdPropShowInfo($brokerId, $this->jobType); if (!empty($proInfos)) { $proIds = array(); foreach ($proInfos as $proVal) { $proVal->delete(); $proIds[] = $proVal->propId; //插入日志表 $logData = array(); $logData['brokerId'] = $brokerId; $logData['cityId'] = $proVal->cityId; $logData['propId'] = $proVal->propId; $logData['reason'] = Const_ShowcaseOrders::PRO_CHANGE_LOG_REASON_SHOW_DOWN; $logData['type'] = $proVal->type; $logData['flag'] = Const_ShowcaseOrders::PRO_CHANGE_LOG_FLAG_OUT; $logData['createTime'] = time(); if ($this->jobType == Const_ShowcaseOrders::SALE_DB) { Model_Broker_AdPropsChangeSaleLog::getInstance()->insertOne($logData, $this->jobYm); } else { Model_Broker_AdPropsChangeRentLog::getInstance()->insertOne($logData, $this->jobYm); } } //向中间件发送消息 if ($sendProMsg) { Bll_Broker_ShowcaseAdSetPro::getInstance()->sendAdProChangeMes($brokerId, $cityId, array(Const_ShowcaseOrders::SHOWCASE_CANCEL_SET), $proIds, $this->jobType, $this->jobYm); } } }