• 中国区域
    • 快速入门
    • 接口示例
      • 获取全部省份
      • 获取省份下的市
      • 获取城市下的区、县
      • 获取区县下的街道、镇

    中国区域

    快速入门

    1. 区域查询接口都在app/Application/Area/Model目录下,包含省份(Province)、城市(City)、区县(District)
    2. HTTP接口在app/Application/Area/Controller目录下

    接口示例

    获取全部省份

    http://{你的站点}/ztbcms/index.php?g=Area&m=Api&a=getProvinces

    返回数据:

    1. {
    2. "status": "success",
    3. "data": [
    4. {
    5. "id": "110000",
    6. "areaname": "北京",
    7. "parentid": "0",
    8. "shortname": "北京",
    9. "lng": "116.405289",
    10. "lat": "39.904987",
    11. "level": "1",
    12. "sort": "1"
    13. },
    14. ......
    15. ],
    16. "state": "success"
    17. }

    获取省份下的市

    示例(广东省):通过省份id查找下属城市

    http://{你的站点}/ztbcms/index.php?g=Area&m=Api&a=getCitiesByProvinceId&id=440000

    注:id为省份id

    返回数据:

    1. {
    2. "status": "success",
    3. "data": [
    4. {
    5. "id": "445100",
    6. "areaname": "潮州市",
    7. "parentid": "440000",
    8. "shortname": "潮州",
    9. "lng": "116.632301",
    10. "lat": "23.661701",
    11. "level": "2",
    12. "sort": "1"
    13. },
    14. .........
    15. ],
    16. "state": "success"
    17. }

    示例(广东省):通过省份名称查找下属城市

    http://{你的站点}/ztbcms/index.php?g=Area&m=Api&a=getCitiesByProvince&provice_name=广东省

    注:provice_name为省份名称(可以是简称)

    返回数据:

    1. {
    2. "status": "success",
    3. "data": [
    4. {
    5. "id": "445100",
    6. "areaname": "潮州市",
    7. "parentid": "440000",
    8. "shortname": "潮州",
    9. "lng": "116.632301",
    10. "lat": "23.661701",
    11. "level": "2",
    12. "sort": "1"
    13. },
    14. .........
    15. ],
    16. "state": "success"
    17. }

    获取城市下的区、县

    示例(佛山市): 通过城市id查找下属区县

    http://{你的站点}/ztbcms/index.php?g=Area&m=Api&a=getDistrictsByCityId&id=440600

    注:id为城市id

    返回数据:

    1. {
    2. "status": "success",
    3. "data": [
    4. {
    5. "id": "440604",
    6. "areaname": "禅城区",
    7. "parentid": "440600",
    8. "shortname": "禅城",
    9. "lng": "113.112411",
    10. "lat": "23.019644",
    11. "level": "3",
    12. "sort": "1"
    13. },
    14. ........
    15. ],
    16. "state": "success"
    17. }

    示例(佛山市): 通过城市名称查找下属区县

    http://{你的站点}/ztbcms/index.php?g=Area&m=Api&a=getDistrictsByCity&city_name=佛山市

    注:city_name为城市名称

    返回数据:

    1. {
    2. "status": "success",
    3. "data": [
    4. {
    5. "id": "440604",
    6. "areaname": "禅城区",
    7. "parentid": "440600",
    8. "shortname": "禅城",
    9. "lng": "113.112411",
    10. "lat": "23.019644",
    11. "level": "3",
    12. "sort": "1"
    13. },
    14. ........
    15. ],
    16. "state": "success"
    17. }

    获取区县下的街道、镇

    示例(南海区):

    http://{你的站点}/ztbcms/index.php?g=Area&m=Api&a=getStreetsByDistrictId&id=440605

    注: id为区县id

    返回数据:

    1. {
    2. "status": "success",
    3. "data": [
    4. {
    5. "id": "440605125",
    6. "areaname": "大沥镇",
    7. "parentid": "440605",
    8. "shortname": "大沥镇",
    9. "lng": "113.110573",
    10. "lat": "23.108711",
    11. "level": "4",
    12. "sort": "1"
    13. },
    14. ........
    15. ],
    16. "state": "success"
    17. }