Exemplo n.º 1
0
 public function handle_request_internal()
 {
     $brokerIds = explode(',', $this->_params['brokerIds']);
     $cityId = $this->_params['cityId'];
     $renovateTime = $this->_params['renovateTime'];
     //某时间以后创建的房源数量
     $isComboCity = Bll_City::isComboCity($cityId);
     $propIds = array();
     if ($isComboCity) {
         //如果是套餐城市 套餐房源表中 批量获取经纪人在线房源
         $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerIds, $cityId);
         $propIds = array_keys($comboSpreadHouseList);
     } 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'];
         }
     }
     $propsInfos = Bll_House_EsfHouse::getHouseBaseInfoByGetAll($propIds, $cityId, array(), '', '', $renovateTime);
     $brokerNewPropNum = count($propsInfos);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('brokerNewPropNum' => $brokerNewPropNum));
 }
Exemplo n.º 2
0
 public function handle_request_internal()
 {
     /**
      * @var $request AJKRequest
      */
     $request = APF::get_instance()->get_request();
     $houseIds = $request->get_parameter('houseIds');
     if (!is_array($houseIds)) {
         $houseIds = explode(',', $houseIds);
     }
     if (empty($houseIds)) {
         echo '{"status":"error"}';
         return;
     }
     $cityId = $request->getBrokerCityId();
     $houseInfoList = Bll_House_EsfHouse::getHouseInfoByHouseIdEx(static::$intBrokerID, $houseIds, $cityId, array('proId', 'brokerId', 'cityId'));
     if (empty($houseInfoList) || count($houseInfoList) != count($houseIds)) {
         echo '{"status":"error"}';
         return;
     }
     if (Bll_Broker_HzBroker::isComboBroker(static::$intBrokerID)) {
         if (Bll_House_EsfHouse::deleteHouseCombo(static::$intBrokerID, $cityId, $houseIds)) {
             echo '{"status":"ok"}';
             return;
         }
     } else {
         if (Bll_House_EsfHouse::deleteHouse(static::$intBrokerID, $cityId, $houseIds)) {
             echo '{"status":"ok"}';
             return;
         }
     }
     echo '{"status":"error"}';
 }
Exemplo n.º 3
0
 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超时'));
     }
 }
Exemplo n.º 4
0
 public function handle_request_internal()
 {
     header("Access-Control-Allow-Origin: *");
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     //经纪人所有二手房房源
     $tempHouseInfoList = Bll_House_EsfHouse::getBrokerAllPropInfoList($brokerId, $brokerInfo->cityId);
     //过滤违规房源
     $commIds = array();
     foreach ($tempHouseInfoList as $key => $houseInfo) {
         $illegal = isset($houseInfo['isVisible']) ? $houseInfo['isVisible'] : 1;
         if ($illegal == 0 && $houseInfo['ExpireWorker'] != 'propertyReport') {
             unset($tempHouseInfoList[$key]);
             continue;
         }
         $commIds[] = $houseInfo['commId'];
     }
     $commInfos = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIds);
     $commlist = array();
     foreach ($commInfos as $commInfo) {
         $row = array();
         $row['commId'] = $commInfo['commId'];
         $row['commName'] = $commInfo['commName'];
         $row['commAddress'] = $commInfo['commLocal'];
         $commlist[] = $row;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('commlist' => $commlist));
 }
Exemplo n.º 5
0
 /**
  * 关系表数据处理.
  *
  *
  */
 public function reletion_handle($id)
 {
     $houseList = Model_House_HouseRelation::getHouseList($id);
     if (empty($houseList)) {
         // 空数据。
         $this->setLog(sprintf("[%s] : 房源关系表中没有剩余数据,处理完成.", date('Y-m-d H:i:s')));
         exit;
     } else {
         foreach ($houseList as $house) {
             $message = [];
             $flagId = $house['id'];
             $cityId = $house['cityId'];
             $brokerId = $house['brokerId'];
             $houseId = $house['houseId'];
             $info = Bll_House_EsfHouse::getHouseInfo($houseId, $cityId);
             echo '[houseID]:', $houseId, ' [id]:', $flagId, ' [brokerId]:', $brokerId, ' [feifa]:--', $info['operateState'], "\n";
             $flagInfo = array('type' => 're', 'id' => $flagId);
             if ($info['operateState'] == 1) {
                 $updateTime = $info['updatedDatetime'];
                 // 延迟5分钟处理.
                 if (time() - strtotime($updateTime) < 300) {
                     continue;
                 }
                 $filter = Bll_House_Filter::filterJob($info);
                 if (!$filter) {
                     // 正常房源.
                     $this->setLog(sprintf("[%s] 房源[%s], 城市[%s], %s", date('Y-m-d H:i:s'), $houseId, $cityId, '房源信息正常.'));
                 } else {
                     // 虚假房源.
                     $filter--;
                     $message = Bll_House_Filter::$message;
                     $log = $this->falseLog($filter, $info, $message);
                     $this->setLog($log);
                     $this->false_handle($info);
                     $reasonArr = array('propId' => $houseId, 'brokerId' => $brokerId, 'type' => 2, 'reason' => '房源信息不实!', 'postTime' => time(), 'mid' => 0);
                     Model_Log_AjkIllegalHouse::writeHouseIllegalInfo($reasonArr);
                     $Date = date("Ymd");
                     $reason = '房源信息不符,房源规则' . ($filter + 1) . '违规';
                     $hpData = array("ProId" => $houseId, "Remark" => $reason, "BrokerId" => $brokerId, "CityId" => $cityId, "Type" => 1, "OperateId" => 0, "From" => "system");
                     Model_House_AjkHpProSpreadChange::insertProSpreadChange($hpData);
                     $data = array('houseId' => $houseId, 'planId' => 0, 'brokerId' => $brokerId, 'cityId' => $cityId, 'type' => 103, 'remark' => $reason, 'flag' => 0, 'addDate' => time(), 'dealRemark' => '', 'operateId' => 0, 'from' => __METHOD__, 'siteType' => 1);
                     if (!Model_House_UpDown_Task::create($data, date('Ymd'))->save()) {
                         $log = sprintf("[%s]:[房源id]:%s, [房源面积]:%s,[房源户型]:%s,插入下架队列失败。", date('Y-m-d h:i:s'), $info['proId'], $info['areaNum'], $info['roomNum']);
                         $this->setLog($log);
                     }
                     // 插入下架队列,actionAPI,虚假房源表。
                 }
                 $this->setFlag($flagInfo);
             } else {
                 // 非法房源.
                 // log.
                 $this->setFlag($flagInfo);
                 continue;
             }
         }
         exit;
     }
 }
Exemplo n.º 6
0
 /**
  * 处理post
  * @param $esfProIds
  * @param $zfProIds
  * @param $getBrokerResActivity
  */
 private function doPost($esfProIds, $zfProIds, $getBrokerResActivity)
 {
     $insertEsfData = array();
     $insertZfData = array();
     //二手房
     if (!empty($esfProIds)) {
         $esfProIdsAll = $this->getProIdsByBrokerId(Bll_Combo_HouseRelation::SITE_TYPE_AJK);
         //过滤不属于该经济人的推广房源和已经参加活动的房源
         foreach ($esfProIds as $key => $val) {
             if (!in_array($val, $esfProIdsAll)) {
                 unset($esfProIds[$key]);
             }
             if (!empty($getBrokerResActivity[$val])) {
                 unset($esfProIds[$key]);
             }
         }
         if (!empty($esfProIds)) {
             $esfProInfos = Bll_House_EsfHouse::getHouseInfo($esfProIds, $this->cityId);
             foreach ($esfProInfos as $key => $val) {
                 $insertEsfData[] = array('proId' => $val['proId'], 'brokerId' => $this->brokerId, 'cityId' => $this->cityId, 'siteType' => Bll_Activity_Res_ProInfo::SITE_TYPE_AJK, 'proContent' => json_encode(Bll_Activity_Res_ProInfo::getEsfShowInfo($val)), 'addTime' => time());
             }
         }
     }
     //租房
     if (!empty($zfProIds)) {
         $zfProIdsAll = $this->getProIdsByBrokerId(Bll_Combo_HouseRelation::SITE_TYPE_HZ);
         foreach ($zfProIds as $key => $val) {
             if (!in_array($val, $zfProIdsAll)) {
                 unset($zfProIds[$key]);
             }
             if (!empty($getBrokerResActivity[$val])) {
                 unset($zfProIds[$key]);
             }
         }
         if (!empty($zfProIds)) {
             $zfProInfos = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($zfProIds, $this->cityId);
             //房源主表信息
             $propMainInfo = Bll_House_HzPro::getInstance()->getHzProInfoByIds($zfProIds);
             $propMainNew = array();
             foreach ($propMainInfo as $val) {
                 $propMainNew[$val['propId']]['contentBasic'] = json_decode($val['contentBasic'], true);
                 $propMainNew[$val['propId']]['contentOther'] = json_decode($val['contentOther'], true);
             }
             foreach ($zfProInfos as $key => $val) {
                 $insertZfData[] = array('proId' => $val['proid'], 'brokerId' => $this->brokerId, 'cityId' => $this->cityId, 'siteType' => Bll_Activity_Res_ProInfo::SITE_TYPE_HZ, 'proContent' => json_encode(Bll_Activity_Res_ProInfo::getZfShowInfo($val, $propMainNew)), 'addTime' => time());
             }
         }
     }
     //合并
     $insertData = array_merge($insertEsfData, $insertZfData);
     foreach ($insertData as $proInfo) {
         Bll_Activity_Res_ProInfo::insertBrokerResActivityPropInfo($proInfo);
         $ProPlanChangeApiBll = Bll_ProPlanChangeApiBll::get_instance();
         $ProPlanChangeApiBll->insertProPlanChange(array('broker_id' => $this->brokerId, 'pro_id' => $proInfo['proId'], 'type' => 'ACTIVITY_RES_ADD', 'from' => __CLASS__, 'remark' => '房源季用户参加活动房源', 'site_type' => $proInfo['siteType']), 0);
     }
 }
