Exemplo n.º 1
0
 public function handle_request_internal()
 {
     $ajkBrokerId = $this->_params['brokerId'];
     //根据安居客经纪人ID获取好租经纪人ID
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($ajkBrokerId);
     //获取租房定价信息
     $fixPlansInfo = Bll_HzFixPlan::get_broker_fixplans($hzBrokerId);
     //获取竞价计划状态
     $fixPlanStatus = $fixPlansInfo[0]['status'] == 1 ? V1_Zufang_Fix_SummaryController::RETURN_CODE_NUM_1 : V1_Zufang_Fix_SummaryController::RETURN_CODE_NUM_0;
     //获取计划ID
     $fixPlanId = $fixPlansInfo[0]['id'];
     $cityId = $fixPlansInfo[0]['city_id'];
     //获取租房点击和花费信息
     $promotion = Dao_Broker_HzPlan::get_plan_fee($hzBrokerId, $fixPlanId, date('Ymd'), 1);
     // 获取租房今日点击
     $fixPropIds = Model_Plan_HzPlanning::getFixPropIdsByPlanId($fixPlanId);
     $clicks = Model_Stats_PropClick::getPropBidClick($fixPropIds, $hzBrokerId, $cityId);
     $fixClickSums = Model_Stats_PropClick::calculateClickSumsGroupByPropId($clicks, 'fix');
     $todayClicks = 0;
     foreach ($fixClickSums as $clickSum) {
         $todayClicks += $clickSum;
     }
     //租房某计划的房源总量
     $totalProps = Model_Plan_HzPlanning::getFixPlanPropNum($fixPlanId);
     //查询经纪人新封顶模式信息
     //todo 等多档封顶合并了方法迁移到多档封顶
     $ppcLimitInfo = $this->getPpcBrokerLimitInfo($ajkBrokerId, V1_Zufang_Fix_SummaryController::PPC_BROKER_LIMIT_HZ_SITE);
     if (!$ppcLimitInfo) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_SYS_ERR, 'message' => '封顶数据未能取到!');
     }
     $todayConsume = $promotion[$fixPlanId]['total_cost'] ? $promotion[$fixPlanId]['total_cost'] : 0;
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('planId' => $fixPlanId, 'todayClicks' => $todayClicks, 'todayConsume' => Util_Formatter::formatTodayConsume($todayConsume), 'todayConsumeUnit' => '元', 'totalProps' => $totalProps, 'planStatus' => $fixPlanStatus, 'budget' => $ppcLimitInfo['amountLimit'] / 100, 'budgetUnit' => '元'));
 }
