上传

此处以宝塔面板做演示

进入站点根目录,上传jar包,等待上传完成

创建数据库

创建名为 mysteps 的数据库

用户名设置为 mystep

密码设置为 root

进入管理

mysteps—>导入—>选择文件导入mysteps.sql—>点击执行

数据库导入完成

部署

进入终端,进入站点根目录。即文件上传目录

输入以下命令启动服务,若你想保持前台运行 输入java -jar StepService.jar

1
java -jar StepService.jar &

如图所示表示启动成功

若出现8080端口占用情况如下

1
2
3
4
5
6
7
8
9
10
11
***************************
APPLICATION FAILED TO START
***************************

Description:

Web server failed to start. Port 8080 was already in use.

Action:

Identify and stop the process that's listening on port 8080 or configure this application to listenon another port.

需停止占用端口的应用 方法如下

  1. netstat -lnp|grep 80

  2. kill -9 12095

  3. netstat -lnp|grep 80

    然后重新 使用 java -jar StepService.jar & 运行服务


接口文档

参数说明:

phone 手机号

password 密码

steps 提交的步数

flag 是否开启自动刷步 0为不自动刷步 1为自动刷步 刷步时间为每日中午12点

单次提交步数

get请求

1
http://你的域名(或者公网ip:8080)/Service/updateStep?phone=18888888888&password=CZ123456&steps=9990&flag=0

响应

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
"code": 200,
"msg": "成功",
"data": {
"pedometerRecordHourlyList": [{
"id": "08be23751dc24a4bbca0638ad8880973",
"userId": 26993431,
"deviceId": "M_NULL",
"measurementTime": "2020-08-22 00:00:00",
"step": "9950,9950,0,0,0,0,0,0,0,0,0,0,4550,5650,0,0,9990,0,0,0,0,0,0,0",
"calories": "2487.00,2487.00,0,0,0,0,0,0,0,0,0,0,1137.00,1412.00,0,0,2497.00,0,0,0,0,0,0,0",
"distance": "3316.00,3316.00,0,0,0,0,0,0,0,0,0,0,1516.00,1883.00,0,0,3330.00,0,0,0,0,0,0,0",
"dataSource": 2,
"created": "2020-08-22 00:17:42",
"active": 0,
"updated": 1598084752590
}]
}
}

提交自动刷步

get请求

1
http://你的域名(或者公网ip:8080)/Service/updateStep?phone=18888888888&password=CZ123456&steps=9990&flag=1

响应

1
2
3
4
{
"code": 508,
"msg": "已加入数据库进行定时任务"
}

响应码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
"code": 200,
"msg": "成功",
"data": {
"pedometerRecordHourlyList": [{
"id": "08be23751dc24a4bbca0638ad8880973",
"userId": 26993431,
"deviceId": "M_NULL",
"measurementTime": "2020-08-22 00:00:00",
"step": "9950,9950,0,0,0,0,0,0,0,0,0,0,4550,5650,0,0,9990,0,0,0,0,0,0,0",
"calories": "2487.00,2487.00,0,0,0,0,0,0,0,0,0,0,1137.00,1412.00,0,0,2497.00,0,0,0,0,0,0,0",
"distance": "3316.00,3316.00,0,0,0,0,0,0,0,0,0,0,1516.00,1883.00,0,0,3330.00,0,0,0,0,0,0,0",
"dataSource": 2,
"created": "2020-08-22 00:17:42",
"active": 0,
"updated": 1598084752590
}]
}
}
1
2
3
4
{
"code": 508,
"msg": "已加入数据库进行定时任务"
}
1
2
3
4
{
"code": 407,
"msg": "密码错误"
}
1
2
3
4
{
"code": 510,
"msg": "手机号长度错误"
}

下载

下载地址

https://chengzzz.lanzous.com/b0cqh4p2h
密码:d7ty