Exemplo n.º 7
0
 public function handle_request_internal()
 {
     //判断房源是否定价 拿propid去static_price_relation 查PlanId 再去static_price_plan表中查定价信息
     $propId = $this->_params['propId'];
     $cityId = $this->_params['cityId'];
     //好丑陋。。。。。。好无奈。。。。。。
     //委托房源自动转发停用,为了app能够展示报错信息。。。
     if (empty($propId)) {
         $this->_params['apiDebug'] = 1;
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '0000', 'message' => '委托房源自动转发功能已停用;若要发布请手动发布');
     }
     $relation = Model_Plan_AjkFixRelation::getRelationByProId($propId, $cityId);
     $result['status'] = 'ok';
     $data['totalClicks'] = $data['todayClicks'] = $data['clickPrice'] = 0;
     $data['planId'] = '';
     if (!empty($relation)) {
         if ($relation['status'] == Model_Plan_AjkFixRelation::STATUS_NORMAL) {
             $data['status'] = 1;
             //房源在定价推广中
         } else {
             $data['status'] = 0;
             //未推广
         }
         $plan = Model_Plan_EsfFixedPlan::getValidStaticPricePlanById($relation['planId']);
         $data['planId'] = $plan[0]['id'];
         if (!empty($plan)) {
             //房源在定价推广中
             //房源点击量
             $proClickDao = new DAO_My_Ppc_PlanOpe();
             $proClickInfo = $proClickDao->getProClick($propId, strtotime("20120901"));
             if (!empty($proClickInfo)) {
                 if (isset($proClickInfo[$propId])) {
                     $data['totalClicks'] = $proClickInfo[$propId];
                 }
                 $data['todayClicks'] = $proClickInfo['todayClicks'];
             }
         }
     } else {
         $data['status'] = 0;
         //未推广
     }
     //获取点击单价
     $houseInfo = Bll_House_EsfHouse::getHouseBaseInfo($propId, $cityId);
     if (!empty($houseInfo)) {
         $proPriceInt = $houseInfo[0]['proPriceInt'];
         $priceArr = DAO_My_Ppc_UtilTool::getPriceInterval($cityId, $proPriceInt - 0.01);
         if (!empty($priceArr)) {
             $data['clickPrice'] = round($priceArr['price'], 2);
         }
     }
     $data['clickPriceUnit'] = '元';
     $result['data'] = $data;
     return $result;
 }
Exemplo n.º 8
0
 public function handle_request()
 {
     $dealCityList = $this->getOption('city', array());
     if (!is_array($dealCityList)) {
         $dealCityList = explode(',', $dealCityList);
     }
     if (empty($dealCityList)) {
         $this->logMsg('请传需要处理城市ID');
         file_put_contents($this->_doneFile, 'YES');
         return;
     }
     file_put_contents($this->_doneFile, 'NO');
     $brokerList = $this->getBrokerList($dealCityList, $this->_startId);
     if (empty($brokerList)) {
         $this->logMsg(sprintf('startId: %d 没有获取到经纪人。', $this->_startId));
         file_put_contents($this->_doneFile, 'YES');
         return;
     }
     foreach ($brokerList as $broker) {
         $brokerId = $broker['brokerId'];
         $cityId = $broker['cityId'];
         $this->logMsg(sprintf('开始处理城市 %d 经纪人 %d', $cityId, $brokerId));
         $houseList = Bll_House_EsfHouse::getBrokerAllPropInfoList($brokerId, $cityId);
         $houseIds = array();
         foreach ($houseList as $house) {
             $houseIds[] = $house['proId'];
         }
         $this->logMsg(sprintf('经纪人 %d 共有 %d 套房源[%s]', $brokerId, count($houseIds), implode(',', $houseIds)));
         $spreadHouseList = Bll_Combo_HouseRelation::getOnlineHouseList($brokerId, $cityId, Bll_Combo_HouseRelation::SITE_TYPE_AJK);
         $spreadHouseIds = array();
         foreach ($spreadHouseList as $spreadHouse) {
             $spreadHouseIds[] = $spreadHouse['houseId'];
         }
         $this->logMsg(sprintf('经纪人 %d 共有推广 %d 套房源[%s]', $brokerId, count($spreadHouseIds), implode(',', $spreadHouseIds)));
         $houseIds = array_diff($houseIds, $spreadHouseIds);
         $this->logMsg(sprintf('经纪人 %d 需要下掉 %d 套房源[%s]', $brokerId, count($houseIds), implode(',', $houseIds)));
         foreach ($houseIds as $houseId) {
             /** 通知用户端下架房源 */
             $apiResponse = Bll_Combo_NoticeSolrUpDown::noticeComboSolrAjkAPI($cityId, $brokerId, $houseId, Bll_Combo_NoticeSolrUpDown::SOLR_ACTION_DOWN);
             if ($apiResponse['status'] == 'ok') {
                 $this->logMsg(sprintf('房源[%d] 通知下架成功', $houseId));
             } else {
                 $this->logMsg(sprintf('房源[%d] 通知下架失败, apiResponse:%s', $houseId, json_encode($apiResponse)));
             }
         }
         $this->setCursor($brokerId);
     }
     if (count($brokerList) < self::BROKER_LIMIT) {
         $this->logMsg(sprintf('startId: %d 经纪人已经处理完成', $this->_startId));
         file_put_contents($this->_doneFile, 'YES');
     }
 }
Exemplo n.º 9
0
 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));
 }
Exemplo n.º 10
0
 /**
  * 获取二手房房源列表信息
  * @return array
  */
 private function getBrokerEsfPro()
 {
     //获取经纪人参加活动二手房房源id
     $proIds = $this->getProIdsByBrokerId(Bll_Combo_HouseRelation::SITE_TYPE_AJK);
     //获取经纪人参加活动二手房房源详细信息
     $proInfos = Bll_House_EsfHouse::getHouseInfo($proIds, $this->cityId);
     //获取经纪人已经参加活动房源
     $getBrokerResActivity = Bll_Activity_Res_ProInfo::getBrokerResActivityPropInfo($this->brokerId);
     $resActivityNum = count($getBrokerResActivity);
     //过滤已经参加活动二手房房源,同时返回必须参数(参数拼接)
     $result = Bll_Activity_Res_ProInfo::getCanSetEsfProList($proInfos, $getBrokerResActivity);
     //根据最新发布时间排序
     array_multisort($result['orderByEsfProId'], SORT_DESC, $result['data']);
     return $pageAttributes = array('data' => $result['data'], 'resActivityNum' => $resActivityNum, 'resActivityNumLeave' => 10 - $resActivityNum);
 }
Exemplo n.º 11
0
 /**
  * 去除那些不属于经纪人的房源
  *
  * @param int $brokerId
  * @param string|array $houseIds
  * @param int $cityId
  * @return array
  */
 private function removeInvalidateHouseId($brokerId, $houseIds, $cityId)
 {
     $houseIds = is_array($houseIds) ? $houseIds : explode(',', $houseIds);
     $houseList = Bll_House_EsfHouse::getHouseInfoByHouseIdEx($brokerId, $houseIds, $cityId, array('proId', 'expireWorker', 'isVisible'));
     if (empty($houseList)) {
         return array();
     }
     $realHouseIds = array();
     foreach ($houseList as $houseInfo) {
         if ($houseInfo['isVisible'] == 0 && $houseInfo['expireWorker'] != 'propertyReport') {
             continue;
         }
         $realHouseIds[] = $houseInfo['proId'];
     }
     return $realHouseIds;
 }