Exemplo n.º 2
0
 public function handle_request_internal()
 {
     /*
     @params planId :计划id
     @params resType :默认为0,0表示不取计划房源信息,1为取房源信息
     @params from :来源
     @success return 该计划id的信息
     */
     if (!isset($this->_params['brokerId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_BROKERID_MISS);
     }
     if (!isset($this->_params['planId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR1);
     }
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     $result = Bll_HzFixPlan::get_plan_detail($brokerId_hz, $this->_params['cityId'], $this->_params['planId'], true);
     if (!empty($result)) {
         $return = array();
         $return["status"] = "ok";
         if (!empty($result['property'])) {
             foreach ($result['property'] as $propertyList) {
                 foreach ($propertyList['props'] as $propinfo) {
                     $proprow["id"] = $propinfo['proid'];
                     $proprow["type"] = $propinfo['content_basic']['protype'];
                     $proprow["area"] = round($propinfo['content_basic']['areanum']);
                     $proprow["commId"] = $propinfo['content_basic']['commid'];
                     $proprow["commName"] = $propinfo['content_basic']['commname'];
                     $proprow["hallNum"] = $propinfo['content_basic']['hallnum'];
                     $proprow["price"] = round($propinfo['content_basic']['pricenum']);
                     $proprow["priceUnit"] = "元";
                     $proprow["roomNum"] = $propinfo['content_basic']['roomnum'];
                     $proprow["title"] = $propinfo['content_basic']['title'];
                     $proprow["toiletNum"] = $propinfo['content_basic']['toilnetnum'];
                     $proprow["clickNum"] = $propinfo['fix_click'];
                     $proprow["isBid"] = $propinfo['is_bid'];
                     if ($propinfo['content_basic']['quality']) {
                         $proprow["isMoreImg"] = 1;
                         //多图
                     } else {
                         $proprow["isMoreImg"] = 0;
                     }
                     $result['propertyList'][] = $proprow;
                     unset($proprow);
                 }
             }
             unset($result['property']);
         }
         $return['data'] = $result;
         $cityTop = Bll_HzFixPlan::get_citytop($this->_params['cityId']);
         //播种城市
         if (!empty($cityTop)) {
             $fixPlanPropCeiling = round($cityTop['money'] / 100, 2);
             $return['data']['plan']['fixPlanPropCeiling'] = $fixPlanPropCeiling ? $fixPlanPropCeiling : 0;
         }
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return $return;
 }
Exemplo n.º 3
0
 /**
  * 手动暂停好租经纪人的定价计划
  *
  * @param int $hzBrokerId
  * @param int $cityId
  * @param array $fixPlan
  */
 private function stopHzFixPlan($hzBrokerId, $cityId, $fixPlan)
 {
     $ajkBrokerId = Model_Broker_HzMapping::get_ajk_broker_id($hzBrokerId);
     if ($ajkBrokerId == 0) {
         $this->logMsg(sprintf('经纪人[%d - %d - %d]获取经纪人ajkBrokerId失败。', $cityId, $hzBrokerId, $fixPlan['id']));
     }
     $this->logMsg(sprintf('经纪人[%d - %d - %d]的好租定价计划,处理开始。', $cityId, $ajkBrokerId, $hzBrokerId));
     $data = array('houseId' => 0, 'planId' => 0, 'brokerId' => $ajkBrokerId, 'cityId' => $cityId, 'type' => 207, 'remark' => '切新端口,暂停定价计划', 'flag' => 0, 'addDate' => time(), 'dealRemark' => '', 'operateId' => 0, 'from' => __METHOD__, 'siteType' => 2);
     $this->logMsg(json_encode($fixPlan));
     if ($fixPlan['status'] == Const_HzPlan::MANUALLY_PAUSE) {
         $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d]已经手动暂停,不做处理。', $cityId, $hzBrokerId, $ajkBrokerId, $fixPlan['id']));
         return;
     }
     if (false == Bll_HzFixPlan::stopPlanByHand($fixPlan['id'])) {
         $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d - %d]手动暂停失败。', $cityId, $hzBrokerId, $ajkBrokerId, $fixPlan['id'], $fixPlan['status']));
         return;
     }
     $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d - %d]手动暂停成功。', $cityId, $hzBrokerId, $ajkBrokerId, $fixPlan['id'], $fixPlan['status']));
     if ($fixPlan['status'] != Const_HzPlan::SPREAD) {
         $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d]已经暂停,不通知上下架。', $cityId, $hzBrokerId, $ajkBrokerId, $fixPlan['id']));
         return;
     }
     /**
      * 记录上下架队列
      */
     $data['planId'] = $fixPlan['id'];
     if (!Model_House_UpDown_Task::create($data, date('Ymd'))->save()) {
         $this->logMsg(sprintf('%s 记录上下架队列失败。', json_encode($data)));
     } else {
         $this->logMsg(sprintf('%s 记录上下架队列成功。', json_encode($data)));
     }
     $this->logMsg(sprintf('经纪人[%d - %d - %d]的好租定价计划,处理结束。', $cityId, $hzBrokerId, $hzBrokerId));
 }
Exemplo n.º 4
0
 public function handle_request_internal()
 {
     /*
     @params planId :计划id
     @params resType :默认为0,0表示不取计划房源信息,1为取房源信息
     @params from :来源
     @success return 该计划id的信息
     */
     if (!isset($this->_params['brokerId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_BROKERID_MISS);
     }
     if (!isset($this->_params['planId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR1);
     }
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     $result = Bll_HzFixPlan::get_plan_detail($brokerId_hz, $this->_params['cityId'], $this->_params['planId'], true);
     if (!empty($result)) {
         $return = array();
         $return["status"] = "ok";
         $return['data'] = $result;
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return $return;
 }
Exemplo n.º 5
0
 public function handle_request_internal()
 {
     //组织POST参数
     $params = array();
     if (!isset($this->_params['brokerId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS);
     } else {
         $broker_id = $this->_params["brokerId"];
     }
     if (!isset($this->_params["cityId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS);
     }
     if (!isset($this->_params["propId"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_ID_MISS);
     }
     if (!isset($this->_params["offer"])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PROP_BID_PRICE_MISS);
     }
     if (!Bll_City::isBidCity($this->_params["cityId"])) {
         $error_code = Const_HzErrorInfo::NOBIDCITY;
         return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
     }
     $search = new Util_SearchUtil();
     $prop = Bll_HzProp::get_prop($this->_params["propId"]);
     $blockid = $prop['blockid'];
     $price = $prop['pricenum'];
     $price_block = Bll_HzBidPlan::get_price_block($this->_params["cityId"], $price);
     $ajkid = Bll_HzProp::get_subregion_id($prop['commId'], $this->_params["propId"]);
     $rank = $search->getHpRankByProp($this->_params["cityId"], $ajkid, $this->_params["propId"], $price_block['LOWER'], $price_block['UPPER'], $this->_params['offer']);
     $return = array();
     $return["status"] = "ok";
     $return["data"] = $rank;
     return $return;
 }
Exemplo n.º 6
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $planId = $this->_params['planId'];
     // 获取定价计划
     $fixPlan = Model_Plan_HzPlanBasic::getActivePlanById($planId);
     if (!$fixPlan) {
         throw new Exception('计划不存在', Const_APIStatus::E_PLAN_NOTFOUND);
     }
     // 暂停定价计划
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     $result = Bll_HzFixPlan::option_fix_plan($hzBrokerId, $planId, "stop");
     if (!$result['status']) {
         switch ($result['msg']) {
             case Const_HzErrorInfo::PLANSTOPING:
                 throw new Exception('计划已经停止', Const_APIStatus::E_PLAN_ALREADY_STOPPED);
                 break;
             default:
                 return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
         }
     }
     // 记录定价上下架日志
     $result = Bll_ProPlanChangeApiBll::get_instance()->insertProPlanChange(array('broker_id' => $brokerId, 'plan_id' => $planId, 'type' => 'plan_stop', 'from' => 'Mobile API v1: ' . __CLASS__, 'remark' => json_encode(array('fix' => array('plan_status' => $fixPlan['status']))), 'site_type' => 2), $brokerId);
     if ($result['status'] != 'ok') {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_SYS_ERR, 'message' => $result['msg']);
     }
     return array('status' => 'ok', 'data' => array());
 }
Exemplo n.º 7
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propId = $this->_params['propId'];
     $budget = $this->_params['budget'];
     $offer = $this->_params['offer'];
     $city_info = Dao_Broker_BrokerInfo::get_broker_base_info(intval($this->_params['brokerId']));
     if (!Bll_City::isBidCity($city_info['CITYID'])) {
         $error_code = Const_HzErrorInfo::NOBIDCITY;
         return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
     }
     $planInfo = $this->get_hpplan_info($propId);
     $post = array('brokerId' => $brokerId, 'propId' => $propId, 'budget' => $budget * 100 - $planInfo['budget'], 'offer' => $offer * 100, 'from' => APF::get_instance()->get_config('java_api_from'));
     $url = '/service-ppc/rest/hp/updHPlan';
     $data = Util_CallAPI::get_data_from_java_api($url, $post);
     if ($data['data']['status'] === 'ok') {
         $ret = array('status' => 'ok', 'data' => array());
     } else {
         $errcode = $data['data']['code'];
         $translate_errcode = $this->my_err_code($errcode);
         if ($translate_errcode === FALSE) {
             $ret = Util_MobileAPI::error_tmp($data['data']['code'], $data['data']['info']);
         } else {
             $ret = Util_MobileAPI::error($translate_errcode);
         }
     }
     return $ret;
 }
Exemplo n.º 8
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propIds = $this->_params['propIds'];
     $planId = isset($this->_params['planId']) ? $this->_params['planId'] : null;
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     $propIds = explode(',', $propIds);
     // 转换成数组
     // 判断定价推广房源数量
     $fixPlans = Bll_HzFixPlan::get_broker_fixplans($hzBrokerId);
     if (empty($fixPlans)) {
         throw new Exception('计划不存在', Const_APIStatus::E_PLAN_NOTFOUND);
     }
     // 定价房源总数不能超过50套
     $fixPropNum = 0;
     foreach ($fixPlans as $planInfo) {
         $fixPropNum = $fixPropNum + $planInfo['prop_count'];
     }
     if ($fixPropNum + count($propIds) > 50) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_ERR_3014);
     }
     // 房源加入定价计划组
     if (is_null($planId)) {
         $planId = $fixPlans[0]['id'];
     }
     $ret = Bll_HzFixPlan::batchprop_into_fix($hzBrokerId, $propIds, $planId);
     if (!$ret['status']) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return array('status' => 'ok', 'data' => array());
 }
Exemplo n.º 9
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propId = $this->_params['propId'];
     $budget = $this->_params['budget'];
     $offer = $this->_params['offer'];
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     if ($brokerId_hz) {
         $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz);
         if (!Bll_City::isBidCity($broker_info['cityid'])) {
             $error_code = Const_HzErrorInfo::NOBIDCITY;
             return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
         }
     }
     $plan_id = Bll_HzBidPlan::get_planid_by_propid($propId);
     //@todo 不明白为什么一定要用propid而不用计划id
     $ret_offer = Bll_HzBidPlan::change_bid_offer($plan_id, $offer);
     //修改出价
     $ret_budget = Bll_HzBidPlan::change_bid_budget($plan_id, $budget);
     //修改预算 ----$new_amount 为需要增加的预算
     $r = array();
     if ($ret_offer['status'] && $ret_budget['status']) {
         $r = array('status' => 'ok', 'data' => array());
     } else {
         if (!$ret_offer['status']) {
             $r = array('status' => 'error', 'errcode' => $ret_offer['msg'], 'message' => Bll_HzFixPlan::get_message_from_code($ret_offer['msg']));
         }
         if (!$ret_budget['status']) {
             $r = array('status' => 'error', 'errcode' => $ret_budget['msg'], 'message' => Bll_HzFixPlan::get_message_from_code($ret_budget['msg']));
         }
     }
     return $r;
 }
Exemplo n.º 10
0
 public function handle_request_internal()
 {
     $brokerId_ajk = $this->_params['brokerId'];
     if (empty($brokerId_ajk)) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS);
     }
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId_ajk);
     $fixplans = Bll_HzFixPlan::get_broker_fixplans($brokerId_hz);
     $ret = array('status' => 'ok', 'data' => array());
     if ($fixplans) {
         $plan = array();
         $status_arr = array(1 => '有效', 2 => '计划上限', 3 => '手工结束', 4 => '暂停', 5 => '待推广', 6 => '删除', 7 => '余额上限', 9 => '手动停止');
         $city_id = $fixplans[0]['city_id'];
         if (empty($city_id)) {
             $user_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz);
             $city_id = $user_info['cityid'];
         }
         $cityTop = Bll_HzFixPlan::get_citytop($city_id);
         //播种城市
         foreach ($fixplans as $planInfo) {
             if (!empty($cityTop)) {
                 $fixPlanPropCeiling = round($cityTop['money'] / 100, 2);
                 $fixPlanPropCeiling = $fixPlanPropCeiling ? $fixPlanPropCeiling : 0;
             } else {
                 $fixPlanPropCeiling = $planInfo['amount'] ? $planInfo['amount'] : 0;
             }
             $tmp = array('fixPlanId' => $planInfo['id'], 'fixPlanName' => $planInfo['plan_title'], 'fixPlanPropCeiling' => $fixPlanPropCeiling, 'fixPlanPropNum' => $planInfo['prop_count'] ? $planInfo['prop_count'] : 0, 'fixPlanState' => $planInfo['status'], 'fixPlanStateDesc' => $status_arr[$planInfo['status']]);
             $plan['planList'][] = $tmp;
         }
         $ret = array('status' => 'ok', 'data' => $plan);
     }
     return $ret;
 }
