1. 用户登录
http://localhost:8080/sshproject/user_login?username=张三&userpassword=123456
返回格式:
-
code: 200,
-
message: "登录成功",
-
token: "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJqd3QiLCJpYXQiOjE0OTQ3MzM1ODYsInN1YiI6IuW8oOS4iXxlMTBhZGMzOTQ5YmE1OWFiYmU1NmUwNTdmMjBmODgzZSIsImV4cCI6MTQ5NDczNzE4Nn0.4h5Z6jU8RVG9fa745CSb1c9GsaYaOPv536eOIKDFmbo"
}
登录过后会返回一个token,客户端每次登录的时候把token放在header上面->("token",token);token的持续时间暂定为1小时,超过一小时就重新登录
2、用户注册
返回格式:
{
-
code: 200,
-
message: "注册成功!"
温湿度数据接口
1、 获取所有温湿度数据
http://localhost:8080/sshproject/humiture_listAll?currPage=1
{
-
result:
-
-
dampness: "1",
-
humitureId: 1,
-
isOut: true,
-
temperature: "12",
-
time: "2017-05-01T21:35:37"
-
-
-
dampness: "12",
-
humitureId: 2,
-
isOut: true,
-
temperature: "23",
-
time: "2017-05-02T11:00:40"
-
-
-
dampness: "3",
-
humitureId: 3,
-
isOut: false,
-
temperature: "43",
-
time: "2017-05-02T11:00:51"
-
-
-
code: 200,
-
currPage: 1,
-
totalPage: 2,
-
message: "返回成功"
2、 获取指定地点的温湿度数据
http://localhost:8080/sshproject/humiture_listLocation?currPage=1&location_id=2
{
-
result:
-
-
dampness: "3",
-
humitureId: 3,
-
isOut: false,
-
temperature: "43",
-
time: "2017-05-02T11:00:51"
-
-
-
code: 200,
-
currPage: 1,
-
totalPage: 1,
-
message: "返回成功"
3、 获取地点
http://localhost:8080/sshproject/location_locations
{
-
result:
-
-
locationid: 1,
-
locationname: "成都"
-
-
-
locationid: 2,
-
locationname: "绵阳"
-
-
-
code: 200,
-
message: "返回成功"
4、获取地点最新数据
http://localhost:8080/sshproject/humiture_newHumiture?location_id=2
{
-
result:
-
dampness: "3",
-
humitureId: 3,
-
isOut: false,
-
temperature: "43",
-
time: "2017-05-02T11:00:51"
-
-
code: 200,
-
message: "返回成功"
5、添加地点
http://localhost:8080/sshproject/location_addLocation?locationname=%E5%BE%B7%E9%98%B3
{
-
code: 200,
-
message: "添加成功"
数据库字段
user表:
humiture表:
Location表