/** * 租房排名,查好租api * @param unknown_type $propId * @param unknown_type $areacode * @param unknown_type $smallPrice * @param unknown_type $bigPrice * @param unknown_type $hpratio * @param unknown_type $limit */ public function getPpcRentRankBllApi($ProId, $CityId, $AreaCode, $Price, $Action, $Offer = 0) { apf_require_class("Uri_API"); $api = new Uri_API("HaoZuApi"); if ($Action == 'research') { $Action = 'get_rank'; } else { $Action = 'cal_rank'; } $result = $api->sendCurl("ppcrank/", array('proid' => $ProId, 'cityid' => $CityId, 'typecode' => $AreaCode, 'price' => $Price, 'offer' => $Offer, 'action' => $Action)); //查询错误或没有查到排名 if (!$result['result'] || empty($result['rank'])) { $this->alertError(json_encode($result)); return array(); } return $result; }
/** * 得到价格区间的定价价格 * @param $cityid 必填 * @param $totalMoney 必填,传过来的价格需要减少 0.01,防止边界问题 * @param $areaid 可以选填 * @param $commid 可以选填 * @param $tradetype * @param $limit * return array(); 单位元 */ public static function getPriceInterval($cityid, $totalMoney, $areaid = 0, $commid = 0, $tradetype = 1, $limit = 1) { $cityid = intval($cityid); if (empty($cityid) || !isset($totalMoney) || empty($tradetype)) { return array(); } /*****************根据开关,租房的底价读取好租的api caoyang 2012-11-30 begin***************************************************/ if ($tradetype == 2 && self::isRentMerge($cityid)) { apf_require_class("Uri_API"); $api = new Uri_API("HaoZuApi"); $result = $api->sendCurl("ppcrank/", array('action' => 'get_offer', 'cityid' => $cityid, 'price' => $totalMoney)); if ($result['result']) { return array('minPrice' => $result['min_price'], 'maxPrice' => $result['max_price'], 'price' => $result['offer'], 'vPrice' => $result['spreadoffer']); } return array(); } /****************根据开关,租房的底价读取好租的api end**********************************************/ $where = " where cityid = {$cityid}"; if (!empty($areaid)) { $where .= " AND (areacode = '{$areaid}' OR areacode = '0')"; } if (!empty($commid)) { $where .= " AND (commId = {$commid} OR commId = 0)"; } $where .= " AND minPrice<= {$totalMoney} AND maxPrice>= {$totalMoney} AND TradeType = {$tradetype}"; $pdo = APF_DB_Factory::get_instance()->get_pdo("slave"); $sql = "SELECT * FROM price_interval {$where} ORDER BY maxPrice asc LIMIT {$limit}"; $stmt = $pdo->prepare($sql); $stmt->execute(); $result = $limit == 1 ? $stmt->fetch() : $stmt->fetchAll(); return $result; }