Exemplo n.º 11
0
 /**
  * 由于套餐变更 下掉多余房子
  * @param $brokerId
  * @param $shouldNum
  * @return array
  */
 public static function deleteExtraHouse($brokerId, $shouldNum)
 {
     $allReturn = array();
     // 转好租brokerid
     if (!($hzBrokerId = Model_Broker_HzMapping::get_hz_broker_id($brokerId))) {
         return Util_GlobalFunc::buildReturn(0, "租房-该经纪人:{$brokerId}获取不到租房经纪人id");
     }
     // 获取有效推广关系
     if (!($plannings = Model_Plan_HzPlanning::getPlanningLists(array('user_id' => $hzBrokerId, 'plan_type' => Const_HzPlan::SPREAD_TYPE, 'is_valid' => Const_HzPlan::SPREAD), 1000, array('proid', 'asc')))) {
         return Util_GlobalFunc::buildReturn(0, "租房-该经纪人:{$hzBrokerId}没有有效定价推广关系");
     }
     $num = count($plannings);
     //推广房源数
     echo '正在处理租房 hzBrokerId:' . $hzBrokerId . ',总推广房源数' . $num . ',api中允许推广数量' . $shouldNum . PHP_EOL;
     if ($num > $shouldNum) {
         // 应该下掉多余房子
         $offNum = $num - $shouldNum;
         foreach ($plannings as $key => $planning) {
             if ($offNum < $key + 1) {
                 break;
             }
             // 下房子动作
             $result = Bll_HzFixPlan::prop_out_fix($planning['user_id'], $planning['proid'], $planning['plan_id']);
             $allReturn[] = $result['msg'];
         }
     }
     return Util_GlobalFunc::buildReturn(1, $allReturn);
 }
