/** * @param $brokerId * @param AJKRequest $request * @return bool */ private function setBrokerLimitTemp($brokerId, $request) { // TODO 设置经纪人封顶信息 $tempId = $request->get_parameter('tempId'); $startTime = strtotime(date('Ymd 00:00:00', strtotime('+1 day'))); return Bll_Ppc_ServiceAPI::setPpcBrokerLimitTemp($brokerId, $tempId, $startTime); }
public function handle_request_internal() { $request = APF::get_instance()->get_request(); $managerCookie = $request->get_cookie('manager_id'); if (!empty($managerCookie)) { echo json_encode(array('status' => 'error', 'data' => '没有操作权限。')); return; } $houseIds = $request->get_parameter('houseIds'); $planId = $request->get_parameter('planId'); if (is_null($houseIds)) { echo json_encode(array('status' => 'error', 'data' => '请输入房源ID')); return; } $houseIds = explode(',', $houseIds); $houseBaseInfoList = Bll_House_EsfHouse::getHouseInfoByHouseIdEx(static::$intBrokerID, $houseIds, static::$intBrokerCityID, array('proId')); if (empty($houseBaseInfoList)) { echo json_encode(array('status' => 'error', 'data' => '获取房源信息失败')); return; } $houseIdList = array(); foreach ($houseBaseInfoList as $houseBaseInfo) { $houseIdList[] = $houseBaseInfo['proId']; } $result = Bll_Ppc_ServiceAPI::fixPlanAddHouse(static::$intBrokerID, $houseIdList, $planId, 21181); if ($result && strcasecmp('ok', $result['status']) == 0) { echo json_encode(array('status' => 'ok', 'data' => '推广成功')); } elseif ($result && strcasecmp('error', $result['status']) == 0) { echo json_encode(array('status' => 'error', 'data' => $result['info'])); } else { echo json_encode(array('status' => 'ok', 'data' => '推广成功', 'msg' => '调用API超时')); } }
public function handle_request_internal() { $brokerPpcLimit = Bll_Ppc_ServiceAPI::getPpcBrokerLimitInfo(static::$intBrokerID, Bll_Ppc_ServiceAPI::PPC_BROKER_LIMIT_ESF_SITE); if (empty($brokerPpcLimit)) { echo json_encode(array('status' => 'error')); } else { echo json_encode(array_merge(array('status' => 'ok'), $brokerPpcLimit)); } }
private function stopPlan($brokerId, $cityId, $planId, $remark) { $status = Bll_Ppc_ServiceAPI::pauseBidPlan($planId, $cityId, 6); if ($status) { $status = Bll_Plan_Bid_AjkPlan::stopPlan($brokerId, $planId, static::$intBrokerCityID); Bll_Plan_Bid_AjkPlan::addHouseBidSpreadLog($planId, $brokerId, 'STOP', $remark, 0); } return array('status' => $status ? 'ok' : 'error'); }
public function handle_request_internal() { $request = APF::get_instance()->get_request(); $planId = $request->get_parameter('planId'); $houseIds = $request->get_parameter('houseIds'); if (Bll_Ppc_ServiceAPI::deleteHouseFromFixPlan(static::$intBrokerID, $planId, $houseIds, 21181)) { echo '{"status":"OK"}'; } else { echo '{"status":"error"}'; } }
/** * 重新定价推广 * * @param int $brokerId * @param AJKRequest $request * @return array */ public function startPlan($brokerId, $request) { $managerCookie = $request->get_cookie('manager_id'); if (!empty($managerCookie)) { return array('status' => 'error', 'data' => '没有操作权限。'); } $planId = $request->get_parameter('planId'); if (Bll_Ppc_ServiceAPI::restartFixPlan($brokerId, $planId, 21181)) { return array('status' => 'ok'); } return array('status' => 'error', 'data' => '调用API错误'); }
public function handle_request_internal() { $propIds = explode(',', $this->_params['propIds']); $cityId = $this->_params['cityId']; //获取房源信息 $propsInfos = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId); //板块信息 $blockCode = array(); $brokerIds = array(); foreach ($propsInfos as $propsInfoVal) { $blockCode[] = substr($propsInfoVal['areaCode'], 8, 4); $brokerIds[] = $propsInfoVal['brokerId']; } $blockInfos = Bll_Community_CommunityGardener::getAreaBlock($blockCode); //获取经纪人微聊信息 $chatInfos = Model_Mobile_BrokerChatInfo::getBrokerChatInfos($brokerIds); $propList = array(); foreach ($propsInfos as $propsInfo) { $row = array(); $row['brokerId'] = $propsInfo['brokerId']; $row['chatId'] = $chatInfos[$row['brokerId']]['chatId']; $row['propId'] = $propsInfo['proId']; $row['cityId'] = $propsInfo['cityId']; $row['title'] = $propsInfo['proName']; $row['commId'] = $propsInfo['commId']; $row['commName'] = $propsInfo['commName']; $row['areaCode'] = $propsInfo['areaCode']; $row['blockName'] = $blockInfos[$row['areaCode']]; $row['createTime'] = date("Y-m-d H:i:s", $propsInfo['postDate']); $row['room'] = $propsInfo['roomNum']; $row['hall'] = $propsInfo['hallNum']; $row['toilet'] = $propsInfo['toiletNum']; $row['area'] = $propsInfo['areaNum']; $row['areaUnit'] = '平米'; $row['price'] = intval($propsInfo['proPrice']); $row['priceUnit'] = '万'; //获取房源图片 $houseImageInfo = Bll_Ppc_ServiceAPI::getHouseImageInfo($propsInfo['proId']); $houseImageBaseInfos = $houseImageInfo['imageBaseInfo']; $houseImageUrls = array(); if ($houseImageBaseInfos) { foreach ($houseImageBaseInfos as $imageInfo) { $houseImageUrls[] = Util_Image::getInstance()->getResizeURL($imageInfo['FILENAME'], $imageInfo['HOST_ID'], 420, 315); } } $row['imageUrls'] = $houseImageUrls; $propList[] = $row; } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('props' => $propList)); }
public function handlePost() { $this->request = APF::get_instance()->get_request(); $brokerId = $this->request->getBrokerId(); $cityId = $this->request->getBrokerCityId(); $params = $this->request->get_parameters(); $params['broker_id'] = $brokerId; $result = array(); try { if ($this->action == 'edit') { $houseInfo = Bll_House_EsfEdit::getHouseBaseInfo($this->houseId); /** 违规房源不可以编辑 */ if (isset($houseInfo['isIllegal']) && $houseInfo['isIllegal']) { $this->redirect2Result(Const_PublishCode::UNKNOWN_ERROR, 'ajk', 'edit', $this->houseId, '已违规房源不可编辑'); } $result = Bll_House_EsfEdit::saveHouseInfo($brokerId, $cityId, $this->houseId, $params); } if ($this->action == 'publish') { $result = Bll_House_EsfPublish::saveHouseInfo($brokerId, $params, $this->isComboBroker); if ($result['status'] == 'ok') { $this->houseId = $result['houseId']; } } /** 委托房源发布 */ if ($this->action == 'commission') { $result = Bll_House_EsfCommission::saveHouseInfo($brokerId, $cityId, $this->commissionId, $params, $this->isComboBroker); if ($result['status'] == 'ok') { $this->houseId = $result['houseId']; } } if ($result['status'] != 'ok') { $this->redirect2Result(Const_PublishCode::PUBLISH_PROP_ERROR, 'ajk', $this->action, $this->houseId, $result['info']); } } catch (Exception $e) { $params['brokerId'] = self::$intBrokerID; APF::get_instance()->get_nlogger()->log(__CLASS__, $params); $this->redirect2Result(Const_PublishCode::PUBLISH_PROP_ERROR, 'ajk', $this->action, $this->houseId, $e->getMessage()); } /** 立即推广 */ if (isset($params['broker_action']) && $params['broker_action'] == 'publish') { /** 套餐推广 */ if ($this->isComboBroker) { $spreadResult = Bll_Combo_HouseRelation::houseStartComboSpreadV2($brokerId, $cityId, array($this->houseId), Bll_Combo_HouseRelation::SITE_TYPE_AJK); if ($spreadResult['status'] != 1) { switch ($spreadResult['status']) { /** 没有套餐 */ case -1: case -2: $this->redirect2Result(Const_PublishCode::SPREAD_PROP_NO_COMBO, 'ajk', $this->action, $this->houseId, $spreadResult['msg']); break; /** 套餐未生效 */ /** 套餐未生效 */ case -3: $this->redirect2Result(Const_PublishCode::SPREAD_PROP_COMBO_ACTIVE, 'ajk', $this->action, $this->houseId, $spreadResult['msg']); break; /** 推广房源数已满 */ /** 推广房源数已满 */ case -4: case -5: $this->redirect2Result(Const_PublishCode::SPREAD_PROP_COMBO_LIMIT, 'ajk', $this->action, $this->houseId, $spreadResult['msg']); break; default: $this->redirect2Result(Const_PublishCode::SPREAD_PROP_COMBO_FAIL, 'ajk', $this->action, $this->houseId, $spreadResult['msg']); } } } else { /** 定价推广 */ if ($this->action == 'edit') { /** 定价推广失败 房源已经推广 */ if (BLL_Plan_EsfPropFixedPlanRelation::isHouseOnline($cityId, $this->houseId)) { $this->redirect2Result(Const_PublishCode::SPREAD_PROP_PLAN_IN, 'ajk', $this->action, $this->houseId, '房源已经推广'); } } $fixPlanList = BLL_Plan_EsfPropFixedPlanRelation::getBrokerValidPlan($brokerId); if (empty($fixPlanList)) { $this->redirect2Result(Const_PublishCode::UNKNOWN_ERROR, 'ajk', $this->action, $this->houseId, '获取定价计划信息失败'); } $fixPlan = $fixPlanList[0]; /** 定价推广失败 已经超出推广房源上限 */ if (!Bll_Broker_HzBroker::ajkPpcBrokerCanSpreadHouse($cityId, $brokerId)) { $this->redirect2Result(Const_PublishCode::SPREAD_PROP_OUT_LIMIT, 'ajk', $this->action, $this->houseId, '已经超出推广房源上限'); } $spreadResult = Bll_Ppc_ServiceAPI::fixPlanAddHouse($brokerId, $this->houseId, $fixPlan['id'], '23532'); if (isset($spreadResult['status'])) { if ($spreadResult['status'] != 'ok') { $this->redirect2Result(Const_PublishCode::API_ERROR, 'ajk', $this->action, $this->houseId, $spreadResult['info']); } } else { $this->redirect2Result(Const_PublishCode::API_ERROR, 'ajk', $this->action, $this->houseId, '系统繁忙(推广房源超时)'); } /** 定价推广失败 计划已经手动停止 */ if ($fixPlan['viewTime'] == 1861891200) { /** 定价推广失败 认证未通过 */ $brokerCheckState = Bll_Broker_BrokerCheckInfo::getCheckStateByBrokerId($brokerId); if ($brokerCheckState != 1) { $this->redirect2Result(Const_PublishCode::SPREAD_PROP_AUDITED_ERROR, 'ajk', $this->action, $this->houseId, '认证未通过'); } $this->redirect2Result(Const_PublishCode::SPREAD_PROP_HANDLE_STOP, 'ajk', $this->action, $this->houseId, '计划已经手动停止'); } /** 定价推广失败 账户余额不足,充值后自动推广 */ if ($fixPlan['viewTime'] == 1893427200) { $this->redirect2Result(Const_PublishCode::SPREAD_PROP_BALANCE_ERROR, 'ajk', $this->action, $this->houseId, '账户余额不足,充值后自动推广'); } } /** 推广成功 */ $this->redirect2Result(Const_PublishCode::HOUSE_SPREAD_SUCCESS, 'ajk', $this->action, $this->houseId); } /** 发布成功 */ $this->redirect2Result(Const_PublishCode::HOUSE_SAVE_SUCCESS, 'ajk', $this->action, $this->houseId); }
public function handle_request_internal() { header("Access-Control-Allow-Origin: *"); $propId = $this->_params['propId']; //好丑陋。。。。。。好无奈。。。。。。 //委托房源自动转发停用,为了app能够展示报错信息。。。 if (empty($propId)) { $this->_params['apiDebug'] = 1; return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '0000', 'message' => '委托房源自动转发功能已停用;若要发布请手动发布'); } $propInfo = Bll_Ppc_ServiceAPI::getHouseInfo($propId); $brokerId = $this->_params['brokerId']; $houseInfo = Model_House_EsfHouseElementFactory::getHouseBaseInfo($propId); if (empty($houseInfo)) { $cityId = Model_Broker_AjkBrokerExtend::getCityIdByBrokerId($this->_params['brokerId']); $houseInfo = Bll_House_EsfHouse::getHouseBaseInfo($propId, $cityId); } if (!empty($houseInfo)) { $result['status'] = 'ok'; $areaCode = $houseInfo['areaCode']; $block = Bll_Commtype_Api::getInfoByTypeCode($areaCode); $area = Bll_Commtype_Api::getInfoByTypeId($block['parentId']); $area_name = $area['typeName']; $block_name = $block['typeName']; $data['title'] = $houseInfo['proName']; $data['commId'] = $houseInfo['commId']; $data['commName'] = $houseInfo['commName']; //小区信息 $commInfo = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($data['commId'], 2); $data['commLocation'] = $commInfo['commLocal']; $data['sosolat'] = $commInfo['sosolat']; //纬度 $data['sosolng'] = $commInfo['sosolng']; //经度 $data['floor'] = $propInfo['property']['ProFloor']; $data['totalFloor'] = $propInfo['property']['FloorNum']; $propDescription = $propInfo['property']['sale']['AddExplan']; $propDescription = str_replace('<p>', "", $propDescription); $propDescription = str_replace('</p>', "", $propDescription); $propDescription = trim($propDescription); $data['propDescription'] = $propDescription; $data['areaname'] = $area_name; $data['blockname'] = $block_name; $data['roomNum'] = $houseInfo['roomNum']; $data['hallNum'] = $houseInfo['hallNum']; $data['toiletNum'] = $houseInfo['toiletNum']; $data['area'] = $houseInfo['areaNum']; $data['areaUnit'] = '平米'; $data['price'] = $houseInfo['proPrice']; $data['priceUnit'] = '万'; $data['isMoreImg'] = $houseInfo['isHighQulity']; $data['isVisible'] = $houseInfo['isVisible']; $data['isPhonePub'] = $houseInfo['uriCode'] == 'mobile.asyn' || $houseInfo['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0; $data['propImagesUrl'] = array(); $data['propImages'] = $data['outdoorImage'] = array(); if ($propInfo['attachments']['attachments']) { $propImageNum = 0; $outdoorImageNum = 0; $images = $propInfo['attachments']['attachments']; foreach ($images as $image) { if ($image['DataType'] == 2) { if ($propImageNum >= 8) { continue; } $imageInfo = array(); $url = Util_ImageUtils::getResizeURL($image['FileName'], $image['host_id'], 600, 600); $url = str_replace("display", "display/e", $url); $imageInfo['bigImageUrl'] = $url; $data['propImages'][] = $imageInfo; $propImageNum += 1; } else { if ($image['DataType'] == 3) { if ($outdoorImageNum >= 1) { continue; } $imageInfo = array(); $url = Util_ImageUtils::getResizeURL($image['FileName'], $image['host_id'], 600, 600); $url = str_replace("display", "display/e", $url); $imageInfo['bigImageUrl'] = $url; $data['outdoorImage'][] = $imageInfo; $outdoorImageNum += 1; } } } } $spread = Model_Plan_AjkPropspread::getAjkPropSpreadByIds($propId); $data['isChoice'] = $data['isBid'] = 0; if (!empty($spread)) { if ($spread[0]['bidVersion'] == 1 && $spread[0]['status'] == 1) { $data['isBid'] = 1; } elseif ($spread[0]['bidVersion'] == 2 && ($spread[0]['status'] == 1 || $spread[0]['status'] == 11)) { $data['isChoice'] = 1; } } //计算出房源推广天数 $timeFixStr = strtotime(date("Ymd", $houseInfo['postDate'])); $leftDay = floor((time() - $timeFixStr) / 86400); $data['publishDaysMsg'] = $leftDay > 0 ? $leftDay . '天前发布' : '今天发布'; $imgBll = Bll_Image_EsfHouseImage::getInstance(); $data['imgUrl'] = $imgBll->getThumbImageUrl($propId, $houseInfo['commId']); $mobileBaseDomain = APF::get_instance()->get_config("mobile_base_domain"); $data['url'] = 'http://' . $mobileBaseDomain . '/sale/x/' . $houseInfo['cityId'] . '/' . $houseInfo->proId; //增加委托房源标签 if ($houseInfo['commitionType'] == 2) { $data['isEntrust'] = 1; } else { $data['isEntrust'] = 0; } } else { $data['status'] = 'error'; $data['message'] = '房源信息不存在'; } $result['data'] = $data; return $result; }
public function handle_request() { $brokerList = Model_Broker_AjkBrokerExtend::scanBroker($this->_startId, self::BATCH_LIMIT); if (empty($brokerList)) { file_put_contents($this->_doneFile, 'YES'); } foreach ($brokerList as $broker) { $brokerId = $broker['brokerId']; $cityId = $broker['cityId']; $this->setCursor($brokerId); /** 套餐城市的不予以处理 */ if (Bll_City::isComboCity($broker['cityId'])) { $this->logMsg(sprintf('经纪人[%d] 城市[%d] 是套餐城市,不予处理。', $brokerId, $cityId)); continue; } /** 判断经纪人所在城市是否已经开启多档封顶 */ if (false == Bll_Broker_Manage_AjkPropList::checkSelectLimitTempAvailable($cityId)) { $this->logMsg(sprintf('经纪人[%d] 城市[%d] 没有开启多档封顶,不予处理。', $brokerId, $cityId)); continue; } /** 获取经纪人城市封顶限额 */ $ppcLimitInfo = Bll_Ppc_ServiceAPI::getPpcBrokerLimitInfo($brokerId); if (empty($ppcLimitInfo)) { $this->logMsg(sprintf('经纪人[%d] 城市[%d] 获取封顶限额失败。', $brokerId, $cityId)); file_put_contents($this->_errorBroker, $brokerId, FILE_APPEND); continue; } $ppcFixHouseCountLimit = $ppcLimitInfo['promotionLimit']; /** 获取经纪人所有的定价计划 */ $fixPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($broker); $fixSpreadHouseList = array(); foreach ($fixPlanList as $fixPlan) { $planId = $fixPlan['id']; /** 获取经纪人指定定价计划下房源计划关系 */ $fixSpreadHouseList = $fixSpreadHouseList + Bll_Plan_Fix_AjkPlan::getPropFixedPlanRelation($brokerId, $cityId, $planId); } $fixSpreadHouseCount = count($fixSpreadHouseList); if ($fixSpreadHouseCount <= $ppcFixHouseCountLimit) { $this->logMsg(sprintf('经纪人[%d] 城市[%d] 可以推广[%d]套房源,实际推广了[%d]套房源,没有多余房源。', $brokerId, $cityId, $ppcFixHouseCountLimit, $fixSpreadHouseCount)); continue; } $this->logMsg(sprintf('经纪人[%d] 城市[%d] 可以推广[%d]套房源,实际推广了[%d]套房源,多余[%d]房源下架。', $brokerId, $cityId, $ppcFixHouseCountLimit, $fixSpreadHouseCount, $fixSpreadHouseCount - $ppcFixHouseCountLimit)); /** 测试,不予以处理 */ file_put_contents('/data1/logs/Repair_Bug46849.test', $brokerId, FILE_APPEND); continue; $updateTime2IdMapping = array(); $updateTime = array(); foreach ($fixSpreadHouseList as $fixSpreadHouse) { $intUpdateTime = strtotime($fixSpreadHouse['updatedDatetime']); $updateTime[] = $intUpdateTime; if (!isset($updateTime2IdMapping[$intUpdateTime])) { $updateTime2IdMapping[$intUpdateTime] = array(); } $updateTime2IdMapping[$intUpdateTime][] = $fixSpreadHouse; } $updateTime = array_unique($updateTime, SORT_NUMERIC); rsort($updateTime, SORT_NUMERIC); $relationList = array(); foreach ($updateTime as $key) { $relationList = array_merge($relationList, $updateTime2IdMapping[$key]); } /** 需要下架的推广房源 */ $houseList = array_slice($relationList, 0, $fixSpreadHouseCount - $ppcFixHouseCountLimit); foreach ($houseList as $house) { if (Bll_Ppc_ServiceAPI::deleteHouseFromFixPlan($brokerId, $house['planId'], $house['propId'], 46849)) { $this->logMsg(sprintf('经纪人[%d] 城市[%d] 房源[%d]从计划[%d]下架成功。', $brokerId, $cityId, $house['propId'], $house['planId'])); continue; } $this->logMsg(sprintf('经纪人[%d] 城市[%d] 房源[%d]从计划[%d]下架失败。', $brokerId, $cityId, $house['propId'], $house['planId'])); } } if (count($brokerList) < self::BATCH_LIMIT) { $this->logMsg(sprintf('startId: %d 处理结束。', $this->_startId)); file_put_contents($this->_doneFile, 'YES'); return; } }
public function handle_request_internal() { $request = APF::get_instance()->get_request(); $houseIds = $request->get_parameter('propIds'); /** * type: today, all */ $type = $request->get_parameter('type'); /** * plan_type: bid, fix */ $planType = $request->get_parameter('plan_type'); $rtn = array_fill_keys($houseIds, 0); if (strcasecmp($planType, 'fix') === 0) { /** * 定价房源点击量 */ if (strcasecmp($type, 'today') == 0 && !empty($houseIds)) { /** * 房源今日点击量 */ $date = date('Ymd'); // $houseClickInfoList = Bll_Ppc_ServiceAPI::getHouseClickInfo($houseIds, strtotime(date('Y-m-d 00:00:00')), time(), static::$intBrokerID); $houseClickInfoList = Bll_Ppc_ServiceAPI::getHouseClickInfoNew(static::$intBrokerID, $houseIds, $date, $date); foreach ($houseClickInfoList as $houseClickInfo) { $rtn[$houseClickInfo['propId']] += max(0, $houseClickInfo['clickNum']); } /** * 精选点击 */ $choiceClickList = Bll_Plan_Bid_AjkPlan::getHouseBidClick($houseIds, static::$intBrokerCityID, date('Ymd')); foreach ($choiceClickList as $houseId => $clickCount) { $rtn[$houseId] += $clickCount; } } else { /** * 房源累计点击量 */ $fixPlanIdList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList(static::$intBrokerID); if (empty($fixPlanIdList)) { $rtn = array(); } else { $fixPlanId = $fixPlanIdList[0]['id']; $houseClickInfoList = Bll_Ppc_ServiceAPI::propFixClickNum(static::$intBrokerID, $houseIds, $fixPlanId); foreach ($houseClickInfoList as $houseClickInfo) { $rtn[$houseClickInfo['propId']] = max(0, $houseClickInfo['clickNum']); } } $houseChoiceClickList = Model_Choice_PropClickCount::getChoiceClickInfo(static::$intBrokerID, static::$intBrokerCityID, $houseIds); foreach ($houseChoiceClickList as $houseChoiceClick) { $rtn[$houseChoiceClick['propId']] += $houseChoiceClick['count']; } } } else { /** * 竞价今日点击量 */ $rtn = Bll_Plan_Bid_AjkPlan::getHouseBidClick($houseIds, static::$intBrokerCityID, date('Ymd')); } echo json_encode($rtn, JSON_FORCE_OBJECT); return false; }
/** * 判断PPC 经纪人是否可以推广房源 * * @param int $cityId * @param int $brokerId * @return bool */ public static function ajkPpcBrokerCanSpreadHouse($cityId, $brokerId) { $houseList = Bll_House_EsfHouse::getFixSpreadHouse($cityId, $brokerId); $ppcLimitInfo = Bll_Ppc_ServiceAPI::getPpcBrokerLimitInfo($brokerId, Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ESF_SITE); return $ppcLimitInfo['promotionLimit'] > count($houseList); }
/** * 删除房源,套餐推广的房源维护套餐推广状态 * * @param int $brokerId * @param int $cityId * @param int|array $houseIds * @return bool */ public static function deleteHouseCombo($brokerId, $cityId, $houseIds) { $houseIds = is_array($houseIds) ? $houseIds : explode(',', $houseIds); if (Bll_Ppc_ServiceAPI::ComboDeleteHouse($brokerId, $houseIds)) { /*$houseRelationList = Bll_Combo_HouseRelation::getHouseRelation($brokerId, $cityId, $houseIds, Bll_Combo_HouseRelation::SITE_TYPE_AJK); foreach ($houseRelationList as $houseRelation) { if (Bll_Combo_HouseRelation::isRelationOnline($houseRelation['state'])) { Bll_Combo_HouseRelation::updateComboStatusById($houseRelation['id'], Model_Combo_HouseRelation::ENUM_HOUSE_HANDLE, Bll_Combo_HouseRelation::SITE_TYPE_AJK); } }*/ return true; } return false; }
/** * 获取房源定价消费信息 * * @param int $houseId * @param int $brokerId * @return array */ public static function getHouseFixSpreadCostInfo($houseId, $brokerId) { $startTime = strtotime(date('Y-m-d 00:00:00', strtotime('-6 day '))); $tempFixSpreadCostInfoList = Bll_Ppc_ServiceAPI::getHouseCostInfo(array($houseId), $startTime, time(), $brokerId); $fixSpreadCostInfoList = array(); foreach ($tempFixSpreadCostInfoList as $fixSpreadCostInfo) { $key = date('m.d', strtotime($fixSpreadCostInfo['time'])); if (isset($fixSpreadCostInfoList[$fixSpreadCostInfo['time']])) { $fixSpreadCostInfoList[$key] += max(0, intval($fixSpreadCostInfo['amount'])) / 100; } else { $fixSpreadCostInfoList[$key] = max(0, intval($fixSpreadCostInfo['amount'])) / 100; } } return $fixSpreadCostInfoList; }
public function handle_request_internal() { if (Bll_Weshop::weshopPropsIsMaintain()) { return array('status' => 'error', 'message' => "系统维护中,请稍后再试!"); } header("Access-Control-Allow-Origin: *"); $brokerId = $this->_params['brokerId']; $propIds = explode(',', $this->_params['propIds']); $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } //房源表查寻后 添加到队列表 $propsInfos = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $brokerInfo->cityId); if (count($propIds) == 1) { //插入 房源列表 并返回 $propInfo = Bll_Ppc_ServiceAPI::getHouseInfo($propIds[0]); if ($propInfo) { $params = array(); $params['cityId'] = $propInfo['property']['CityId']; $params['commId'] = $propInfo['property']['CommId']; $params['brokerId'] = $brokerId; $params['areaId'] = substr($propInfo['property']['AreaCode'], 0, 8); $params['blockId'] = $propInfo['property']['AreaCode']; $params['price'] = $propInfo['property']['ProPrice']; $params['acreage'] = $propInfo['property']['AreaNum']; $params['room'] = $propInfo['property']['RoomNum']; $params['hall'] = $propInfo['property']['HallNum']; $params['toilet'] = $propInfo['property']['ToiletNum']; $propDescription = $propInfo['property']['sale']['AddExplan']; $propDescription = str_replace('<p>', "", $propDescription); $propDescription = str_replace('</p>', "", $propDescription); $propDescription = trim($propDescription); $params['description'] = json_encode($propDescription); $params['title'] = $propInfo['property']['ProName']; $params['floor'] = $propInfo['property']['ProFloor']; $params['totalFloor'] = $propInfo['property']['FloorNum']; $params['status'] = 1; $params['createTime'] = date('Y-m-d H:i:s', time()); $params['updateTime'] = date('Y-m-d H:i:s', time()); $result = Model_Weshop_Props::insertWeshopProps($params); //存储图片 默认图 区分 室内图8张 户型图 1张 $imageUrl = ''; if ($propInfo['attachments']['attachments']) { $propImageNum = 0; $outdoorImageNum = 0; $images = $propInfo['attachments']['attachments']; foreach ($images as $image) { if ($image['DataType'] == 2) { if ($propImageNum >= 8) { continue; } if ($propImageNum == 0) { $img_params['isDefault'] = 1; //默认图 $url = Util_ImageUtils::getResizeURL($image['FileName'], $image['host_id'], 290, 240); //(拼好小图) $imageUrl = str_replace("240", "240c", $url); //无水印格式 } else { $img_params['isDefault'] = 0; } $img_params['imageType'] = 1; //室内图 $propImageNum += 1; } else { if ($image['DataType'] == 3) { if ($outdoorImageNum >= 1) { continue; } $img_params['imageType'] = 2; //户型图 $outdoorImageNum += 1; } } $img_params['propId'] = $result->id; $img_params['imageHostId'] = $image['host_id']; $img_params['imageHash'] = $image['FileName']; $img_params['isDelete'] = 0; $img_params['createTime'] = date('Y-m-d H:i:s', time()); $img_params['updateTime'] = date('Y-m-d H:i:s', time()); //存储图片 Model_Weshop_PropImages::insertWeshopPropImages($img_params); } } if ($result) { //插入 weshop_prop_ext表 $tmp = array('weshopPropId' => $result->id, 'brokerId' => $brokerId, 'propId' => $propIds[0]); Model_Weshop_PropsFilter::insertRecord($tmp); //区域板块 $areaAndBlockIds = array(); $areaId = $params['areaId']; $blockId = $params['blockId']; $areaAndBlockIds[] = $areaId; $areaAndBlockIds[] = $blockId; $commTypeInfos = Bll_Community_CommunityGardener::getCommTypeInfo($areaAndBlockIds); $previewUrl = Bll_Weshop::getPropPreviewUrl(array('brokerId' => $brokerId, 'propId' => $result->id)); return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propId' => $result->id, 'title' => $propInfo['property']['ProName'], 'areaName' => $commTypeInfos[$areaId], 'blockName' => $commTypeInfos[$blockId], 'commId' => $propInfo['property']['CommId'], 'commName' => $propInfo['property']['CommName'], 'room' => $propInfo['property']['RoomNum'], 'hall' => $propInfo['property']['HallNum'], 'toilet' => $propInfo['property']['ToiletNum'], 'price' => $propInfo['property']['ProPrice'], 'priceUnit' => '万', 'area' => $propInfo['property']['AreaNum'], 'areaUnit' => '平米', 'propDescription' => $propDescription, 'previewUrl' => $previewUrl, 'imageUrl' => $imageUrl)); } } } //插入队列表 foreach ($propsInfos as $propsInfo) { if ($propsInfo['brokerId'] == $brokerId) { $params = array(); $params['brokerId'] = $brokerId; $params['propId'] = $propsInfo['proId']; $params['cityId'] = $brokerInfo->cityId; $params['status'] = 0; $params['addTime'] = date('Y-m-d H:i:s', time()); $params['updateTime'] = date('Y-m-d H:i:s', time()); Model_Weshop_PropQueue::insertWeshopPropQueue($params); } } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '导入成功')); }
public function handle_request() { //取任务 weshop_prop_queue 表中status 为0; $props = Model_Weshop_PropQueue::getProps($this->per); //处理任务 foreach ($props as $prop) { //weshop_prop_queue 表中status 为1; Model_Weshop_PropQueue::updatePropStatus($prop, Model_Weshop_PropQueue::PROP_START); $propInfo = Bll_Ppc_ServiceAPI::getHouseInfo($prop['propId']); $params = array(); $params['cityId'] = $prop['cityId']; $params['commId'] = $propInfo['property']['CommId']; $params['brokerId'] = $prop['brokerId']; $params['areaId'] = substr($propInfo['property']['AreaCode'], 0, 8); $params['blockId'] = $propInfo['property']['AreaCode']; $params['price'] = $propInfo['property']['ProPrice']; $params['acreage'] = $propInfo['property']['AreaNum']; $params['room'] = $propInfo['property']['RoomNum']; $params['hall'] = $propInfo['property']['HallNum']; $params['toilet'] = $propInfo['property']['ToiletNum']; $propDescription = $propInfo['property']['sale']['AddExplan']; $propDescription = str_replace('<p>', "", $propDescription); $propDescription = str_replace('</p>', "", $propDescription); $propDescription = trim($propDescription); $params['description'] = json_encode($propDescription); $params['title'] = $propInfo['property']['ProName']; $params['floor'] = $propInfo['property']['ProFloor']; $params['totalFloor'] = $propInfo['property']['FloorNum']; $params['status'] = 1; $params['createTime'] = date('Y-m-d H:i:s', time()); $params['updateTime'] = date('Y-m-d H:i:s', time()); $result = Model_Weshop_Props::insertWeshopProps($params); //更新weshop_prop_queue 表中status; if (!$result) { Model_Weshop_PropQueue::updatePropStatus($prop, Model_Weshop_PropQueue::PROP_FAILED); //导入失败 } else { Model_Weshop_PropQueue::updatePropStatus($prop, Model_Weshop_PropQueue::PROP_SUCCESS); //导入成功 $tmp = array('weshopPropId' => $result->id, 'brokerId' => $prop['brokerId'], 'propId' => $prop['propId']); Model_Weshop_PropsFilter::insertRecord($tmp); } //存储图片 默认图 区分 室内图8张 户型图 1张 if ($propInfo['attachments']['attachments']) { $propImageNum = 0; $outdoorImageNum = 0; $images = $propInfo['attachments']['attachments']; foreach ($images as $image) { if ($image['DataType'] == 2) { if ($propImageNum >= 8) { continue; } if ($propImageNum == 0) { $img_params['isDefault'] = 1; } else { $img_params['isDefault'] = 0; } $img_params['imageType'] = 1; //室内图 $propImageNum += 1; } else { if ($image['DataType'] == 3) { if ($outdoorImageNum >= 1) { continue; } $img_params['imageType'] = 2; //户型图 $outdoorImageNum += 1; } } $img_params['propId'] = $result->id; $img_params['imageHostId'] = $image['host_id']; $img_params['imageHash'] = $image['FileName']; $img_params['isDelete'] = 0; $img_params['createTime'] = date('Y-m-d H:i:s', time()); $img_params['updateTime'] = date('Y-m-d H:i:s', time()); //存储图片 Model_Weshop_PropImages::insertWeshopPropImages($img_params); } } } }
/** * 获取经纪人的定价计划信息 * * @param int $brokerId * @param int $cityId * @param array $propIds * @param int $brokerCheckState * @return array */ public static function getBrokerFixPlanList($brokerId, $cityId, &$propIds, $brokerCheckState = 1) { $rtn = array(); $fixSpreadPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($brokerId); if (empty($fixSpreadPlanList)) { return $rtn; } if (!is_array($propIds)) { $propIds = array(); } $balance = static::getAccountBalance($brokerId); $date = date('Ymd'); foreach ($fixSpreadPlanList as $fixSpreadPlan) { $fixPlanId = $fixSpreadPlan['id']; // $dayCost = Bll_Ppc_ServiceAPI::planTodayNewCost($fixPlanId); // $fixSpreadPlan['dayCost'] = $dayCost['allAmount'] ? $dayCost['allAmount'] : 0; $dayCost = Bll_Ppc_ServiceAPI::brokerDailyFixCost($brokerId, $fixPlanId, $date, $date); $fixSpreadPlan['dayCost'] = max(0, $dayCost) / 100; // $fixSpreadPlan['clickTotal'] = $dayCost['allClick']; $planDailyClickNum = Bll_Ppc_ServiceAPI::getFixPlanDailyClickNum($brokerId, $fixPlanId, $date, $date); $fixSpreadPlan['clickTotal'] = 0; if (!empty($planDailyClickNum)) { foreach ($planDailyClickNum as $planDailyClick) { $fixSpreadPlan['clickTotal'] += intval($planDailyClick['clickNum']); } } // $fixSpreadPlan['allAgioAmount'] = $dayCost['allAgioAmount']; $fixSpreadPlan['balance'] = $balance; if ($brokerCheckState != 1) { $fixSpreadPlan['flag'] = 6; } elseif ($balance <= 0) { $fixSpreadPlan['flag'] = 2; } elseif ($fixSpreadPlan['viewtime'] <= time()) { $fixSpreadPlan['flag'] = 1; } elseif ($fixSpreadPlan['viewtime'] == 1893427200) { //账户没钱停止的标记(2030年),显示以结束 $fixSpreadPlan['flag'] = $balance > 0 ? 3 : 2; } elseif ($fixSpreadPlan['viewtime'] == 1861891200) { //手动停止标记(2029年) $fixSpreadPlan['flag'] = 3; } elseif ($fixSpreadPlan['ceiling'] <= $fixSpreadPlan['dayCost'] * 100) { //限额小于等于花费,限额不足 $fixSpreadPlan['flag'] = 4; } else { $fixSpreadPlan['flag'] = 5; } $planInfo = array('planInfo' => $fixSpreadPlan, 'houseList' => array()); $propFixedPlanRelationList = Bll_Plan_Fix_AjkPlan::getPropFixedPlanRelation($brokerId, $cityId, $fixPlanId); foreach ($propFixedPlanRelationList as $propFixedPlanRelation) { $propIds[] = $propFixedPlanRelation['propId']; $planInfo['houseList'][] = $propFixedPlanRelation['propId']; } $rtn[] = $planInfo; } return $rtn; }
public function handle_request_internal() { $brokerIds = explode(',', $this->_params['brokerIds']); $cityId = $this->_params['cityId']; $sinceId = isset($this->_params['sinceId']) ? intval($this->_params['sinceId']) : 0; //从$sinceId 行开始读 $per = isset($this->_params['per']) ? $this->_params['per'] : 10; //每页示的条数 //二手房 房源表查找房源信息 找出所有的 propIds $isComboCity = Bll_City::isComboCity($cityId); $propIds = array(); if ($isComboCity) { //如果是套餐城市 套餐房源表中 批量获取经纪人在线房源 $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerIds, $cityId); $propIds = array_keys($comboSpreadHouseList); $status = 2; //2 套餐 1 定价 } else { //如果是定价城市 获取经纪人定价计划--获取有效计划房源关系 $fixSpreadPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($brokerIds); //获取经纪人有效定价计划 计划表 $fixSpreadPlanIds = array_keys($fixSpreadPlanList); //获取有效计划房源关系 $relations = Bll_Plan_Fix_AjkPlan::getPropFixedPlanRelation($brokerIds, $cityId, $fixSpreadPlanIds); foreach ($relations as $relation) { $propIds[] = $relation['propId']; } $status = 1; } //获取房源信息 分页 $propsInfos = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId, array(), $per + 1, $sinceId); //板块信息 $blockCode = array(); foreach ($propsInfos as $propsInfoVal) { $blockCode[] = substr($propsInfoVal['areaCode'], 8, 4); } $blockInfos = Bll_Community_CommunityGardener::getAreaBlock($blockCode); $hasNextPage = 0; //是否有下一页 $brokerProps = array(); if (!empty($propsInfos)) { $hasNextPage = count($propsInfos) > $per ? 1 : 0; } if ($hasNextPage) { array_pop($propsInfos); $sinceId += $per; } else { $sinceId = 0; } foreach ($propsInfos as $propsInfo) { $row = array(); $row['brokerId'] = $propsInfo['brokerId']; $row['propId'] = $propsInfo['proId']; $row['cityId'] = $propsInfo['cityId']; $row['title'] = $propsInfo['proName']; $row['commId'] = $propsInfo['commId']; $row['commName'] = $propsInfo['commName']; $row['areaCode'] = $propsInfo['areaCode']; $row['blockName'] = $blockInfos[$row['areaCode']]; $row['createTime'] = date("Y-m-d H:i:s", $propsInfo['postDate']); $row['room'] = $propsInfo['roomNum']; $row['hall'] = $propsInfo['hallNum']; $row['toilet'] = $propsInfo['toiletNum']; $row['area'] = $propsInfo['areaNum']; $row['areaUnit'] = '平米'; $row['price'] = intval($propsInfo['proPrice']); $row['priceUnit'] = '万'; //获取房源图片 $houseImageInfo = Bll_Ppc_ServiceAPI::getHouseImageInfo($propsInfo['proId']); $houseImageBaseInfos = $houseImageInfo['imageBaseInfo']; $houseImageUrls = array(); if ($houseImageBaseInfos) { foreach ($houseImageBaseInfos as $imageInfo) { $houseImageUrls[] = Util_Image::getInstance()->getResizeURL($imageInfo['FILENAME'], $imageInfo['HOST_ID'], 420, 315); } } $row['imageUrls'] = $houseImageUrls; $row['status'] = $status; $brokerProps[] = $row; } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('brokerProps' => $brokerProps, 'hasNextPage' => $hasNextPage, 'sinceId' => $sinceId)); }