Exemplo n.º 12
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $cityId = $this->_params['cityId'];
     $result['status'] = 'ok';
     $propertyList = array();
     $subscriptionInfo = Model_Choice_Subscription::selectData(array(Model_Choice_Subscription::SITE => Model_Choice_Subscription::SITE_AJK, Model_Choice_Subscription::BROKER_ID => $brokerId, Model_Choice_Subscription::STATUS => Model_Choice_Subscription::SUBSCRIPTION_START));
     if (!empty($subscriptionInfo)) {
         $propIds = array();
         foreach ($subscriptionInfo as $row) {
             $propIds[] = $row['propId'];
         }
         $houseInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId, array('postDate' => 'desc'));
         //房源点击量
         $proClickDao = new DAO_My_Ppc_PlanOpe();
         $proClickInfo = $proClickDao->getProClick($propIds, strtotime("20120901"));
         foreach ($houseInfo as $row) {
             $propId = $row['proId'];
             $list['propId'] = $propId;
             $list['title'] = $row['proName'];
             $list['commId'] = $row['commId'];
             $list['commName'] = $row['commName'];
             $list['roomNum'] = $row['roomNum'];
             $list['hallNum'] = $row['hallNum'];
             $list['toiletNum'] = $row['toiletNum'];
             $list['area'] = round($row['areaNum']);
             $list['price'] = round($row['proPrice']);
             $list['priceUnit'] = '万';
             $list['totalClicks'] = isset($proClickInfo[$propId]) ? $proClickInfo[$propId] : 0;
             $list['isBid'] = $list['isChoice'] = 0;
             $list['isMoreImg'] = $row['isHighQulity'];
             $list['isVisible'] = $row['isVisible'];
             $list['isPhonePub'] = $row['uriCode'] == 'mobile.asyn' || $row['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0;
             $list['createTime'] = $row['postDate'];
             $imgBll = Bll_Image_EsfHouseImage::getInstance();
             $list['imgUrl'] = $imgBll->getThumbImageUrl($propId, $row['commId']);
             //委托房源标签
             $list['isEntrust'] = $row['commitionType'] == 2 ? 1 : 0;
             $propertyList[] = $list;
         }
     }
     $result['data']['propertyList'] = $propertyList;
     return $result;
 }
Exemplo n.º 13
0
 public function handle_request()
 {
     $zeroOfferPlanList = Model_Plan_EsfAjkPropSpread::scanPlan0Offer($this->_startId, self::BATCH_LIMIT);
     if (empty($zeroOfferPlanList)) {
         $this->logMsg(sprintf('startId: %d 没有获取到计划。', $this->_startId));
         file_put_contents($this->_doneFile, 'DONE');
     }
     foreach ($zeroOfferPlanList as $planInfo) {
         $cityId = $planInfo['cityId'];
         $houseId = $planInfo['propId'];
         $planId = $planInfo['id'];
         $brokerId = $planInfo['brokerId'];
         $houseInfo = Bll_House_EsfHouse::getHouseBaseInfoEx($houseId, $planInfo['cityId']);
         if (empty($houseInfo)) {
             $this->logMsg(sprintf('经纪人[%d] 城市[%d] 房源[%d]没有找到,计划[%d]', $brokerId, $cityId, $houseId, $planId));
             continue;
         }
         $housePrice = $houseInfo['proPrice'] * 10000;
         /**
          * 获取小区价格段出价
          */
         $clickPrice = Bll_Service_Choice::ajkClickPrice(array('brokerId' => $planInfo['brokerId'], 'cityId' => $cityId, 'price' => $housePrice, 'commId' => $houseInfo['commId']));
         if ($clickPrice['status'] == 'error') {
             $this->logMsg(sprintf('经纪人[%d] 城市[%d] 房源[%d] 计划[%d] 小区[%d] 价格[%d] 获取点击价格失败', $brokerId, $cityId, $houseId, $planId, $houseInfo['commId'], $housePrice));
             continue;
         }
         if ($clickPrice['realTradeAmount'] != $clickPrice['shouldTradeAmount']) {
             $offer = $clickPrice['realTradeAmount'];
         } else {
             $offer = $clickPrice['realTradeAmount'];
         }
         file_put_contents($this->_doneFile, 'DONE');
         $this->logMsg(sprintf('经纪人[%d] 城市[%d] 房源[%d] 计划[%d] 小区[%d] 价格[%d] 出价[%d]', $brokerId, $cityId, $houseId, $planId, $houseInfo['commId'], $housePrice, $offer));
         continue;
         if (!Model_Plan_EsfAjkPropSpread::updateOffer($planId, $offer)) {
             $this->logMsg(sprintf('经纪人[%d] 城市[%d] 房源[%d] 计划[%d] 小区[%d] 价格[%d] 更新出价失败', $brokerId, $cityId, $houseId, $planId, $houseInfo['commId'], $housePrice));
             continue;
         }
         $this->logMsg(sprintf('经纪人[%d] 城市[%d] 房源[%d] 计划[%d] 小区[%d] 价格[%d] 更新出价成功', $brokerId, $cityId, $houseId, $planId, $houseInfo['commId'], $housePrice));
     }
     if (count($zeroOfferPlanList) < self::BATCH_LIMIT) {
         file_put_contents($this->_doneFile, 'DONE');
     }
 }
Exemplo n.º 14
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $plans = Model_Plan_EsfFixedPlan::getValidPlan($brokerId);
     $props = 0;
     $result['status'] = 'ok';
     if (!empty($plans)) {
         $planId = $plans['id'];
         $cityId = $plans['cityid'] ?: 0;
         $relations = Model_Plan_AjkFixRelation::getRelationListByPlanId($planId, $cityId);
         if (!empty($relations)) {
             $propIds = array();
             foreach ($relations as $row) {
                 $propIds[] = $row['proId'];
             }
             $houseInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
             $props = count($houseInfo);
         }
         $planBll = new DAO_My_Ppc_PlanOpe();
         $clicks = $planBll->planTodayNewCost($planId);
         $data['planId'] = $planId;
         $data['todayClicks'] = $clicks['allclick'];
         $data['todayConsume'] = Util_Formatter::formatTodayConsume($clicks['allamount']);
         $data['todayConsumeUnit'] = '元';
         $data['totalProps'] = $props;
         //获取计划状态
         $api_url = '/service-ppc/rest/ppc/getPpcPlan/' . $planId . '?resType=1';
         $plan_info = Util_CallAPI::get_data_from_java_api($api_url);
         $data['planStatus'] = $plan_info['data']['plan']['statusDescrip'] == '推广中' ? 1 : 0;
         $limitInfo = Bll_Fixedspread_AjkFixedSpread::getLimitInfo($brokerId);
         $data['budget'] = !empty($limitInfo) ? round($limitInfo['amountLimit'] / 100, 2) : 0;
         $data['budgetUnit'] = '元';
     } else {
         $brokerInfo = Model_Broker_AjkBrokerExtend::getDataByBrokerId($brokerId);
         $planId = Model_Plan_EsfFixedPlan::addPlan('定价推广组', 1, $brokerInfo->cityId, $brokerInfo->userId, $brokerInfo->brokerId);
         $data['planId'] = $planId;
         $data['todayClicks'] = $data['todayConsume'] = $data['totalProps'] = $data['planStatus'] = 0;
         $data['todayConsumeUnit'] = $data['budgetUnit'] = '元';
         $limitInfo = Bll_Fixedspread_AjkFixedSpread::getLimitInfo($brokerId);
         $data['budget'] = !empty($limitInfo) ? round($limitInfo['amountLimit'] / 100, 2) : 0;
     }
     $result['data'] = $data;
     return $result;
 }
Exemplo n.º 15
0
 /**
  * 二手房小区信息变更写房源日志(批量)
  *
  * @param array $queueInfo
  * @return array
  */
 public static function ajkCommunityInfoChangeEx($queueInfo)
 {
     if (!isset($queueInfo) || empty($queueInfo)) {
         return static::buildReturn(self::PROCESS_STATUS_ERROR, '小区信息变更,remark的值为空');
     }
     $communityChangeInfo = json_decode($queueInfo['remark'], true);
     if (!is_array($communityChangeInfo)) {
         return static::buildReturn(self::PROCESS_STATUS_ERROR, '小区信息变更,remark的值不是JSON');
     }
     $startHouseId = 0;
     $loadField = array('proId', 'commId', 'brokerId', 'cityId', 'updatedDatetime');
     $houseLogWriteError = array();
     $houseLogWriteSuccess = array();
     do {
         $houseList = Bll_House_EsfHouse::scanHouseBaseInfoByCommunityId($communityChangeInfo['cityId'], $communityChangeInfo['commId'], $startHouseId, $loadField, 100);
         if (empty($houseList)) {
             break;
         }
         foreach ($houseList as $houseInfo) {
             $startHouseId = $houseInfo['proId'];
             $data = array();
             $data['houseId'] = $houseInfo['proId'];
             $data['planId'] = 0;
             $data['brokerId'] = $houseInfo['brokerId'];
             $data['cityId'] = $queueInfo['city_id'];
             $data['type'] = Model_Log_HouseLogNew::TYPE_COMMUNITY_INFO_CHANGE;
             $data['changeType'] = $queueInfo['type'];
             $data['remark'] = '小区信息变更';
             $data['addDate'] = date('Y-m-d H:i:s');
             $data['operatorId'] = 0;
             $data['siteType'] = 1;
             if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
                 $houseLogWriteError[] = $houseInfo['proId'];
             } else {
                 $houseLogWriteSuccess[] = $houseInfo['proId'];
             }
         }
         if (count($houseList) < 100) {
             break;
         }
     } while (true);
     return static::buildReturn(self::PROCESS_STATUS_SUCCESS, sprintf('小区信息变更,房源日志写入成功的[%s]失败的房源Id[%s]', implode(',', $houseLogWriteSuccess), implode(',', $houseLogWriteError)));
 }