Exemplo n.º 12
0
 public function handle_request_internal()
 {
     if (!isset($this->_params['cityId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS);
     }
     // 房屋类型 junyang
     $protype = APF::get_instance()->get_config('housetype', 'zu_house');
     $protype = isset($protype[$this->_params['cityId']]) ? $protype[$this->_params['cityId']] : $protype[0];
     // 装修类型
     $fitments = APF::get_instance()->get_config('ajk_fitment_unify', 'zu_house');
     $fitment = $fitments[$this->_params['cityId']];
     // 选择朝向
     $toward = APF::get_instance()->get_config('toward', 'zu_house');
     // 房屋配置
     $deployment = APF::get_instance()->get_config('b_deployment', 'zu_house');
     // 付款类型
     $paytype = APF::get_instance()->get_config('paytype', 'zu_house');
     // 合租类型
     $sharetype = APF::get_instance()->get_config('sharetype', 'zu_house');
     // 合租性别
     $sharesex = APF::get_instance()->get_config('sharesex', 'zu_house');
     //是否播种城市
     $isseed = 0;
     $cityTop = Bll_HzFixPlan::get_citytop($this->_params['cityId']);
     if (!empty($cityTop)) {
         $isseed = 1;
     }
     $return = array();
     $return["status"] = "ok";
     $return["data"] = array("protype" => $protype, "fitment" => $fitment, "toward" => $toward, "deployment" => $deployment, "paytype" => $paytype, "sharetype" => $sharetype, "sharesex" => $sharesex, 'isseed' => $isseed);
     return $return;
 }
Exemplo n.º 13
0
 public function handle_request_internal()
 {
     if ($this->_params['offer']) {
         $post = array('brokerId' => $this->_params['brokerId'], 'budget' => $this->_params['budget'] * 100, 'offer' => $this->_params['offer'] * 100, 'propId' => $this->_params['propId']);
     }
     $city_info = Dao_Broker_BrokerInfo::get_broker_base_info(intval($this->_params['brokerId']));
     if (!Bll_City::isBidCity($city_info['CITYID'])) {
         $error_code = Const_HzErrorInfo::NOBIDCITY;
         return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
     }
     if (!empty($this->_params['offer'])) {
         $offerStr = (string) $this->_params['offer'];
         if (strpos($offerStr, ".") !== false) {
             $offerArr = explode('.', $offerStr);
             if (strlen($offerArr[1]) > 1) {
                 return Util_MobileAPI::error_tmp("3016", "竞价出价最小单位为角");
             }
         }
     }
     $api_url = '/service-ppc/rest/hp/createHPlan';
     $result = Util_CallAPI::get_data_from_java_api($api_url, $post);
     if ($result['data']['status'] == 'ok') {
         $return = array('status' => 'ok', 'data' => array());
     } else {
         $return = Util_MobileAPI::error(self::changeJavaAPICodeToSelfCode($result['data']['code']));
     }
     return $return;
 }
Exemplo n.º 14
0
 public function handle_request_internal()
 {
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     $city_id = $this->_params['cityId'];
     $result = Bll_HzFixPlan::get_outline_list($brokerId_hz, $city_id, 0);
     $return = array();
     $return["status"] = "ok";
     $return['data']['num'] = $result;
     return $return;
 }
Exemplo n.º 15
0
 /**
  * 获取某个房源竞价底价
  */
 public static function get_bid_minoffer($proid)
 {
     if (empty($proid)) {
         return 0;
     }
     $proinfo = Dao_Broker_HzProp::get_prop($proid);
     if (empty($proinfo[$proid])) {
         return 0;
     }
     $fix_offer = Bll_HzFixPlan::get_minoffer($proinfo[$proid]['content_basic']['pricenum'], $proinfo[$proid]['content_basic']['cityid']);
     return $fix_offer + 0.1;
 }
Exemplo n.º 16
0
 public function handle_request_internal()
 {
     $cityId = $this->_params['cityId'];
     $price = $this->_params['price'];
     $result = Bll_HzFixPlan::get_minoffer($price, $cityId);
     if ($result) {
         $ret = array('status' => 'ok', 'data' => array('price' => $result));
     } else {
         $ret = Util_MobileAPI::error(Const_APIStatus::E_PROP_PARAM_ERR);
     }
     return $ret;
 }
Exemplo n.º 17
0
 public function handle_request_internal()
 {
     $planId = $this->_params['planId'];
     $result = Bll_HzFixPlan::get_fix_budget($planId);
     if (!empty($result)) {
         $return = array();
         $return["status"] = "ok";
         $return['data']['budget'] = $result;
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return $return;
 }
Exemplo n.º 18
0
 public function handle_request_internal()
 {
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     $city_id = $this->_params['cityId'];
     $result = Bll_HzFixPlan::get_broker_plans($brokerId_hz, $city_id);
     if (!empty($result)) {
         $return = array();
         $return["status"] = "ok";
         if (!Bll_City::isBidCity($city_id)) {
             $result['bidPlan']['bidPlanPropNum'] = 0;
         }
         $return['data'] = $result;
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return $return;
 }
Exemplo n.º 19
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propIds = $this->_params['propId'];
     $propIds = explode(',', $propIds);
     $planId = $this->_params['planId'];
     // 获取定价计划
     $fixPlan = Model_Plan_HzPlanBasic::getActivePlanById($planId);
     if (!$fixPlan) {
         throw new Exception('计划不存在', Const_APIStatus::E_PLAN_NOTFOUND);
     }
     // 批量取消房源定价推广
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     $result = Bll_HzFixPlan::batchprop_out_fix($hzBrokerId, $propIds, $planId);
     if (!$result['status']) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return array('status' => 'ok', 'data' => array());
 }
Exemplo n.º 20
0
 public function handle_request_internal()
 {
     $brokerId_ajk = (int) $this->_params['brokerId'];
     $planId = (int) $this->_params['planId'];
     $amount = $this->_params['ceiling'];
     if (!($amount >= 10 && $amount <= 1000)) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId_ajk);
     $result = Bll_HzFixPlan::change_fix_budget($brokerId_hz, $planId, $amount);
     if ($result['status'] == 1) {
         $return = array();
         $return["status"] = "ok";
         $return['data'] = array();
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_ERR_3013);
     }
     return $return;
 }
Exemplo n.º 21
0
 /**
  * 删除房源,可批量
  */
 public static function delete_prop($hzBrokerId, $city_id, $proids)
 {
     // 获取二手房经纪人ID,用于基于房源定价上下架日志
     $ajkBrokerId = Model_Broker_MainBusiness::getMainBusinessByHzBrokerId($hzBrokerId)->ajkBrokerid;
     $proinfo = Dao_Broker_HzProp::get_prop($proids);
     foreach ($proinfo as $proid => $prop) {
         $basic_info = $prop['content_basic'];
         if ($basic_info['cityid'] != $city_id || $basic_info['userid'] != $hzBrokerId) {
             continue;
         }
         $fix_planning = Dao_Broker_HzPlan::get_prop_planning($proid);
         if (!empty($fix_planning)) {
             Bll_HzFixPlan::prop_out_fix($hzBrokerId, $proid, $fix_planning[0]['plan_id']);
         }
         Dao_Broker_HzProp::change_prop_status($proid, Const_HzStatus::REMOVE);
         // 记录房源定价上下架记录
         Bll_ProPlanChangeApiBll::get_instance()->insertProPlanChange(array('broker_id' => $ajkBrokerId, 'pro_id' => $proid, 'plan_id' => $fix_planning ? $fix_planning[0]['plan_id'] : '', 'type' => 'pro_del', 'from' => 'hz_' . __CLASS__ . '_' . __FUNCTION__, 'remark' => '删除房源', 'site_type' => 2), $ajkBrokerId);
     }
     return true;
 }
Exemplo n.º 22
0
 public function handle_request_internal()
 {
     //上海不让竞价
     $city_info = Dao_Broker_BrokerInfo::get_broker_base_info(intval($this->_params['brokerId']));
     if (!Bll_City::isBidCity($city_info['CITYID'])) {
         $error_code = Const_HzErrorInfo::NOBIDCITY;
         return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
     }
     $post = array('brokerId' => $this->_params["brokerId"], 'propId' => $this->_params["propId"], 'from' => APF::get_instance()->get_config('java_api_from'));
     $url = '/service-ppc/rest/hp/stopHPlan';
     $data = Util_CallAPI::get_data_from_java_api($url, $post);
     if ($data['data']['status'] === 'ok') {
         $ret = array('status' => 'ok', 'data' => array());
     } else {
         $errcode = $data['data']['code'];
         $translate_errcode = $this->my_err_code($errcode);
         return Util_MobileAPI::error($translate_errcode);
     }
     return $ret;
 }
Exemplo n.º 23
0
 public function handle_request_internal()
 {
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     if ($brokerId_hz) {
         $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz);
         if (!Bll_City::isBidCity($broker_info['cityid'])) {
             $error_code = Const_HzErrorInfo::NOBIDCITY;
             return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
         }
     }
     $ret = Bll_HzBidPlan::prop_out_bid($brokerId_hz, $this->_params['propId']);
     $r = array();
     if ($ret['status']) {
         $r = array('status' => 'ok', 'data' => array());
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return $r;
 }
Exemplo n.º 24
0
 public function handle_request_internal()
 {
     /*
     @params planId :计划id
     @params resType :默认为0,0表示不取计划房源信息,1为取房源信息
     @params from :来源
     @success return 该计划id的信息
     */
     if (!isset($this->_params['brokerId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_BROKERID_MISS);
     }
     if (!isset($this->_params['cityId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS);
     }
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     $result = Bll_HzFixPlan::get_outline_list($brokerId_hz, $this->_params['cityId'], 1, false);
     $return = array();
     $return["status"] = "ok";
     $return["data"]['propertyList'] = array();
     if (!empty($result)) {
         $proprow = array();
         foreach ($result as $propertyList) {
             $proprow["id"] = $propertyList['proid'];
             $proprow["title"] = $propertyList['content_basic']['title'];
             $proprow["commId"] = $propertyList['content_basic']['commid'];
             $proprow["commName"] = $propertyList['content_basic']['commname'];
             $proprow["roomNum"] = $propertyList['content_basic']['roomnum'];
             $proprow["hallNum"] = $propertyList['content_basic']['hallnum'];
             $proprow["toiletNum"] = $propertyList['content_basic']['toilnetnum'];
             $proprow["area"] = round($propertyList['content_basic']['areanum']);
             $proprow["price"] = round($propertyList['content_basic']['pricenum']);
             $proprow["isMoreImg"] = $propertyList['content_basic']['quality'] ? 1 : 0;
             $proprow["priceUnit"] = "元";
             $return["data"]['propertyList'][] = $proprow;
             unset($proprow);
         }
         unset($result);
     }
     return $return;
 }
Exemplo n.º 25
0
 public function handle_request_internal()
 {
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     if ($brokerId_hz) {
         $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz);
         if (!Bll_City::isBidCity($broker_info['cityid'])) {
             $error_code = Const_HzErrorInfo::NOBIDCITY;
             return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
         }
     }
     $propId = $this->_params['propId'];
     $planId = $this->_params['planId'];
     $ret = Bll_HzBidPlan::delete_bid($brokerId_hz, $planId, $propId);
     //竞价解冻开发中
     if ($ret['status']) {
         $r = array('status' => 'ok', 'data' => array());
     } else {
         $r = array('status' => 'error', 'errcode' => $ret['msg'], 'message' => Bll_HzFixPlan::get_message_from_code($ret['msg']));
     }
     return $r;
 }
Exemplo n.º 26
0
 public function handle_request_internal()
 {
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']);
     $proid = $this->_params['propId'];
     $cityId = $this->_params['cityId'];
     if (!Bll_City::isBidCity($cityId)) {
         $error_code = Const_HzErrorInfo::NOBIDCITY;
         return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code));
     }
     $offer = $this->_params['offer'];
     //offer竞价出价
     $budget = $this->_params['budget'];
     //amount竞价预算(冻结金额)
     $ret = Bll_HzBidPlan::prop_into_bid($brokerId_hz, $cityId, $proid, $offer, $budget, $this->_params['brokerId']);
     $r = array();
     if ($ret['status']) {
         $r = array('status' => 'ok', 'data' => array());
     } else {
         $r = array('status' => 'error', 'errcode' => $ret['msg'], 'message' => Bll_HzFixPlan::get_message_from_code($ret['msg']));
     }
     return $r;
 }
Exemplo n.º 27
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $planId = $this->_params['planId'];
     // 获取定价计划
     $fixPlan = Model_Plan_HzPlanBasic::getActivePlanById($planId);
     if (!$fixPlan) {
         throw new Exception('计划不存在', Const_APIStatus::E_PLAN_NOTFOUND);
     }
     // 开启定价计划
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     $result = Bll_HzFixPlan::option_fix_plan($hzBrokerId, $planId, "repeat");
     if (!$result['status']) {
         switch ($result['msg']) {
             case Const_HzErrorInfo::PLANFIXING:
                 throw new Exception('计划已经开启', Const_APIStatus::E_PLAN_ALREADY_STARTED);
                 break;
             case Const_HzErrorInfo::BROKERCHECK:
                 throw new Exception('您的身份认证未通过审核,请联系你的客户经理', Const_APIStatus::E_BROKER_ISNOT_VERFIYED);
                 break;
             case Const_HzErrorInfo::PLANMONEY:
                 throw new Exception('账户余额不足,请充值后操作', Const_APIStatus::E_BROKER_NO_MONEY);
                 break;
             case Const_HzErrorInfo::PLANAMOUNT:
                 throw new Exception('今日限额已经用完,请调整限额后操作', Const_APIStatus::E_PLAN_ERR_3013);
                 break;
             default:
                 return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
         }
     }
     // 记录定价上下架日志
     $result = Bll_ProPlanChangeApiBll::get_instance()->insertProPlanChange(array('broker_id' => $brokerId, 'plan_id' => $planId, 'type' => 'plan_start', 'from' => 'Mobile API v1: ' . __CLASS__, 'remark' => json_encode(array('fix' => array('plan_status' => $fixPlan['status']))), 'site_type' => 2), $brokerId);
     if ($result['status'] != 'ok') {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_SYS_ERR, 'message' => $result['msg']);
     }
     return array('status' => 'ok', 'data' => array());
 }
