コード例 #1
0
ファイル: Api.php プロジェクト: emilymwang8/ajk-broker
 /**
 * 根据根据父id获取板块信息。
 * @link http://gitlab.corp.anjuke.com/_broker-docs/java-api-doc/blob/master/%E6%88%90%E7%8E%89%E8%8A%AC%E5%B7%A5%E4%BD%9C%E7%A7%BB%E4%BA%A4%E6%96%87%E6%A1%A3/%E5%B0%8F%E5%8C%BA/%E5%8C%BA%E5%9F%9F%E7%89%88%E5%9D%97%E8%AE%BE%E8%AE%A1%E6%96%87%E6%A1%A3.md
 * @param $cityid
 * @return array
 * Success:
 
     {
     "status": "ok",
     "areas": [
     {
     "cityId": "227",
     "mapX": "109.119951",
     "mapY": "21.4811980",
     "mapZoom": "",
     "nameCode": "beihaizhoubian",
     "parentCode": "7520",
     "parentId": "7520",
     "typeCode": "75207657",
     "typeId": "7657",
     "typeName": "北海周边",
     "typeRank":"1"
     },
     {
     "cityId": "227",
     "mapX": "109.207452",
     "mapY": "21.6606290",
     "mapZoom": "",
     "nameCode": "hepuxian",
     "parentCode": "7520",
     "parentId": "7520",
     "typeCode": "75207646",
     "typeId": "7646",
     "typeName": "合浦",
     "typeRank":"1"
     }
     ],
     "blocks": [
     {
     "cityId": "227",
     "mapX": "109.119951",
     "mapY": "21.4811980",
     "mapZoom": "",
     "nameCode": "beihaizhoubiana",
     "parentCode": "75207657",
     "parentId": "7657",
     "typeCode": "752076577658",
     "typeId": "7658",
     "typeName": "北海周边",
     "typeRank":"1"
     },
     {
     "cityId": "227",
     "mapX": "109.207452",
     "mapY": "21.6606290",
     "mapZoom": "",
     "nameCode": "hepuxiana",
     "parentCode": "75207646",
     "parentId": "7646",
     "typeCode": "752076467656",
     "typeId": "7656",
     "typeName": "合浦",
     "typeRank":"1"
     }
     ]
     }
 *
 */
 public static function getBlockByTypeId($typeId)
 {
     if (empty($typeId)) {
         return array();
     }
     $api = new BLL_Service_Api();
     $result = array();
     //请求三次
     for ($i = 0; $i < 3; $i++) {
         /**
         * siteType        int     网站类型(1.二手房租房   2.新房)必须
                     parentId        int     父级id   (parentId ,parentCode必填一个)
                     parentCode      string  父级code
                     depth           int     返回层级深度(1:返回子级 2:返回多级)(必须)
         */
         $result = $api->sendCurl('service-common/rest/block/getChildCodeList?json&parentId=' . $typeId . '&depth=1&siteType=1');
         if ($result['result'] === false) {
             //请求错误
         } else {
             break;
         }
     }
     //返回值解析,提取套餐列表
     if ($result['status'] == 'ok' && $result['blocks']) {
         $area = $result['blocks'];
     } else {
         $area = array();
     }
     return $area;
 }
コード例 #2
0
 /**
  * @param int $cityId
  * @param int $companyId
  * @return array|mixed
  *
  * 获取城市可选套餐列表
  */
 public static function getCompanyComboList($cityId, $companyId)
 {
     if (empty($cityId) || empty($companyId)) {
         return array('error' => '获取套餐API,cityId或companyId为空');
     }
     $api = new BLL_Service_Api();
     $result = array();
     $query = array('companyId' => $companyId, 'cityId' => $cityId);
     $requestURL = sprintf('service-combo/rest/combo/comboList/company?json&%s', http_build_query($query));
     //请求三次
     for ($i = 0; $i < 3; $i++) {
         $result = $api->sendCurl($requestURL);
         if ($result['result'] !== false) {
             break;
         }
     }
     //返回值解析,提取套餐列表
     if (isset($result['status']) && $result['status'] == 'ok') {
         $combos = $result['combos'];
     } else {
         $combos = array();
     }
     return $combos;
 }