Exemplo n.º 16
0
 public function handle_request()
 {
     $loadFields = array('proId', 'brokerId');
     $houseList = Bll_House_EsfHouse::scanInvalidateHouse($this->_cityId, $this->_startId, self::DEAL_LIMIT, $loadFields);
     if (count($houseList) < self::DEAL_LIMIT) {
         $this->dealDone(true);
     } else {
         $this->dealDone(false);
     }
     foreach ($houseList as $house) {
         $houseId = $house['proId'];
         $brokerId = $house['brokerId'];
         $this->setCursor($houseId);
         /** 套餐城市 */
         if (Bll_City::isComboCity($this->_cityId)) {
             $spreadRelation = Bll_Combo_HouseRelation::getRelationByHouseId($houseId, Bll_Combo_HouseRelation::SITE_TYPE_AJK);
             if (empty($spreadRelation)) {
                 $this->logMsg(sprintf('没有获取到房源[%d]的套餐推广关系[BrokerId=%d CityId=%d]', $houseId, $brokerId, $this->_cityId));
                 continue;
             }
             if ($spreadRelation['brokerId'] != $brokerId || $spreadRelation['cityId'] != $this->_cityId) {
                 $this->logMsg(sprintf('房源[%d]的 [BrokerId=%d CityId=%d] xxxx [BrokerId=%d CityId=%d]', $houseId, $brokerId, $this->_cityId, $spreadRelation['brokerId'], $spreadRelation['cityId']));
                 $this->saveErrorHouseId($houseId, $brokerId);
                 continue;
             }
             $this->logMsg(sprintf('房源[%d]的套餐推广关系正确[BrokerId=%d CityId=%d]', $houseId, $brokerId, $this->_cityId));
         } else {
             $spreadRelation = Model_Plan_AjkFixRelation::getRelationByProIdEx($houseId, $this->_cityId);
             if (empty($spreadRelation)) {
                 $this->logMsg(sprintf('没有获取到房源[%d]的定价推广关系[BrokerId=%d CityId=%d]', $houseId, $brokerId, $this->_cityId));
                 continue;
             }
             if ($spreadRelation['brokerId'] != $brokerId) {
                 $this->logMsg(sprintf('房源[%d]的 [BrokerId=%d CityId=%d] 关系的 [BrokerId=%d]', $houseId, $brokerId, $this->_cityId, $spreadRelation['brokerId']));
                 $this->saveErrorHouseId($houseId, $brokerId);
                 continue;
             }
             $this->logMsg(sprintf('房源[%d]的定价推广关系正确[BrokerId=%d CityId=%d]', $houseId, $brokerId, $this->_cityId));
         }
     }
 }
Exemplo n.º 17
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         throw new Exception_ISNotComboBrokerException('不是套餐经纪人。');
     }
     /** 套餐信息 */
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId);
     $currentDate = time();
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         /** 获取当前使用的套餐 */
         if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['salePropNum'] > 0) {
             $currentCombo = $comboInfo;
             break;
         }
     }
     //获取经纪人套餐推广今日点击量
     $comboClick = Bll_Ppc_NewPackageStatsBrokerDay::getComboClickInfo($brokerId, date('Ymd'), Model_Ppc_NewPackageStatsBrokerDay::SITE_TYPE_AJK);
     //经纪人没有套餐
     if (!isset($currentCombo)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => intval($comboClick), 'totalProps' => 0));
     }
     $cityId = $brokerInfo->cityId;
     //获取套餐推广信息
     $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
     //获取房源信息
     $propIds = array_keys($comboSpreadHouseList);
     if ($propIds) {
         $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
         $propsNum = count($propsInfo);
     } else {
         $propsNum = 0;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => intval($comboClick), 'totalProps' => $propsNum));
 }
Exemplo n.º 18
0
 public function dealTask($solrOnProId)
 {
     $brokerId = 0;
     $houseInfo = Bll_House_EsfHouse::getHouseInfoById($solrOnProId, $this->cityId);
     if (!empty($houseInfo)) {
         if ($this->isSowooHouse($houseInfo)) {
             printf('房源 %d 是机器抓取的不做处理' . PHP_EOL, $solrOnProId);
             return true;
         }
         if ($onlineComboRelation = Bll_Combo_HouseRelation::getOnlineRelationByHouseId($solrOnProId, Bll_Combo_HouseRelation::SITE_TYPE_AJK)) {
             printf('房源 %s 已经在套餐推广中, 不用通知solr下' . PHP_EOL, $solrOnProId);
             return true;
         }
         $brokerId = $onlineComboRelation['brokerId'];
     }
     // 房源没有或者不在线 通知solr下
     //$this->addPriceQueueByAPI($onlineComboRelation['brokerId'], $this->cityId, $solrOnProId, 2, 0, 0);
     $result = Bll_Combo_NoticeSolrUpDown::noticeComboSolrAjkAPI($this->cityId, $brokerId, $solrOnProId, Bll_Combo_NoticeSolrUpDown::SOLR_ACTION_DOWN, Bll_Combo_NoticeSolrUpDown::HLSFromComboCheckNotice);
     printf('房源 %s 没有在套餐推广中, 需要通知solr下' . PHP_EOL, $solrOnProId);
     printf('房源 %s 通知中间件返回的结果status=%s ; message=%s' . PHP_EOL, $solrOnProId, $result['status'], $result['message']);
     return true;
 }
Exemplo n.º 19
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propId = $this->_params['propId'];
     //检查经纪人是否存在
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     // 判断城市是否开通竞价业务
     $cityId = $brokerInfo->cityId;
     if (!Bll_City::isBidCity($cityId)) {
         throw new Exception_City_NotBidCity('CityId: ' . $cityId);
     }
     //房子的竞价计划
     $bidPlan = Model_Plan_EsfAjkPropSpread::getBidPlanInfoByHouseid($propId);
     if (empty($bidPlan)) {
         //房源信息
         $propInfo = Bll_House_EsfHouse::getHouseBaseInfo($propId, $brokerInfo->cityId);
         if (!$propInfo[0]->isHighQulity) {
             throw new Exception_Property_NotMultiImages("Anjuke propId: {$propId}");
         }
         throw new Exception_BidPlan_NotFound('PropId: ' . $propId);
     }
     //房源总点击
     $bidClickInfo = Model_Plan_HpProStatsDay::getPropClicks($propId, $brokerInfo->cityId);
     $data = array();
     $data['totalClicks'] = $bidClickInfo[$propId]['totalClicks'];
     //房源竞价总点击
     $data['todayClicks'] = Model_plan_HpProStatsDay::getPropClickByDate($propId, $cityId, date('Ymd'));
     //今日点击
     $data['planId'] = $bidPlan->id;
     $priceInfo = Model_House_EsfPrice::get_price($cityId, $bidPlan->propriceint);
     $data['minClickPrice'] = $priceInfo['vPrice'];
     //最小出价
     $data['minClickPriceUnit'] = '元';
     //最小出价
     //推广中 排队中
     if ($bidPlan->status == Model_Plan_EsfAjkPropSpread::ONLINE || $bidPlan->status == Model_Plan_EsfAjkPropSpread::ONQUEUE) {
         $data['planStatus'] = 1;
         // 推广中 or 排队中
         $data['budget'] = $bidPlan->budget / 100;
         //预算
         $data['budgetUnit'] = '元';
         $consume = Model_plan_HpProStatsDay::getPlanAmounts($bidPlan->id, $cityId);
         $data['budgetRemain'] = ($bidPlan->budget - $consume) / 100;
         $data['budgetRemainUnit'] = '元';
         $data['clickPrice'] = $bidPlan->offer / 100;
         //出价
         $data['clickPriceUnit'] = '元';
         $data['rankMsg'] = '排队中';
         if ($bidPlan->status == Model_Plan_EsfAjkPropSpread::ONLINE) {
             //排名
             $data['rank'] = $this->getPpcSaleRankBll($propId, $bidPlan->commId, $bidPlan->smallprice, $bidPlan->bigprice, $bidPlan->commsHpratioA, 3);
             $data['rankMsg'] = '推广中';
         }
     } else {
         $data['planStatus'] = 2;
         //已暂停
         $data['budget'] = 0;
         $data['budgetUnit'] = '元';
         $data['budgetRemain'] = 0;
         $data['budgetRemainUnit'] = '元';
         $data['clickPrice'] = 0;
         $data['clickPriceUnit'] = '元';
         $data['rankMsg'] = '已暂停';
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $data);
 }