Exemplo n.º 28
0
 /**
  * 增加money产生的公共动作
  * @param string $descript
  * @throws Exception_BllErrorException
  */
 private function addMoneyCommon($descript = '')
 {
     // 上线前判断余额 Jackin
     $userId = Bll_Broker_MainBusiness::getDataByEsfId($this->params['ajk_broker_id'])->memberId;
     try {
         $balanceInfo = Bll_Service_Payment::balance(Const_PaymentApp::HZ_DEFAULT, array('userId' => $userId));
     } catch (Exception $e) {
         throw new Exception_BllErrorException(sprintf('调用api失败: %s userId=%d broker_id=%d ajk_broker_id=%d', $e->getMessage(), $userId, $this->params['broker_id'], $this->params['ajk_broker_id']));
     }
     if ($balanceInfo['status'] == 'error') {
         throw new Exception_BllErrorException(sprintf('%s ajkBrokerId(%d) 获取余额失败', $descript, $this->params['ajk_broker_id']));
     } elseif ($balanceInfo['data']['balance'] <= 0) {
         throw new Exception_BllErrorException(sprintf('%s ajkBrokerId(%d) 余额(%d)不足', $descript, $this->params['ajk_broker_id'], $balanceInfo['data']['balance']));
     }
     $this->allReturn = array(sprintf('hz:%s ajkBrokerId(%d) 当前余额(%d) ', $descript, $this->params['ajk_broker_id'], $balanceInfo['data']['balance']));
     //获取刷爆$descript的计划
     $plans = Dao_Broker_HzPlan::get_broker_plan($this->params['broker_id'], 7);
     if (empty($plans)) {
         $this->allReturn[] = '没有获取到 status=7 的计划';
         return;
     }
     $plan_ids = array();
     foreach ($plans as $plan) {
         $plan_ids[] = $plan['id'];
     }
     // 获取所有房子并上线
     $plans_props = Bll_HzFixPlan::get_plan_props($plan_ids, $this->params['city_id']);
     if (empty($plans_props)) {
         $this->allReturn[] = sprintf('没有获取到计划(%s)的房源', implode(',', $plan_ids));
         return;
     }
     foreach ($plans_props as $plan_id => $props) {
         // 更新计划状态
         if (Bll_HzPropBll::switchUpOrDown()) {
             if (!Dao_Broker_HzPlan::update_plan_status($plan_id, Const_HzPlan::SPREAD)) {
                 $this->allReturn[] = "更新计划[{$plan_id}]数据失败";
             }
         } else {
             $this->allReturn[] = "开关关闭,计划[{$plan_id}]数据不再更新";
         }
         // 记录计划上线日志
         $data = Bll_HzFixPlanBll::build_plan_log($this->params, 8, "{$descript},计划上线", $this->params['broker_id']);
         if (!Model_House_UpDown_PlanLog::create($data, date('m'))->save()) {
             $this->allReturn[] = "{$descript},计划[{$plan_id}]上线写入失败";
         } else {
             $this->allReturn[] = "{$descript},计划[{$plan_id}]上线写入";
         }
         foreach ($props['props'] as $prop) {
             if (Bll_HzPropBll::switchUpOrDown()) {
                 if (Dao_Broker_HzProp::change_prop_status($prop['proid'], Const_HzStatus::ONLINE) && Model_Plan_HzPlanning::updatePlanningByPropId($prop['proid'], Const_HzPlan::SPREAD, Const_HzPlan::SPREAD_TYPE)) {
                     $this->allReturn[] = "房源{$prop['proid']}上线成功";
                 } else {
                     $this->allReturn[] = "房源{$prop['proid']}上线失败";
                 }
             } else {
                 $all_return[] = "开关关闭,房源[{$prop['proid']}]状态不改变";
             }
             $data = Bll_HzPropBll::build_prop_log($this->params, 5, "房源上线", $this->params['broker_id']);
             $data['planId'] = $plan_id;
             $data['houseId'] = $prop['proid'];
             if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
                 $this->allReturn[] = "房源{$prop['proid']}上线日志写入失败";
             } else {
                 $this->allReturn[] = "房源{$prop['proid']}上线日志写入";
             }
         }
     }
 }
