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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
/** * 动作 8 * 房源取消套餐推广,导致精选停止(房源日志发起) * 结算 * 维护坑位表(-1)如果精选已经停止则不需要-1 * 更新计划为停止状态 * 通知solr下(停止的房源) * 记录房源日志(停止的房源) * 根据停止的房源,取出坑位里面的推广、排队房源 * 计算排名 * 更新计划状态(坑位里面的异动房源更新状态) * 通知solr(坑位里面的异动房源通知solr) * 记房源日志(坑位里面的房源异动日志) * @param array $params * @return array|bool */ public static function removeComboForChoice($params = array()) { self::$qInfo = $params; // 检查参数 $checkParams = self::checkParams($params); if (!$checkParams['status']) { return $checkParams; } // 获取信息,组装$params $joinParams = self::joinParams($params); if (!$joinParams['status']) { return $joinParams; } $all_return = array(); // 如果不在线或者排队 if (!in_array($params['status'], array(Const_HzPlan::SPREAD, Const_HzPlan::WAITING))) { if ($params['flag']) { Dao_Broker_HzPlan::update_history_bids($params['planId']); } return Bll_HzPropBll::build_return(1, array("精选已经删除")); } // 坑位-1 Model_Choice_HzBidBucket::decrement_used_num($params['blockId'], $params['priceId']); // 租房精选房源取消推广 $ret = Bll_HzBidPlan::choicePropOutBid($params['userId'], $params['proId']); if (!$ret['status']) { $ret['msg'] = Bll_HzFixPlan::get_message_from_code($ret['msg']); return $ret; } // 需要删除竞价 Dao_Broker_HzPlan::update_history_bids($params['planId']); $all_return[] = $ret['msg']; $remark = "房源移出套餐导致精选房源{$params['proId']}停止推广"; $type = $params['status'] == 1 ? 15 : 16; $data = self::build_prop_log($params, $type, $remark, $params['brokerId']); if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) { return Bll_HzPropBll::build_return(0, array($remark . "日志写入失败")); } else { $all_return[] = $remark . "日志写入"; } $msg = self::choiceComputeRank($params['blockId'], $params['priceId']); return Bll_HzPropBll::build_return(1, array_merge($all_return, $msg)); }
/** * params brokerid token nameprice comm_id * return rank 排名 */ public function handle_request_internal() { $params = $this->_params; if (!isset($params['brokerId'])) { return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS); } else { $broker_id = $params["brokerId"]; } if (!isset($params["cityId"])) { return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS); } else { $cityid = $params["cityId"]; } 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)); } $objBLL = new BLL_Property_PropSpread(); $arrRank = array(); $commid = $params['commId']; $act = 'desire'; $propId = $params['propId']; $offer = isset($params['offer']) ? $params['offer'] : 0; $offer = 100 * $offer; $arrPropInfo = $objBLL->getPropInfoBll($propId, $cityid); $priceTotle = $arrPropInfo['PROPRICEINT'] - 0.1; $priceInt = $objBLL->getPriceIntLimit($cityid, $priceTotle, 0, $commid, $arrPropInfo['TRADETYPE'], 1); if ($act == "research") { if (isset($priceInt) && !empty($priceInt)) { $hpratio = isset($params['hpratio']) ? $params['hpratio'] : 0; if ($arrPropInfo['TRADETYPE'] == 1) { $rstRank = $objBLL->getPpcSaleRankBll($propId, $commid, $priceInt['minPrice'], $priceInt['maxPrice'], $hpratio); $arrRank[] = array("minPrice" => $priceInt['minPrice'], "maxPrice" => $priceInt['maxPrice'], "rank" => $rstRank); } } if ($arrRank) { $return = array(); $return["status"] = "ok"; $return["data"] = $arrRank; return $return; } else { return Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR); } } else { // 此处是个坑,客户端不接受-1的值所以取消这个步骤 // $objBLL->jgGuSuan($propId); // if ($rstJgGS) { // APF::get_instance()->get_response()->set_content_type("application/json"); // echo -1; // exit; // } if (isset($priceInt) && !empty($priceInt)) { $commScore = $objBLL->getCommScoreBll($arrPropInfo['COMMID']); if ($arrPropInfo['TRADETYPE'] == 1) { $score = $objBLL->getPropMass($propId, $cityid, $arrPropInfo); $userActionScore = $objBLL->getUserActionScore($propId, $cityid); $hpratio = $objBLL->getHpraio($offer, $score, $userActionScore); } else { $score = $objBLL->getRentQuality($propId, $cityid, $arrPropInfo); $hpratio = $objBLL->getRentHpraio($offer, $score); } if ($arrPropInfo['TRADETYPE'] == 1) { $hpratioNorm = $objBLL->getPpcNormHpratio($hpratio, $arrPropInfo['COMMID'], $propId, false, $arrPropInfo, $priceInt['minPrice'], $priceInt['maxPrice']); $hpratio = round($commScore * $hpratioNorm, 5); $rstRank = $objBLL->getPpcDeseirSaleRankBll($propId, $commid, $priceInt['minPrice'], $priceInt['maxPrice'], $hpratio); $arrRank[] = array("minPrice" => $priceInt['minPrice'], "maxPrice" => $priceInt['maxPrice'], "rank" => $rstRank); } } if ($arrRank) { $return = array(); $return["status"] = "ok"; $return["data"] = $arrRank[0]["rank"]; return $return; } else { return Util_MobileAPI::error(Const_APIStatus::E_CALL_API_ERROR); } } }