Exemplo n.º 20
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propId = $this->_params['propId'];
     //好丑陋。。。。。。好无奈。。。。。。
     //委托房源自动转发停用,为了app能够展示报错信息。。。
     if (empty($propId)) {
         $this->_params['apiDebug'] = 1;
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '0000', 'message' => '委托房源自动转发功能已停用;若要发布请手动发布');
     }
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         throw new Exception_ISNotComboBrokerException('不是套餐经纪人。');
     }
     $cityId = $brokerInfo->cityId;
     /** 套餐信息 */
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId);
     $currentDate = time();
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         /** 获取当前使用的套餐 */
         if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['rentPropNum'] + $comboInfo['salePropNum'] > 0) {
             $currentCombo = $comboInfo;
             break;
         }
     }
     //没有二手房套餐
     if (!isset($currentCombo)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('status' => 0, 'statusMsg' => '尚未购买套餐,请购买套餐', 'currentComboInfo' => '尚未购买套餐'));
     }
     $currentComboName = $currentCombo['name'];
     $currentComboUsed = 0;
     $currentComboTotal = $currentCombo['salePropNum'] + $currentCombo['rentPropNum'];
     //二手房套餐列表
     $comboEsfList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
     $comboEsfPropIds = array_keys($comboEsfList);
     //租房套餐列表
     $comboZuFangList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
     $comboZuFangPropIds = array();
     foreach ($comboZuFangList as $v) {
         $comboZuFangPropIds[] = (int) $v['houseId'];
     }
     $currentComboUsed = count($comboZuFangPropIds) + count($comboEsfPropIds);
     $canSpread = $currentComboUsed >= $currentComboTotal ? 0 : (!$currentCombo['openUp'] && !$currentCombo['salePropNum'] ? 0 : 1);
     if (in_array($propId, array_merge($comboEsfPropIds, $comboZuFangPropIds))) {
         $status = 2;
         $statusMsg = '套餐推广中';
     } else {
         $status = 1;
         $statusMsg = '好房源,不推广就浪费了~';
     }
     //房源今日点击  房源总点击
     $houseTodayClickInfo = Bll_House_EsfHouse::getHouseTodayComboClick($propId);
     $todayClicks = $houseTodayClickInfo[$propId];
     //房源总点击
     $houseClickInfo = Bll_House_EsfHouse::getComboHouseAccumulateClickByPropIds($brokerId, $propId, $cityId);
     $totalClicks = $todayClicks + $houseClickInfo[$propId];
     $currentComboInfo = isset($currentCombo) ? $currentComboName . " ({$currentComboUsed}/{$currentComboTotal})" : '尚未购买套餐';
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $todayClicks, 'totalClicks' => $totalClicks, 'status' => $status, 'statusMsg' => $statusMsg, 'canSpread' => $canSpread, 'currentComboInfo' => $currentComboInfo));
 }
Exemplo n.º 21
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     //经纪人信息
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         throw new Exception_ISNotComboBrokerException('不是套餐经纪人。');
     }
     /** 套餐信息 */
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId);
     $currentDate = time();
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         /** 获取当前使用的套餐 */
         if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['salePropNum'] > 0) {
             $currentCombo = $comboInfo;
             $comboPropNum = $currentCombo['salePropNum'];
             if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) {
                 $comboPropNum = $currentCombo['rentPropNum'] + $currentCombo['salePropNum'];
             }
             break;
         }
     }
     $hasCombo = 0;
     //没有二手房套餐
     if (!isset($currentCombo)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => array(), 'oldList' => array(), 'surplus' => 0, 'hasCombo' => $hasCombo));
     } else {
         $hasCombo = 1;
     }
     $cityId = $brokerInfo->cityId;
     //获取套餐推广信息
     $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
     if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) {
         $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCount($brokerId, Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_AJK, true);
     } else {
         $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCountEx($brokerId, $cityId, Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_AJK);
     }
     //套餐还可以推的房源数量
     $surplus = $comboPropNum - $currentSpreadHouseCount;
     if (empty($comboSpreadHouseList)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => array(), 'oldList' => array(), 'surplus' => $surplus, 'hasCombo' => $hasCombo));
     }
     //获取房源信息
     $propIds = array_keys($comboSpreadHouseList);
     $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
     //批量获取默认图片
     $propDefImages = Model_House_AjkPropertyData::getDafImages($propIds);
     //批量获取房源总点
     $houseTodayClickInfo = Bll_House_EsfHouse::getHouseTodayComboClick($propIds);
     $houseClickInfo = Bll_House_EsfHouse::getComboHouseAccumulateClickByPropIds($brokerId, $propIds, $cityId);
     //房源竞价&精选计划
     $propSpreadInfo = Model_Plan_EsfAjkPropSpread::getPlanByPropIds($propIds);
     //拼接房源列表中房源数据
     $newList = array();
     $oldList = array();
     foreach ($propsInfo as $prop) {
         $row = array();
         $row['propId'] = $prop->proId;
         $row['title'] = $prop->proName;
         $row['commId'] = $prop->commId;
         $row['commName'] = $prop->commName;
         $row['roomNum'] = $prop->roomNum;
         $row['hallNum'] = $prop->hallNum;
         $row['area'] = round($prop->areaNum);
         $row['toiletNum'] = $prop->toiletNum;
         $row['price'] = intval($prop->proPrice);
         $row['priceUnit'] = '万';
         $row['isBid'] = 0;
         $row['isChoice'] = 0;
         $row['isMoreImg'] = $prop->isHighQulity;
         $row['isPhonePub'] = $prop->uriCode == 'mobile.asyn' || $prop->uriCode == 'mobile-ajk-broker.asyn' ? 1 : 0;
         $row['isVisible'] = isset($houseInfo['isVisible']) ? $houseInfo['isVisible'] : 1;
         //0-违规房源 1-非违规房源
         $row['createTime'] = $prop->postDate;
         //房源发布时间
         $row['imgUrl'] = Model_House_AjkPropertyData::imageUrl($propDefImages[$prop->proId]);
         if ($prop->commitionType == 2) {
             $row['isEntrust'] = 1;
         } else {
             $row['isEntrust'] = 0;
         }
         $row['totalClicks'] = $houseTodayClickInfo[$prop->proId] + $houseClickInfo[$prop->proId];
         if (isset($propSpreadInfo[$prop->proId])) {
             if ($propSpreadInfo[$prop->proId]->bidVersion == 1 && ($propSpreadInfo[$prop->proId]->status == 1 || $propSpreadInfo[$prop->proId]->status == 11)) {
                 $row['isBid'] = 1;
             } elseif ($propSpreadInfo[$prop->proId]->bidVersion == 2 && ($propSpreadInfo[$prop->proId]->status == 1 || $propSpreadInfo[$prop->proId]->status == 11)) {
                 $row['isChoice'] = 1;
             }
         }
         //计算出房源发布天数
         $timeFixStr = strtotime(date("Ymd", $row['createTime']));
         $leftDay = floor((time() - $timeFixStr) / 86400);
         if ($leftDay >= 30) {
             $oldList[] = $row;
         } else {
             $newList[] = $row;
         }
     }
     // 排序
     usort($oldList, function ($a, $b) {
         if ($a['createTime'] == $b['createTime']) {
             return 0;
         }
         return $a['createTime'] > $b['createTime'] ? -1 : 1;
     });
     usort($newList, function ($a, $b) {
         if ($a['createTime'] == $b['createTime']) {
             return 0;
         }
         return $a['createTime'] > $b['createTime'] ? -1 : 1;
     });
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => $newList, 'oldList' => $oldList, 'surplus' => $surplus > 0 ? $surplus : 0, 'hasCombo' => $hasCombo));
 }