Exemplo n.º 29
0
 public static function get_broker_ppc_info_hz($brokerId, $cityId)
 {
     $brokerid_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     $hzClick = $hzConsume = $hzBidHouseNum = $hzNotFixHouseNum = 0;
     $hzFixHouse = array();
     $hz_ppc_temp = Bll_HzFixPlan::get_broker_plans($brokerid_hz, $cityId);
     $hzBidHouseNum = intval($hz_ppc_temp['bidPlan']['bidPlanPropNum']);
     foreach ((array) $hz_ppc_temp['fixPlan'] as $fix_plan) {
         $hzFixHouse[] = array('fixId' => $fix_plan['fixPlanId'], 'fixName' => $fix_plan['fixPlanName'], 'fixNum' => $fix_plan['fixPlanPropNum'], 'fixStatus' => $fix_plan['fixPlanState'], 'fixStatusDesc' => $fix_plan['fixPlanStateDesc']);
     }
     $hzNotFixHouseNum = $hz_ppc_temp['unRecommendPropNum'];
     $hz_click_temp = Bll_HzFixPlan::get_all_clickinfo($brokerid_hz, $cityId);
     $hzClick = $hz_click_temp['total_click'];
     $hzConsume = $hz_click_temp['total_consume'];
     return array('hzClick' => $hzClick, 'hzConsume' => $hzConsume, 'hzFixHouse' => $hzFixHouse, 'hzBidHouseNum' => $hzBidHouseNum, 'hzNotFixHouseNum' => $hzNotFixHouseNum);
 }
