public function addOrderLog($data) { if (!$data) { return false; } $obj = new Model_Broker_AdSetSaleLog(date('Ym')); foreach ($data as $key => $value) { $obj->{$key} = $value; } return $obj->save(); }
/** * 获取ID大于传入值的日志数据 * @param $id * @param $ym * @param int $limit * @param $type 业务类型 * @return array */ public function getAdSetLogMoreThanId($id, $ym, $limit = 100, $type = Const_ShowcaseOrders::SALE_DB) { if ($type == Const_ShowcaseOrders::SALE_DB) { return Model_Broker_AdSetSaleLog::getInstance()->getLogMoreThanId($id, $ym, $limit); } elseif ($type == Const_ShowcaseOrders::RENT_DB) { return Model_Broker_AdSetRentLog::getInstance()->getLogMoreThanId($id, $ym, $limit); } else { return array(); } }
/** * 开始处理数据 * @return bool */ protected function proccessData() { if (empty($this->jobData)) { //没有数据 if ($_SERVER['IS_PG_JOB']) { //如果是PG不中断 return false; } $this->id = 'END'; //中断标志 return false; } foreach ($this->jobData as $jobData) { $this->id = $jobData->id; $jobData->isStop = Const_ShowcaseOrders::EXPIRE_ORDER; //更新为自动过期 $jobData->updateTime = date('Y-m-d H:i:s', time()); if ($jobData->save()) { //插入日志数据 $logData = array(); $logData['brokerId'] = $jobData->brokerId; $logData['cityId'] = $jobData->cityId; $logData['totalDays'] = 0; $logData['startDate'] = $jobData->startDate; $logData['endDate'] = $jobData->endDate; $logData['opType'] = Const_ShowcaseOrders::OPTYPE_5; $logData['createTime'] = time(); if ($this->jobType == Const_ShowcaseOrders::SALE_DB) { Model_Broker_AdSetSaleLog::getInstance()->addOrderLog($logData); } elseif ($this->jobType == Const_ShowcaseOrders::RENT_DB) { Model_Broker_AdSetRentLog::getInstance()->addOrderLog($logData); } } } return true; }
/** *增值业务日志订单操作 * $data 经纪人订单信息 * $type 好租是 rent 二手房sale */ public function insertSetLog($data, $type) { if ($type == Const_ShowcaseOrders::SALE_DB) { $logId = Model_Broker_AdSetSaleLog::getInstance()->addOrderLog($data); if ($logId) { $res = array('status' => true, 'id' => $logId); } else { $res = array('status' => false); } } elseif ($type == Const_ShowcaseOrders::RENT_DB) { $logId = Model_Broker_AdSetRentLog::getInstance()->addOrderLog($data); if ($logId) { $res = array('status' => true, 'id' => $logId); } else { $res = array('status' => false); } } else { $res = array('status' => false); } return $res; }