Exemplo n.º 22
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $maxId = isset($this->_params['maxId']) ? $this->_params['maxId'] : null;
     $sinceId = isset($this->_params['sinceId']) ? $this->_params['sinceId'] : null;
     $per = isset($this->_params['per']) ? $this->_params['per'] : 20;
     $per = $per + 1;
     //判断是否有下一页
     $moreFlag = 1;
     $allData = array();
     $cacheCursorKey = md5($brokerId . 'commission');
     //游标key
     $cacheCommissionKey = md5($cacheCursorKey . $brokerId);
     //commissionInfo key
     $cache = APF_Cache_Factory::get_instance()->get_memcache();
     $cacheCursor = $cache->get($cacheCursorKey);
     $maxCommissionInfo = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter('isDelete', Model_House_Commission::DELETE_NO)->sort('id', 'desc')->limit(1)->find_only();
     if ($maxCommissionInfo['id'] == $cacheCursor) {
         //没新数据则读缓存
         $allData = $cache->get($cacheCommissionKey);
     } elseif (!empty($maxCommissionInfo)) {
         //如果有新数据
         // 获取经纪人的所有委托
         $daCommissions = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter('isDelete', Model_House_Commission::DELETE_NO)->sort('id', 'desc');
         $commissions = $daCommissions->find_all();
         // 获取委托关联的房源
         $houses = array();
         if (!empty($commissions)) {
             $houseIds = array();
             foreach ($commissions as $commission) {
                 $houseIds[] = $commission->houseId;
                 $brokerHouseIds[] = $commission->brokerHouseId;
             }
             // 获取房源信息
             $houses = Model_House_CommissionHouse::data_access()->filter('id', $houseIds)->sort('id', 'asc')->find_all();
             // 索引
             $indexedHouses = array();
             foreach ($houses as $house) {
                 $indexedHouses[$house['id']] = $house;
             }
             $houses = $indexedHouses;
             // 是否存在实拍图片
             $imagesInfos = Model_Image_SaleEntrustImage::getImagesByProIds($houseIds);
             $isImages = array();
             foreach ($imagesInfos as $imagesInfo) {
                 $isImages[$imagesInfo->proId] = 1;
             }
             $BrokerInfo = Bll_BrokerBaseBll::get_instance()->get_broker_info($brokerId);
             //房源推广状态(定价&套餐)
             $isOnLine = Bll_House_EsfHouse::getHouseOnLineInfo($BrokerInfo['BaseInfo']['CITYID'], $brokerId, $brokerHouseIds);
         }
         $houseAction = array();
         //可操作房源
         $houseUnAction = array();
         //不可操作房源
         foreach ($commissions as $commission) {
             if (!isset($houses[$commission['houseId']])) {
                 continue;
             }
             $house = $houses[$commission['houseId']];
             $row = array();
             $row['id'] = $commission['id'];
             $row['propertyId'] = $house['id'];
             $row['commName'] = $house['commName'];
             $row['type'] = $house['commissionType'];
             $row['room'] = $house['roomNum'];
             $row['hall'] = $house['hallNum'];
             $row['toilet'] = $house['toiletNum'];
             $row['area'] = $house['areaNum'];
             $row['price'] = $house['proPrice'];
             switch ($house['commissionType']) {
                 case Model_House_CommissionHouse::COMMISSION_TYPE_RENT:
                     $row['priceUnit'] = '元/月';
                     break;
                 case Model_House_CommissionHouse::COMMISSION_TYPE_SALE:
                     $row['priceUnit'] = '万元';
                     break;
             }
             $row['publishTime'] = date('Y-m-d H:i:s', $house['created']);
             $row['status'] = $house['proStatus'];
             $row['statusInfo'] = $this->statusMapping[$house['proStatus']];
             $row['ownerName'] = $house['userName'];
             $row['ownerPhone'] = $house->getPhone();
             $row['callable'] = intval($house['proStatus'] == Model_House_CommissionHouse::STATUS_ONGOING);
             $row['isRealityPats'] = $isImages[$house['id']] ? 1 : 0;
             $row['timestate'] = Bll_Common_Format::formatTime($house['created']);
             list($isExtension, $isExtensionInfo) = $this->isExtension($commission, $isOnLine, $house);
             if ($isExtension == 5 || $isExtension == 6) {
                 $row['isExtension'] = 7;
             } else {
                 $row['isExtension'] = $isExtension;
             }
             $row['isExtensionInfo'] = $isExtensionInfo;
             //1-违规已删除 2-已过期 5-待发布 6-待推广 7-已推广 8-房东删除
             if (in_array($isExtension, array(1, 2, 8))) {
                 //不可操作房源
                 $houseUnAction[] = $row;
             } else {
                 $houseAction[] = $row;
             }
         }
         $cacheCursorValue = $houseAction[0]['id'] > $houseUnAction[0]['id'] ? $houseAction[0]['id'] : $houseUnAction[0]['id'];
         $cache->set($cacheCursorKey, $cacheCursorValue, 0, 10);
         $allData = array_merge($houseAction, $houseUnAction);
         $cache->set($cacheCommissionKey, $allData, 0, 10);
     }
     $data = array();
     if ($allData) {
         $countAllCommissions = count($allData);
         $segmentation = array();
         //供分页用
         foreach ($allData as $value) {
             $segmentation[] = $value['id'];
         }
         /**
          * 以下是分页处理代码 略坑,勿踩
          *  add by xiongjianxu
          */
         if (isset($maxId)) {
             $max = array();
             $max = array_keys($segmentation, $maxId);
             if (!empty($max)) {
                 $offset = $countAllCommissions - $max[0];
                 krsort($allData);
                 $data = array_slice($allData, $offset, $per, false);
             }
         } elseif (isset($sinceId)) {
             $since = array();
             $since = array_keys($segmentation, $sinceId);
             if (!empty($since)) {
                 $offset = $since[0] + 1;
                 $data = array_slice($allData, $offset, $per, false);
             }
         } else {
             // maxId和sinceId均不存在时,返回当前最新的记录
             $data = array_slice($allData, 0, $per, false);
         }
         //判断有无下一页
         $countCommissions = count($data);
         if ($countCommissions < $per) {
             $moreFlag = 0;
         } else {
             unset($data[$countCommissions - 1]);
         }
     } else {
         $moreFlag = 0;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $data, 'nextPage' => $moreFlag);
 }
Exemplo n.º 23
0
 /**
  * app 获取可竞价列表
  */
 public static function get_combo_canbid_props($broker_id, $city_id)
 {
     //获取套餐推广信息
     $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($broker_id, $city_id);
     $comboPropIds = array_keys($comboSpreadHouseList);
     if (empty($comboPropIds)) {
         return array();
     }
     //竞价房源
     $bidProps = static::gitBidProps($broker_id);
     $bidPropIds = array_keys($bidProps);
     foreach ($comboPropIds as $key => $propId) {
         if (in_array($propId, $bidPropIds)) {
             unset($comboPropIds[$key]);
         }
     }
     if (!empty($comboPropIds)) {
         $props = Bll_House_EsfHouse::getHouseBaseInfo($comboPropIds, $city_id);
         return $props;
     }
     return array();
 }
Exemplo n.º 24
0
 public function handle_request_internal()
 {
     $type = "sale";
     $this->apf = APF::get_instance();
     $this->request = $this->apf->get_request();
     $this->response = $this->apf->get_response();
     $baseDomain = APF::get_instance()->get_config('base_domain', 'common');
     $baseUri = defined('BASE_URI') ? BASE_URI : '';
     $baseUrl = "http://my.{$baseDomain}";
     $commissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions";
     $myCommissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions/mysale";
     $myRentCommissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions/my";
     $cityId = $this->request->getBrokerCityId();
     if ($cityId == 11) {
         $this->request->set_attribute('propCheck', 0);
     } else {
         $this->request->set_attribute('propCheck', 1);
     }
     $params = $this->request->get_parameters();
     $brokerId = self::$BrokerInfo['BaseInfo']['BROKERID'];
     // TODO 替换为其他的方式
     $per = 10;
     $page = isset($params[Const_Listing::PARAM_N_PAGE]) && intval($params[Const_Listing::PARAM_N_PAGE]) > 0 ? intval($params[Const_Listing::PARAM_N_PAGE]) : 1;
     // 获取经纪人的委托
     $daCommissions = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter('type', 1)->filter('isDelete', Model_House_Commission::DELETE_NO);
     $daTotal = clone $daCommissions;
     $commissions = $daCommissions->limit($per)->offset(($page - 1) * $per)->sort('id', 'desc')->find_all();
     // 获取委托关联的房源
     if (!empty($commissions)) {
         $houseIds = array();
         $brokerHouseIds = array();
         foreach ($commissions as $commission) {
             $houseIds[] = $commission->houseId;
             if (!empty($commission->brokerHouseId)) {
                 $brokerHouseIds[] = $commission->brokerHouseId;
             }
         }
         $houses = Model_House_CommissionHouse::data_access()->filter('id', $houseIds)->sort('id', 'asc')->find_all();
         $this->request->set_attribute('houses', $houses);
         // 获取小区默认图片 和 区域板块名称
         $communityIds = array();
         $areaCodes = array();
         foreach ($houses as $house) {
             $communityIds[] = $house->commId;
             $areaCodes[] = $house->areaCode;
         }
         // 房东房源图片
         $propImageUrls = Bll_Image_UtilsImage::getCommissionProImage($houseIds);
         $this->request->set_attribute('propImageUrls', $propImageUrls);
         // 小区默认图片
         $communityImageUrls = $this->getCommunityImageUrls($communityIds);
         $this->request->set_attribute('communityImageUrls', $communityImageUrls);
         // 区域板块
         $areaCodesNames = $this->getAreaCodeNames($areaCodes);
         $this->request->set_attribute('areaCodeNames', $areaCodesNames);
         // 是否推广数据
         $staticPro = Bll_House_EsfHouse::getHouseOnLineInfo(self::$BrokerInfo['BaseInfo']['CITYID'], $brokerId, $brokerHouseIds);
         if (!empty($brokerHouseIds)) {
             $publishedProInfo = Bll_House_EsfHouse::getHouseInfo($brokerHouseIds, self::$BrokerInfo['BaseInfo']['CITYID']);
         }
         // 分页
         $total = $daTotal->count();
         $pager = Util_MultiPage::multiPage($params, '', $total, $per, 10, $myCommissionsPageUrl);
         $this->request->set_attribute('page', $page);
         $this->request->set_attribute('pager', $pager);
         $this->request->set_attribute('showPager', $total > $per);
     }
     $proSpreadUrl1 = "http://my." . $baseDomain . "/user/ajax/ppclimit";
     $proSpreadUrl2 = "http://my." . $baseDomain . "/user/ajax/sale/staticplan/";
     // 立即推广地址
     $isCombo = Bll_Combo_HouseRelation::ifComboCity(self::$BrokerInfo['BaseInfo']['CITYID']);
     if ($isCombo == true) {
         $tgUrl = $baseUrl . "/ajkbroker/combo/broker/manage/ajk";
     } else {
         $tgUrl = $baseUrl . "/user/broker/sale/homepage";
     }
     $this->request->set_attribute('commissions', $commissions);
     $this->request->set_attribute('commissionsPageUrl', $commissionsPageUrl);
     $this->request->set_attribute('myCommissionsPageUrl', $myCommissionsPageUrl);
     $this->request->set_attribute('type', $type);
     $this->request->set_attribute('staticPro', $staticPro);
     $this->request->set_attribute('publishedProInfo', $publishedProInfo);
     $this->request->set_attribute('myRentCommissionsPageUrl', $myRentCommissionsPageUrl);
     $this->request->set_attribute('proSpreadUrl1', $proSpreadUrl1);
     $this->request->set_attribute('proSpreadUrl2', $proSpreadUrl2);
     $this->request->set_attribute('baseUrl', $baseUrl);
     $this->request->set_attribute('tgUrl', $tgUrl);
     return 'House_Commission_MySale';
 }
