app-api.md 6.2 KB

App 接口文档

主域名

1.登录

接口地址
  • /auth/login

    请求方式
  • POST

请求参数
{
"account":"area",
"password":"000000"
}
返回示例
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC93ZWlsYWlnby5jb21cL2FwcC1hcGlcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNTY4Mjc3MzM4LCJleHAiOjE1NjgzNjM3MzgsIm5iZiI6MTU2ODI3NzMzOCwianRpIjoiUFVPdTBic1hKdlJXNDFYeSIsInN1YiI6MSwicHJ2IjoiYzgyOTIyMzgzNWQxMTEzOGYwOGFjZTU2ZmZhNjYyOGJjMjY4M2NiNSJ9.A5r-5w9rCbVFhly_xz36_zFSw-V0JaBYT-cHag1qiHA",
"token_type": "bearer",
"expired_in": 86400
}

2.举个例子

接口地址
  • /test
请求方式
  • POST

    请求参数
  • header头部

    Authorization: bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC93ZWlsYWlnby5jb21cL2FwcC1hcGlcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNTY4MjcxODQ1LCJleHAiOjE1NjgzNTgyNDUsIm5iZiI6MTU2ODI3MTg0NSwianRpIjoiQTF3dHVIY011ZFlYVk5jTyIsInN1YiI6MiwicHJ2IjoiYzgyOTIyMzgzNWQxMTEzOGYwOGFjZTU2ZmZhNjYyOGJjMjY4M2NiNSJ9.ig6aWqXj8Py9rQkP2pZA-08dN1FY7F6iILytTQuKfPI

  • body参数

    {}
    
    返回示例
    [14]
    

注意

所有接口头部均需要Authorization: 值得组成(token_type “空格” token)

下面均省略头部 请求参数即为body参数

3.首页 (获取区域)

接口地址
  • /index
请求方式
  • get

    请求参数
  • 头部别忘了

    {}
    
    返回示例
    {
    "14": "龙子湖高校区(禁删)"
    }
    
    返回参数解释
    参数 解释
    14 区域id
    龙子湖高校区(禁删) 区域名称

4.车辆搜索

接口地址
  • /getBikes
请求方式
  • post

    请求参数
  • 头部别忘了

    {
    "bike_or_box":"83",
    "put_area_id":"14",
    "battery_power":"20",
    "last_use_bike_end_time":"2019-09-11 15:31:37",
    "is_riding":"1",
    }
    
请求参数解释
参数 解释
bike_or_box 模糊搜索 车辆编号或控制设备编号
put_area_id 区域id 下拉区域搜索
battery_power 电池电量 下拉电量搜索 (不传百分号,直传数字,20%即20)
last_use_bike_end_time 使用状态 下拉使用状态搜索 (js计算出当前时间的某天前,传值即为请求参数示例即可)
is_riding 车辆状态 1表示使用中 0表示未使用 (可以传字符串0 ,1)

下拉为全部时 不要传值

返回示例
[
{
"id": 6,
"bike_no": "123456789",
"box_no": "987654383",
"battery_power": 0,
"is_link": 0,
"is_lock": 0,
"is_low_battery_power": 0,
"is_riding": 0,
"is_trouble": 0,
"last_use_bike_end_time": null,
"last_location": null,
"last_location_time": null,
"put_area_id": 28,
"put_status": 0,
"put_time": "2019-09-10 14:08:50",
"status": 1,
"created_at": "2019-09-10 14:08:52",
"updated_at": "2019-09-10 14:08:52"
},
{
"id": 3,
"bike_no": "41010010083",
"box_no": "003448483",
"battery_power": 90,
"is_link": 1,
"is_lock": 0,
"is_low_battery_power": 1,
"is_riding": 0,
"is_trouble": 0,
"last_use_bike_end_time": "2019-09-10 16:16:34",
"last_location": "{\"lat\":\"0.0000000000\",\"lng\":\"0.0000000000\",\"speed\":\"00\"}",
"last_location_time": "2019-09-12 16:32:47",
"put_area_id": 14,
"put_status": 1,
"put_time": "2019-09-09 15:00:00",
"status": 1,
"created_at": "2019-09-09 14:57:57",
"updated_at": "2019-09-10 18:10:12"
}
]

5.获取区域电子围栏等详细信息(停车区 骑行区 )

接口地址
  • /getAreas
请求方式
  • get

    请求参数
  • 头部别忘了

    {"put_area_id":"14"}
    
    返回示例
    {
    "ridding_area":[
        {
        "id": 14,
        "name": "龙子湖高校区(禁删)",
        "admin_id": 2,
        "area_fence": "[[113.799481,34.807723],[113.78283685180668,34.797060698137656],[113.78414141265876,34.78261914880894],[113.80004041796872,34.77346100387887],[113.82474933862306,34.776169078648465],[113.8307144338379,34.78517201516704],[113.8330265131836,34.79814815084692],[113.82435946020507,34.80409594410884],[113.80810988354494,34.811156026603726]]",
        "area_centre": "[113.80971766012516,34.792846371515786]",
        "area_radius": 2610.7048,
        "customer_service_time": "9:00-21:00",
        "customer_service_phone": "15225006562",
        "status": 1,
        "created_at": "2019-08-13 18:26:54",
        "updated_at": "2019-09-09 18:27:52"
        }
    ],
    "parking_area":[
        {
        "id": 33,
        "area_id": 14,
        "name": "孵化园",
        "status": 1,
        "max_number": null,
        "parking_centre": "[113.78626993331103,34.78297376401363]",
        "parking_fence": "[[113.78618007928128,34.783004605292426],[113.78630346089602,34.782898863731184],[113.78634637624026,34.78294292273151],[113.78624981671572,34.78304866423627]]",
        "parking_radius": 18.9038,
        "type": 2,
        "created_at": "2019-09-10 14:36:12",
        "updated_at": "2019-09-10 14:36:12"
        }
    ],
    "no_parking_area":[
        {
        "id": 18,
        "area_id": 14,
        "name": "测试停车区",
        "status": 1,
        "max_number": null,
        "parking_centre": "[113.81747959989805,34.7972428001376]",
        "parking_fence": "[[113.817339,34.79746],[113.817726,34.797464],[113.817681,34.797104],[113.817326,34.797093],[113.817326,34.797093]]",
        "parking_radius": 43.3717,
        "type": 1,
        "created_at": "2019-08-14 11:34:28",
        "updated_at": "2019-08-23 15:07:46"
        },
        {
        "id": 25,
        "area_id": 14,
        "name": "停车3区",
        "status": 1,
        "max_number": 101,
        "parking_centre": "[113.81647899978866,34.79422140079649]",
        "parking_fence": "[[113.815934,34.794277],[113.815943,34.794069],[113.816836,34.794081],[113.816841,34.79434],[113.816841,34.79434]]",
        "parking_radius": 61.853,
        "type": 1,
        "created_at": "2019-08-15 10:24:50",
        "updated_at": "2019-08-26 20:10:00"
        }
    ]
    }
    
    返回参数解释
    参数 解释
    area_fence 区域电子围栏
    area_centre 区域中心点
    area_radius 区域中心圆半径 (辐射范围)
    parking_centre 停车区中心点
    parking_fence 停车区电子围栏
    parking_radius 停车区域中心圆半径 (辐射范围)