Exemplo n.º 30
0
 /**
  * 修改单个定价组限额
  */
 public static function change_fix_budget($broker_id, $plan_id, $amount)
 {
     $flag_array = array('status' => 0, 'msg' => '');
     $plan_info = Dao_Broker_HzPlan::get_plan($plan_id);
     if ($plan_info['user_id'] != $broker_id) {
         $flag_array['msg'] = Const_HzErrorInfo::PROPUSERNULL;
         return $flag_array;
     }
     $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($broker_id);
     $city_top = Bll_HzFixPlan::get_citytop($broker_info['cityid']);
     if (!empty($city_top)) {
         $flag_array['msg'] = Const_HzErrorInfo::CHARGECITYTOP;
         return $flag_array;
     }
     $today_cost = self::get_plan_clickinfo($broker_id, $plan_id);
     if ($amount <= $today_cost['total_cost']) {
         $flag_array['msg'] = Const_HzErrorInfo::AMOUNTLOW;
         return $flag_array;
     }
     $re = Dao_Broker_HzPlan::change_plan_amount($plan_id, $amount);
     $plan_info = Dao_Broker_HzPlan::get_plan($plan_id);
     if ($re) {
         //记计划日志
         Dao_Broker_HzPlan::add_plan_log($plan_id, '', Const_HzLog::CHANGEPRICE, 1, $plan_info['user_id'], 0, $plan_info['status'], $plan_info['status']);
         //刷爆的计划在修改限额后要重推
         if ($plan_info['status'] == Const_HzPlan::AUTOOVER) {
             self::option_fix_plan($broker_id, $plan_id, 'repeat', 2);
         }
         $flag_array['status'] = 1;
         return $flag_array;
     }
     return $flag_array;
 }