Exemplo n.º 25
0
 public function handle_request_internal()
 {
     // TODO: Implement handle_request_internal() method.
     $result['status'] = 'ok';
     $cityId = $this->_params['cityId'];
     $brokerId = $this->_params['brokerId'];
     $relations = Model_Plan_AjkFixRelation::getRelationListByPlanId($this->_params['planId'], $cityId);
     $propertyList = array('newList' => array(), 'oldList' => array());
     if (!empty($relations)) {
         $propIds = array();
         foreach ($relations as $row) {
             $propIds[] = $row['proId'];
         }
         $houseInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId, array('postDate' => 'desc'));
         //房源点击量
         $proClickDao = new DAO_My_Ppc_PlanOpe();
         $proClickInfo = $proClickDao->getProClick($propIds, strtotime("20120901"));
         $spreads = Model_Plan_AjkPropspread::getAjkPropSpreadByIds($propIds);
         if (!empty($spreads)) {
             foreach ($spreads as $row) {
                 $spreadArr[$row['propId']]['bidVersion'] = $row['bidVersion'];
                 $spreadArr[$row['propId']]['status'] = $row['status'];
             }
         }
         foreach ($houseInfo as $row) {
             $propId = $row['proId'];
             $list['propId'] = $propId;
             $list['title'] = $row['proName'];
             $list['commId'] = $row['commId'];
             $list['commName'] = $row['commName'];
             $list['roomNum'] = $row['roomNum'];
             $list['hallNum'] = $row['hallNum'];
             $list['toiletNum'] = $row['toiletNum'];
             $list['area'] = round($row['areaNum']);
             $list['price'] = is_float($row['proPrice']) ? round($row['proPrice'], 1) : $row['proPrice'];
             $list['priceUnit'] = '万';
             $list['totalClicks'] = isset($proClickInfo[$propId]) ? $proClickInfo[$propId] : 0;
             $list['isBid'] = $list['isChoice'] = 0;
             if (isset($spreadArr) && isset($spreadArr[$propId])) {
                 if ($spreadArr[$propId]['bidVersion'] == 1 && $spreadArr[$propId]['status'] == 1) {
                     $list['isBid'] = 1;
                 } elseif ($spreadArr[$propId]['bidVersion'] == 2 && ($spreadArr[$propId]['status'] == 1 || $spreadArr[$propId]['status'] == 11)) {
                     $list['isChoice'] = 1;
                 }
             }
             $list['isMoreImg'] = $row['isHighQulity'];
             $list['isVisible'] = $row['isVisible'];
             $list['isPhonePub'] = $row['uriCode'] == 'mobile.asyn' || $row['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0;
             $list['createTime'] = $row['postDate'];
             $imgBll = Bll_Image_EsfHouseImage::getInstance();
             $list['imgUrl'] = $imgBll->getThumbImageUrl($propId, $row['commId']);
             //增加委托房源标签
             if ($row['commitionType'] == 2) {
                 $list['isEntrust'] = 1;
             } else {
                 $list['isEntrust'] = 0;
             }
             //计算出房源推广天数
             $timeFixStr = strtotime(date("Ymd", $row['postDate']));
             $leftDay = floor((time() - $timeFixStr) / 86400);
             if ($leftDay >= 30) {
                 $propertyList['oldList'][] = $list;
             } else {
                 $propertyList['newList'][] = $list;
             }
         }
     }
     $result['data'] = $propertyList;
     return $result;
 }
Exemplo n.º 26
0
 /**
  * 金铺-精选房源设置页面
  *
  * @param int $brokerId
  * @param int $cityId
  * @param int $houseId
  * @param array $params
  *
  * @return array
  */
 public static function esf_setting($brokerId, $cityId, $houseId, $userId, $params = array())
 {
     $pageAttribute = array();
     //获取精选推广预算
     $brokerInfo = Bll_BrokerBaseBll::get_instance()->get_broker_info($brokerId);
     $brokerCompanyId = $brokerInfo['BaseInfo']['COMPANYID'];
     $choiceSet = APF::get_instance()->get_config('choice_set');
     //根据经纪人公司不同有不同的预算
     if (isset($choiceSet[$brokerCompanyId]) && !empty($choiceSet[$brokerCompanyId])) {
         $pageAttribute['min_budget'] = $choiceSet[$brokerCompanyId]['ajk']['ESF_CHOICE_MIN_BUDGET'];
         $pageAttribute['max_budget'] = $choiceSet[$brokerCompanyId]['ajk']['ESF_CHOICE_MAX_BUDGET'];
     } else {
         $pageAttribute['min_budget'] = $choiceSet['default']['ajk']['ESF_CHOICE_MIN_BUDGET'];
         $pageAttribute['max_budget'] = $choiceSet['default']['ajk']['ESF_CHOICE_MAX_BUDGET'];
     }
     self::setChoiceNum($cityId);
     //判断当前经纪人已经精选推广的房源数
     if (isset($params['act']) && isset($params['rebid'])) {
         if (self::checkEsfBidChoiceFull($brokerId, $cityId, 1)) {
             //检查二手房精选是否达到最大
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '最多精选推广' . self::$all_esf_plan_num . '套房源');
         }
     } else {
         if (self::checkEsfBidChoiceFull($brokerId, $cityId)) {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '最多精选推广' . self::$all_esf_plan_num . '套房源');
         }
     }
     /** 经纪人重新推广房源 */
     if (isset($params['act']) && isset($params['rebid'])) {
         //在精选管理页就已经设置时候是重新推广
         $planInfo = Model_Plan_EsfAjkPropSpread::getChoicePlanInfoByHouseid($houseId);
         if ($planInfo->status == Model_Plan_EsfAjkPropSpread::ONLINE || $planInfo->status == Model_Plan_EsfAjkPropSpread::ONQUEUE) {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源已经精选');
         }
         $pageAttribute['plan_id'] = $params['plan_id'];
         $pageAttribute['rebid'] = true;
     }
     $balance = self::get_broker_balance_by_broker_id($brokerId);
     //获取经纪人账户余额
     $pageAttribute['balance'] = $balance;
     if ($balance > 0) {
         $balance = sprintf('%.2f', $balance / 100);
     }
     $pageAttribute['balance_fmt'] = $balance;
     //获取房源信息
     $pageAttribute['housesInfo'] = Bll_House_EsfHouse::getHouseBaseInfo($houseId, $cityId);
     if (empty($pageAttribute['housesInfo'])) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源不存在!');
     }
     $houseInfo = $pageAttribute['housesInfo'][0];
     if ($houseInfo->userId != $userId) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '房源不属于当前操作人');
     }
     if ($houseInfo->isVisible != 1) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '房源是违规房源,不可以参加精选房源推广');
     }
     if ($houseInfo->isHighQulity == 0) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '多图、新发15天房源才能参与精选推广');
     }
     if (date('Ymd', strtotime('-15 days')) > date('Ymd', $houseInfo->postDate)) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '多图、新发15天房源才能参与精选推广');
     }
     /** 判断是否是精选开放城市 */
     if (!Bll_City::isChoiceIndependentCity($cityId, Const_Site::ANJUKE)) {
         /** 判断是在套餐推广中 */
         $houseState = Bll_Combo_HouseRelation::getOnlineRelationByHouseId($houseId, Bll_Combo_HouseRelation::SITE_TYPE_AJK);
         if (empty($houseState)) {
             return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '该房源不在推广中');
         }
     }
     //判断是否已在竞价计划中
     $planInfo = Model_Plan_EsfAjkPropSpread::getChoicePlanInfoByHouseid($houseId);
     if (!empty($planInfo) && !isset($params['act']) && !isset($params['rebid'])) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源已经精选');
     }
     $pageAttribute['title'] = sprintf("%s,%d室%d厅%d卫,%d平,%.2f万", $houseInfo->commName, $houseInfo->roomNum, $houseInfo->hallNum, $houseInfo->toiletNum, intval($houseInfo->areaNum), $houseInfo->proPrice);
     $pageAttribute['community_name'] = $houseInfo->commName;
     $housePrice = intval($houseInfo->proPrice * 10000);
     //获取坑位信息
     $bucketInfo = Bll_Choice_EsfBidBucket::get_bucket_info($houseInfo->commId, $cityId, $housePrice);
     //获取坑位信息
     if (empty($bucketInfo)) {
         Bll_Choice_EsfBidBucket::init_bucket_info($houseInfo->commId, $cityId, $housePrice);
         $bucketInfo = Bll_Choice_EsfBidBucket::get_bucket_info($houseInfo->commId, $cityId, $housePrice);
     }
     if ($bucketInfo['usedNum'] < $bucketInfo['maxOnlineNum']) {
         $pageAttribute['hidden']['show'] = 1;
     }
     $pageAttribute['bucket_total'] = $bucketInfo['totalNum'];
     $pageAttribute['bucket_used'] = $bucketInfo['usedNum'];
     $pageAttribute['bucket_used_num'] = $bucketInfo['usedNum'];
     $pageAttribute['bucket_total_num'] = $bucketInfo['totalNum'];
     $pageAttribute['bucket_max_online_num'] = $bucketInfo['maxOnlineNum'];
     $priceInfo = Model_House_EsfPrice::get_price_by_id($bucketInfo['priceId']);
     $pageAttribute['price_title'] = sprintf("%d-%d万", intval($priceInfo['minPrice'] / 10000), intval($priceInfo['maxPrice'] / 10000));
     //价格
     $clickPrice = Bll_Service_Choice::ajkClickPrice(array('brokerId' => $brokerId, 'cityId' => $cityId, 'price' => $housePrice, 'commId' => $houseInfo->commId));
     if ($clickPrice['status'] == 'error') {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '服务器繁忙,请重试(code: -' . __LINE__ . ')');
     }
     if ($clickPrice['realTradeAmount'] != $clickPrice['shouldTradeAmount']) {
         $pageAttribute['favorable'] = true;
         $pageAttribute['price'] = round($clickPrice['realTradeAmount'] / 100, 2);
         $pageAttribute['origin_price'] = round($clickPrice['shouldTradeAmount'] / 100, 2);
         $pageAttribute['favorable_end_time'] = date('Y-m-d', strtotime($clickPrice['rebateEndTime']));
     } else {
         $pageAttribute['favorable'] = false;
         $pageAttribute['price'] = round($clickPrice['realTradeAmount'] / 100, 2);
     }
     $clickAndBudget = Bll_Choice_EsfBidBucket::getBucketAverageClickBudget($houseInfo->commId, $cityId, $housePrice);
     //获取坑位的平均点击的预算
     if (!empty($clickAndBudget)) {
         $pageAttribute['averageClick'] = $clickAndBudget['averageClick'];
         $pageAttribute['averageBudget'] = $clickAndBudget['averageBudget'] / 100;
     }
     /**重组板块精选url**/
     $bidPlanList = Bll_Plan_Bid_AjkPlan::getBrokerValidPlanListByhouseId($houseId, $brokerId, $cityId, true);
     //板块加价格
     $bidPlanList = $bidPlanList[0];
     if (isset($bidPlanList)) {
         $blockInfo['bidStatus'] = $bidPlanList['status'];
         if ($bidPlanList['status'] == 1) {
             $bidUrl = '/ajkbroker/user/choice/manage/ajk/#' . $houseId;
         } elseif ($bidPlanList['status'] == 11) {
             $bidUrl = '/ajkbroker/user/choice/manage/ajk/#' . $houseId;
         } else {
             if ($bidPlanList['status'] != 2) {
                 $bidUrl = "/ajkbroker/user/choice/blockset/ajk/" . $houseInfo['proId'] . '/?act=1&rebid=1&plan_id=' . $bidPlanList['id'];
             }
         }
     } else {
         $bidUrl = "/ajkbroker/user/choice/blockset/ajk/" . $houseInfo['proId'];
     }
     $pageAttribute['bidUrl'] = $bidUrl;
     return $pageAttribute;
 }
 public function push($remind, &$error)
 {
     // 订阅不存在,不推送
     if (!isset($this->subscriptions[$remind['subscriptionId']])) {
         $error = 'subscription is not exist.';
         return false;
     }
     // 订阅已取消,不推送
     $subscription = $this->subscriptions[$remind['subscriptionId']];
     if ($subscription['status'] == Model_Choice_Subscription::SUBSCRIPTION_CANCEL) {
         $error = 'subscription is canceled';
         return false;
     }
     // 微聊账户不存在,不推送
     $chatInfo = Model_Mobile_BrokerChatInfo::data_access()->filter('brokerId', $subscription['brokerId'])->find_only();
     if (!$chatInfo) {
         $error = 'broker has no chat account.';
         return false;
     }
     // 文案:XXX(小区)的精选推广位空出来了,快去占位吧!
     if ($subscription['site'] == Model_Choice_Subscription::SITE_AJK) {
         // 获取二手房房源小区
         $broker = Model_Broker_AjkBrokerExtend::data_access()->filter('brokerId', $subscription['brokerId'])->find_only();
         $cityId = $broker['cityId'];
         $prop = Bll_House_EsfHouse::getHouseInfo($subscription['propId'], $cityId);
         $commName = $prop['commName'];
     } elseif ($subscription['site'] == Model_Choice_Subscription::SITE_RENT) {
         // 获取租房房源小区
         $prop = Model_House_HzProp::findByPropId($subscription['propId']);
         $cityId = $prop->getContentBasic('cityid');
         $propSearch = Model_House_HzPropSearch::data_access($cityId)->filter('proid', $prop['propId'])->find_only();
         $commName = $propSearch['commname'];
     } else {
         $error = 'invalid subscription site.';
         return false;
     }
     if (!$commName) {
         $error = 'failed to fetch community name';
         return false;
     }
     // 准备待推送文案
     $type = 'subscription';
     $text = $commName . '的精选推广位空出来了,快去占位吧!';
     $propId = strval($subscription['propId']);
     $tradeType = strval($subscription['site']);
     // 1 二手房 2租房
     // 推送消息
     $chatId = $chatInfo['chatId'];
     $api_host = APF::get_instance()->get_config('chat_api_host');
     $message_url = $api_host['host'] . '/common/sendUserNotify/' . $chatId . '?from_idc=1&from=mobile-ajk-broker';
     $message = json_encode(array('msgType' => 'push', 'type' => $type, 'message' => $text, 'propId' => $propId, 'tradeType' => $tradeType, 'body' => array('type' => $type, 'msg' => $text, 'propId' => $propId, 'tradeType' => $tradeType)));
     $result = Util_API::postData($message_url, $message);
     if ($result['status'] != 'OK') {
         $error = 'failed to call push api: ' . json_encode($result);
         return false;
     }
     return true;
 }
