/** * 经纪人操作添加记录 */ public function logHouseOperation($houseId, $memberId, $title, $comment = '') { if (!empty($comment) && strlen($comment) > 2000) { $comment = substr($comment, 0, 2000); } $houseInfo = Model_House_JpHouseIdx::getPropInfoByPk($houseId); $DBmember = Model_Broker_JpBroker::getJpBrokerInfoByPk($memberId); $PLog = new Model_Log_JpHouseOperation(); $PLog->house_id = $houseId; $PLog->house_type = $houseInfo->houseType; $PLog->member_id = $memberId; $PLog->operator_id = $memberId; $PLog->operator_name = $DBmember->realName; $PLog->title = $title; $PLog->comment = $comment; $PLog->save(); }
/** * @param $houseId * @param $selfPage * @return int */ public static function editRedirect($houseId, $selfPage) { $configArr = array(1 => 'jpor', 2 => 'jpos', 3 => 'jpsr', 4 => 'jpss'); if ($houseId) { $houseIdx = Model_House_JpHouseIdx::getPropInfoByPk($houseId); if ($houseIdx) { if ($configArr[$houseIdx->houseType] == $selfPage) { return 0; } else { return $configArr[$houseIdx->houseType] . '/' . $houseId; } } } return 'jpor/?from=editRedirect'; }
/** * 计划导致房源下架 * @param $p_intHouseID * @return bool */ public static function houseOutShelves($intHouseId, $memberId = 0) { if (empty($memberId)) { $apf = APF::get_instance(); $memberId = $apf->get_request()->get_member_id(); } $DHouseIdx = Model_House_JpHouseIdx::getPropInfoByPk($intHouseId); if (!isset($DHouseIdx)) { return false; } $class = Model_House_JpHouseIdx::getHouseTypeModelClass($DHouseIdx->houseType); $objHouse = $class::getPropInfoByPk($intHouseId); $objHouse->id = $intHouseId; $objHouse->isList = 0; $objHouse->updateTime = time(); $rs = $objHouse->save(); //log $delTit = Const_CrmHouseLog::V_OPERATION_TITLE_OUT_SHELVES; Bll_Log_JpHouse::getInstance()->logHouseOperation($intHouseId, $memberId, $delTit, '计划终止房源下架'); // solr self::solr_delete($intHouseId, Model_House_JpHouseToSolr::ENUM_STATUS_UPDATE); return false; }
public function handle_request() { //分表 $date = date('Ymd'); $id = 0; //获取游标 $dateFlag = $this->getFlag(); if (!empty($dateFlag)) { $date = $dateFlag['date']; $id = $dateFlag['id']; } //竞价队列数据获取 $ProLogList = Model_Log_HouseLogNew::getProLogList($date, $id, $this->limit); //判断当前队列是否处理完成 if (empty($ProLogList)) { //判断是否切换表 if ($date < date('Ymd')) { $date = date('Ymd', strtotime($date) + 24 * 3600); $id = 0; //记录表游标 $this->setFlag(array('date' => $date, 'id' => $id)); } //休息1秒钟 $this->setShCommonSleepTime(1); $this->setLog(date('Y-m-d H:i:s') . ' 处理完成'); exit; } //队列数据处理 foreach ($ProLogList as $list) { $id = $list['id']; $time = 0; //查询房源的发布时间 if ($list['siteType'] == 1) { //二手房 $ajkProInfo = Bll_House_EsfHouse::getHouseInfo($list['houseId'], $list['cityId']); if ($ajkProInfo->postDate) { $time = $ajkProInfo->postDate; } } elseif ($list['siteType'] == 2) { $hzProInfo = Model_House_HzPropSearch::get_prop_by_prop_id($list['cityId'], $list['houseId']); if ($hzProInfo['created']) { $time = $hzProInfo['created']; } } elseif ($list['siteType'] == 3) { $jpProInfo = Model_House_JpHouseIdx::getPropInfoByPk($list['houseId']); if ($jpProInfo['createTime']) { $time = strtotime($jpProInfo['createTime']); } } //写索引表 if (!empty($time)) { //查询数据是否存在 $ProLogIndex = Model_Log_HouseLogIndexNew::getProLogIndexByProId($list['houseId'], date('Ymd', strtotime($list['addDate'])), $list['siteType'], date('Ymd', $time)); if (!empty($ProLogIndex)) { //记录处理日志 $this->setLog(date('Y-m-d H:i:s') . ' id:' . $list['id'] . ' 城市id:' . $list['cityId'] . ' 经纪人:' . $list['brokerId'] . ' 房源:' . $list['houseId'] . ' 网站:' . $list['siteType'] . ' 房源创建时间:' . date('Y-m-d H:i:s', $time) . ' remark:索引已存在'); continue; } try { Model_Log_HouseLogIndexNew::create(array('proId' => $list['houseId'], 'datei' => date('Ymd', strtotime($list['addDate'])), 'siteType' => $list['siteType']), date('Ymd', $time))->save(); } catch (Exception $e) { print_r($e); } //记录处理日志 $this->setLog(date('Y-m-d H:i:s') . ' id:' . $list['id'] . ' 城市id:' . $list['cityId'] . ' 经纪人:' . $list['brokerId'] . ' 房源:' . $list['houseId'] . ' 网站:' . $list['siteType'] . ' 房源创建时间:' . date('Y-m-d H:i:s', $time) . ' remark:创建索引'); } else { //记录处理日志 $this->setLog(date('Y-m-d H:i:s') . ' id:' . $list['id'] . ' 城市id:' . $list['cityId'] . ' 经纪人:' . $list['brokerId'] . ' 房源:' . $list['houseId'] . ' 网站:' . $list['siteType'] . ' remark:未找到房源信息'); } } $this->setFlag(array('date' => $date, 'id' => $id)); //休息10毫秒 $this->setShCommonSleepTime(0.01); }
public static function delete_prop($params) { //是否套餐经纪人,套餐单独处理 //$broker_info = Dao_Broker_BrokerInfo::get_broker_base_info($params['broker_id']); if (Bll_City::isComboCity($params['city_id'])) { return self::delete_combo_prop($params); } if (empty($params['pro_id'])) { return self::build_return(0, array("房源ID为空")); } $out_return[] = "队列(" . $params['id'] . ")开始处理"; $remark = json_decode($params['remark'], 1); if ($remark['fix'] == 'online') { //记录房源手动移除定价组日志 $data = self::build_prop_log($params, 11, "房源移出定价组", $params['broker_id']); if (Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) { $all_return[] = "房源手动移出定价组日志写入成功"; } else { $all_return[] = "房源手动移出定价组日志写入失败"; } //写入下线日志 $data = self::build_prop_log($params, 6, "房源下线", $params['broker_id']); if (Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) { $all_return[] = "房源" . $params['pro_id'] . "下线日志写入成功"; } else { $all_return[] = "房源" . $params['pro_id'] . "下线日志写入失败"; } } elseif ($remark['fix'] == 'stop') { //记录房源手动移除定价组日志 $data = self::build_prop_log($params, 11, "房源移出定价组", $params['broker_id']); if (Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) { $all_return[] = "房源手动移出定价组日志写入成功"; } else { $all_return[] = "房源手动移出定价组日志写入失败"; } } //获取房源分表信息 if (BLL_Fixedspread_StaticPlanUpDownSwicher::isOnline()) { $houseInfoObj = Model_House_JpHouseIdx::getPropInfoByPk($params['pro_id']); $houseClass = Model_House_JpHouseIdx::getHouseTypeModelClass($houseInfoObj->houseType); $houseObj = $houseClass::getPropInfoByPk($params['pro_id']); //更新删除房源时间 $houseObj->deleteTime = date("Y-m-d H:i:s"); $houseObj->save(); $all_return[] = "houseType:" . $houseInfoObj->houseType . ",deleteTime:0=>" . date("Y-m-d H:i:s"); } //写房源删除日志 $data = self::build_prop_log($params, 3, "房源删除", 0); if (Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) { $all_return[] = '写房源删除日志成功'; return self::build_return(1, $all_return); } else { $all_return[] = '写房源删除日志失败'; return self::build_return(0, $all_return); } }
/** * @param $houseId * @param $forceMaster * @throws Exception * 重新计算spreadPrice字段 */ public function rebuildSpreadPrice($houseId, $forceMaster) { $houseIdxInfo = Model_House_JpHouseIdx::getPropInfoByPk($houseId, $forceMaster); if (!empty($houseIdxInfo) && !empty($houseIdxInfo->hosueType)) { $houseTypeClass = Model_House_JpHouseIdx::getHouseTypeModelClass($houseIdxInfo->hosueType); $houseDetail = $houseTypeClass::getPropInfoByPk($houseId, $forceMaster); //如果没有基准价格 $intHouseType = $houseIdxInfo->houseType; if (in_array($intHouseType, array(1, 3))) { $floPrice = $houseDetail->monthlyRent; } else { $floPrice = $houseDetail->totalPrice; } $arrBasePrice = $this->getSpreadPriceByPrice($floPrice, $intHouseType, $houseIdxInfo->cityId); $houseDetail->spreadPrice = $arrBasePrice['base_price']; $houseDetail->save(); } }