Skip to content

oldprogram/ballgame_server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##-上传接口 上传接口是硬件用的,用来将一个篮球比赛的实时数据发送给服务器

###1.创建游戏 creategame

http://139.224.67.24:8002/creategame
POST
{
  "userid":"100"
}

返回参数:error == null 表示无错误,否则有错
{
  "error":null,
  "gameid":7
}

创建一个比赛,创建的时候将用户ID传给服务器,服务器会返回一个比赛ID

###2.设置步数 setGameUserSteps

http://139.224.67.24:8002/setusersteps
POST
{
  "gameid":7,
  "userid":"100",
  "steps":100
}

返回参数:error == null 表示无错误,否则有错
{
  "error":null
}

设置用户当前运动步数,用来计算卡里路等数据,上传时需要设置用户id,比赛id,当前步数steps

###3.添加投篮记录 shotIn:0 表示没投进,1表示投进, 为1时必须有angle和distance参数

http://139.224.67.24:8002/addusershot

POST
{
  "gameid":7,
  "userid":"100",
  "shotIn":1,
  "angle":120,
  "distance":100
}

返回参数:error == null 表示无错误,否则有错
{
  "error":null
}

##- 查询接口
查询接口是APP客户端调用的,用来获取比赛信息

###1.查询最近场次的比赛

http://139.224.67.24:8002/recentgame

{
  "error":null
  "gameid":7,
  "createTime":"147xxxxxx"
}

###2.查询某用户某个比赛的步数
http://139.224.67.24:8002/userSteps?gameid=7&userid=100

{
  "error":null,
  "steps":100
}

###3.查询某用户某个比赛的投球情况
http://139.224.67.24:8002/userShotResults?gameid=7&userid=100
{
  "error":null,
  "shotNum":20,
  "shotInNum":12
}

###4.查询某用户某比赛的投球细节 http://139.224.67.24:8002/userShotDetails?gameid=7&userid=100

返回参数:error == null 表示无错误,否则有错
{
  "error":null,
  "detail":[
      {"shotIn":1,"angle":40,"distance":210,"shotTime":'1476774088446'},
      {"shotIn":1,"angle":30,"distance":230,"shotTime":'1476774088357'},
      {"shotIn":1,"angle":20,"distance":260,"shotTime":'1476774088190'},
      ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%