Exemplo n.º 28
0
 /**
  * 获取房源质量信息
  *
  * @param array $houseIds
  * @return array
  */
 public static function getHouseSollyResult($houseIds)
 {
     $houseSollyResultList = Bll_House_EsfHouse::getHouseRank($houseIds);
     $rankTips = array('待评', '中等', '良好', '优质');
     $rtn = array();
     foreach ($houseSollyResultList as $houseSollyResult) {
         if (isset($rankTips[$houseSollyResult['rankStar']])) {
             $rtn[$houseSollyResult['propId']] = $rankTips[$houseSollyResult['rankStar']];
         }
     }
     return $rtn;
 }
Exemplo n.º 29
0
 /**
  * 获取经纪人在线的房源小区信息
  *
  * @param int $brokerId
  * @param int $cityId
  * @param array $fields
  * @return array
  */
 public static function getBrokerOnlineHouseCommunityInfo($brokerId, $cityId, $fields = array())
 {
     return Bll_House_EsfHouse::getBrokerHouseBaseInfo($brokerId, $cityId, $fields);
 }
Exemplo n.º 30
0
 /**
  * 获取经纪人精选房源列表
  *
  * @param $brokerId
  * @return bool
  */
 public function getBrokerPropChoiceInfo($brokerId)
 {
     try {
         //初始话返回数据
         $data = array('OnlinePropertyList' => array(), 'QueuedPropertyList' => array(), 'OfflinePropertyList' => array());
         //获取经纪人基本信息
         $brokerBaseInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
         if (empty($brokerBaseInfo)) {
             $this->error(self::EMPTY_BROKER_ERROR, self::EMPTY_BROKER_ERROR_MSG);
         }
         //判断经纪人城市是否开通精选
         if (!$this->checkChoiceOpen($brokerBaseInfo->cityId)) {
             $this->error(self::CHOICE_CLOSE_ERROR, self::CHOICE_CLOSE_ERROR_MSG);
         }
         //获取经纪人有效精选计划
         $choicePlans = Model_Plan_EsfAjkPropSpread::getValidChoicePlanByBroker($brokerId, array('createtime', 'desc'));
         if (empty($choicePlans)) {
             return $data;
         }
         //格式化精选计划数据
         list($onSpreadList, $onQueueList, $historyList, $propList) = $this->formatPlanInfo($choicePlans);
         //获取经纪人的所有房源信息
         $propInfo = Bll_House_EsfHouse::getHouseBaseInfo($propList, $brokerBaseInfo->cityId);
         //转换房源数组key,同时添加默认totalClick的默认值
         $propInfo = $this->formatPropInfo($propInfo);
         //根据房源id获取定价总点击
         $bidBll = new bll_plan_bid_EsfBid();
         $bidClickInfo = $bidBll->getPropTotalClicksAndCost($propList, $brokerBaseInfo->cityId);
         //$fixedClickInfo = Model_Plan_EsfFixedClickInfo::getClickInfoByProps($propList, $brokerId);
         foreach ($propInfo as $key => $row) {
             $propInfo[$key]['totalClicks'] = $bidClickInfo[$row['id']]['totalClicks'];
         }
         //根据计划拼接房源信息
         $this->combinePropInfo($onSpreadList, $propInfo);
         $this->combinePropInfo($onQueueList, $propInfo);
         $this->combinePropInfo($historyList, $propInfo);
         // 排序
         $this->_sortPropByUpdateTime($onSpreadList);
         $this->_sortPropByUpdateTime($onQueueList);
         $this->_sortPropByUpdateTime($historyList);
         if (!empty($historyList)) {
             foreach ($historyList as $key => $val) {
                 $historyList[$key]['isChoice'] = 0;
             }
         }
         return array('OnlinePropertyList' => $onSpreadList, 'QueuedPropertyList' => $onQueueList, 'OfflinePropertyList' => $historyList);
     } catch (Exception $e) {
         if ($e instanceof Exception_BllErrorException) {
             $this->errorCode = $e->getCode();
         } else {
             $this->errorCode = self::UNKNOW_ERROR;
         }
         $this->errorMsg = $e->getMessage();
         return false;
     }
 }