摘要:省级数据(一级)地址:www.api.com/one.php 传值: 一级无需传值 直接get获取返回值:{ "code": 0, "msg": "success", "data": [
省级数据(一级)
传值: 一级无需传值 直接get获取
返回值:
{
"code": 0,
"msg": "success",
"data": [
{
"area_id": "1", //地域id
"area_pid": "0", //父级id 0为顶级
"area_name": "北京",
"sort": "0", //排序
"status": "1", //状态 1正常 0 隐藏
"type": "1" //级别 1: 省 2 :市 3 : 区
},
{
"area_id": "1763",
"area_pid": "0",
"area_name": "江西",
"sort": "0",
"status": "1",
"type": "1"
},
{
"area_id": "3242",
"area_pid": "0",
"area_name": "台湾",
"sort": "0",
"status": "1",
"type": "1"
}
]
}
市级接口(二级)
传值: area_id : 父级id 也就是省级选择的数据的id
返回值:
{
"code": 0,
"msg": "success",
"data": [
{
"area_id": "1875",
"area_pid": "1874",
"area_name": "沈阳",
"sort": "0",
"status": "1",
"type": "2"
},
{
"area_id": "1982",
"area_pid": "1874",
"area_name": "营口",
"sort": "0",
"status": "1",
"type": "2"
}
]
}
区级接口(三级)
传值: area_id : 父级id 也就是市级选择的数据的id
返回值:
{
"code": 0,
"msg": "success",
"data": [
{
"area_id": "1876",
"area_pid": "1875",
"area_name": "和平区",
"sort": "0",
"status": "1",
"type": "3"
},
{
"area_id": "1888",
"area_pid": "1875",
"area_name": "新民市",
"sort": "0",
"status": "1",
"type": "3"
}
]
}<?php
include 'function.php';
if(empty($_POST['area_id'])){
return_json(1,'父级id不能为空');
return false;
}
$list = select('php_area','*','status=1 and type=3 and area_pid='.$_POST['area_id'],'sort desc');
return_json(0,$list);
批改老师:查无此人批改时间:2019-01-08 13:32:16
老师总结:写的不错呀,你是认真写的,我看出来了。继续加油。