### 名词解析
* 期数 `period`
* 开奖 `run lottery`
* 往期 `previous period`
* 奖项 `award`
* 投注(奖项)`betting`
* 清空(奖项)`clean`
* 已投注(奖项)`betted`
* 赔率(奖项)`odds`
* 中奖号码 `winning number`
* 中奖总数 `winning total`
* 中奖单双 `winning odd-even`
* 中奖大小 `winning big-small`
* 奖励 `reward`
* 道具 `prop`
* 金豆 `points`
* 状态 `status`,10=>投注中,9=>停止投注,0=>结束
* 开始时间 `start time`
* 停止投注时间 `stop time`
* 结束时间(开奖) `end time`
### 时间控制
1. 开始时间为整分钟
2. 投注时间为40秒
3. 停止投注时间为5秒(动画播放)
4. 开奖时间为15秒(后台计算用时,多余时间显示开奖结果,不够显示结果时间则拖延至下一期投注时间)
> 例:第一期开始时间为12:00:00,则第一期停止投注时间为12:00:45,结束时间(开奖)为12:00:46,下一期开始时间为12:01:00
#### 当前期数
~~~[api]
get:/dice/index/index
<<<
success
{
"message": "success",
"code": 1,
"data": {
"id": 13,
"period": "201804110001",
"status": 9,
"created_at": 1523378244,
"updated_at": 1523417336,
"start_at": 1523378244,
"stop_at": 1523378284,
"end_at": 1523378289,
"winning_number": "3|1|5",
"winning_total": 9,
"winning_odd-even": 1,
"winning_big-small": 2,
"previous": [
{
"id": "12",
"period": "201804100004",
"winning_number": [
"1",
"4",
"6"
],
"winning_total": "11",
"winning_odd-even": "单",
"winning_big-small": "大",
"status": "0",
"created_at": "1523375993",
"updated_at": "1523376007",
"start_at": "1523375993",
"stop_at": "1523376033",
"end_at": "1523376038"
}
],
"member": {
"point": "0.00"
}
}
}
<<<
error
{
"message": "无数据",
"code": 0,
"data": []
}
~~~
#### 投注
~~~[api]
post:/dice/index/betting
*number:award#奖项
*number:point#积分
<<<
success
{
"message": "success",
"code": 1,
"data": {
"point": 0
}
}
<<<
error
{
"message": "当前期数已不可下注",
"code": 0,
"data": []
}
<<<
error
{
"message": "余额不足",
"code": 0,
"data": []
}
~~~
#### 已投注奖项
~~~[api]
get:/dice/index/betted
<<<
success
{
"message": "success",
"code": 1,
"data": {
"current": [
{
"award": "1",
"point": "20.00"
},
{
"award": "2",
"point": "10.00"
},
{
"award": "3",
"point": "20.00"
},
{
"award": "4",
"point": "50.00"
},
{
"award": "7",
"point": "50.00"
},
{
"award": "11",
"point": "50.00"
}
],
"other": [
{
"award": "2",
"point": "10.00"
},
{
"award": "4",
"point": "10.00"
},
{
"award": "11",
"point": "60.00"
},
{
"award": "17",
"point": "10.00"
}
],
"top": [
{
"nickname": "one",
"point": 10000
},
{
"nickname": "two",
"point": 9000
},
{
"nickname": "three",
"point": 8000
},
{
"nickname": "four",
"point": 7000
},
{
"nickname": "five",
"point": 6000
}
],
"online": 1
}
}
~~~
#### 清空
~~~[api]
post:/dice/index/clean
<<<
success
{
"message": "success",
"code": 1,
"data": {
"point": "10.00"
}
}
<<<
error
{
"message": "当前期数已不可清空",
"code": 0,
"data": []
}
~~~
#### 退出
~~~[api]
post:/dice/index/quit
<<<
success
{
"message": "success",
"code": 1,
"data": []
}
~~~
#### 定时任务
> 新浪SAE定时任务,前端无需接入
~~~[api]
get:/dice/sae/crontab
<<<
success
{
"message": "success",
}
~~~
#### 开奖
> 新浪SAE任务队列,前端无需接入
~~~[api]
get:/dice/sae/run-lottery
<<<
success
{
"message": "success",
}
~~~
#### 计算投注
> 新浪SAE任务队列,前端无需接入
~~~[api]
get:/dice/sae/calc-betted
<<<
success
{
"message": "success",
}
~~~
#### 结束期数
> 新浪SAE任务队列,前端无需接入
~~~[api]
get:/dice/sae/stop-period
<<<
success
{
"message": "success",
}
~~~
#### 推送结果
> 新浪SAE任务队列,前端接收channel
~~~[api]
get:/dice/sae/send-result
<<<
success
{
"message": "success",
}
<<<
channel
{
"name": "dice_run_ottery",
"period": {
"id": "12",
"period": "201804100004",
"winning_number": [
"1",
"4",
"6"
],
"winning_total": "11",
"winning_odd-even": "单",
"winning_big-small": "大",
"status": "0",
"created_at": "1523375993",
"updated_at": "1523376007",
"start_at": "1523375993",
"stop_at": "1523376033",
"end_at": "1523376038"
},
"point": 10.00,
"reward": 76
}
~~~
#### 新的期数
> 新浪SAE任务队列,前端无需接入
~~~[api]
get:/dice/sae/new-period
<<<
success
{
"message": "success",
}
~~~