彩票查询
最后更新于:2022-04-02 08:24:47
## 彩票查询
>[danger]### 免费接口,每日100次免费调用,会员可不限次数调用,购买[API会员](https://market.topthink.com/product/210)
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/c5/69/c5696f36fff0199247eafddb43b20620_174x165.png)
> 目前支持双色球、大乐透、七乐彩、七星彩、福彩3D、排列3、排列5,数据来源于网络公开,开奖结果获取可能会有一定的延时。
## 接口调用([调用须知](https://docs.topthink.com/think-api/1835086))
## 接口1:支持彩种列表
### 请求地址
```
GET https://api.topthink.com/lottery/types
```
### 请求参数
无
### 返回参数
| 名称 | 类型 | 说明 |
| --- | --- | --- |
| 见JSON返回示例 | \- |
## SDK调用
```
$client = new Client("YourAppCode");
$result = $client->lotteryTypes()
->request();
```
返回示例:
~~~
{
"code":0,
"message": "成功的返回",
"data": [
{
"lottery_id": "ssq",
"lottery_name": "双色球",
"lottery_type_id": "1",
"remarks": "每周二、四、日开奖"
},
{
"lottery_id": "dlt",
"lottery_name": "超级大乐透",
"lottery_type_id": "2",
"remarks": "每周一、三、六开奖"
},
{
"lottery_id": "qlc",
"lottery_name": "七乐彩",
"lottery_type_id": "1",
"remarks": "每周一、三、五开奖"
},
{
"lottery_id": "fcsd",
"lottery_name": "福彩3D",
"lottery_type_id": "1",
"remarks": "每日开奖"
},
{
"lottery_id": "qxc",
"lottery_name": "七星彩",
"lottery_type_id": "2",
"remarks": "每周二、五、日开奖"
},
{
"lottery_id": "pls",
"lottery_name": "排列3",
"lottery_type_id": "2",
"remarks": "每日开奖"
},
{
"lottery_id": "plw",
"lottery_name": "排列5",
"lottery_type_id": "2",
"remarks": "每日开奖"
}
]
}
~~~
## 接口2:彩票开奖结果查询
### 请求地址
```
GET https://api.topthink.com/lottery/query
```
### 请求参数
| 名称 | 必填 | 类型 | 说明 |
| --- | --- | --- | --- |
| appCode| 是| string|用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) |
| lotteryId | 是 | string | 彩票ID |
| lotteryNo | 否 | string | 彩票期号,默认最新一期 |
### 返回参数
| 名称 | 类型 | 说明 |
| --- | --- | --- |
| 见JSON返回示例 | \- |
## SDK调用
```
$client = new Client("YourAppCode");
$result = $client->lotteryQuery()
->withLotteryId('ssq')
->request();
```
返回示例:
~~~
{
"code":0,
"message": "成功的返回",
"data": [
"lottery_id": "ssq",
"lottery_name": "双色球",
"lottery_res": "03,08,11,14,18,23,16",
"lottery_no": "18028",
"lottery_date": "2018-03-13",
"lottery_exdate": "2018-05-11",
"lottery_sale_amount": "352,015,830",
"lottery_pool_amount": "578,094,167",
"lottery_prize": [
{
"prize_name": "一等奖",
"prize_num": "7",
"prize_amount": "7,676,997",
"prize_require": "6+1"
},
{
"prize_name": "二等奖",
"prize_num": "220",
"prize_amount": "106,471",
"prize_require": "6+0"
},
{
"prize_name": "三等奖",
"prize_num": "1869",
"prize_amount": "3,000",
"prize_require": "5+1"
},
{
"prize_name": "四等奖",
"prize_num": "82708",
"prize_amount": "200",
"prize_require": "5+0,4+1"
},
{
"prize_name": "五等奖",
"prize_num": "1493643",
"prize_amount": "10",
"prize_require": "4+0,3+1"
},
{
"prize_name": "六等奖",
"prize_num": "8341565",
"prize_amount": "5",
"prize_require": "2+1,1+1,0+1"
}
]
]
}
~~~
## 接口3:历史开奖结果查询
### 请求地址
```
GET https://api.topthink.com/lottery/history
```
### 请求参数
| 名称 | 必填 | 类型 | 说明 |
| --- | --- | --- | --- |
| appCode| 是| string|用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) |
| lotteryId | 是 | string | 彩票ID |
| pageSize | 否 | string | 每次返回条数,默认10,最大50 |
| page | 否 | string | 当前页数,默认1 |
### 返回参数
| 名称 | 类型 | 说明 |
| --- | --- | --- |
| 见JSON返回示例 | \- |
## SDK调用
```
$client = new Client("YourAppCode");
$result = $client->lotteryHistory()
->withLotteryId('ssq')
->withPagesize('2')
->request();
```
返回示例:
~~~
{
"code":0,
"message": "成功的返回",
"data": [
"lotteryResList":[
{
"lottery_id":"ssq",
"lottery_res":"03,07,16,17,23,30,07",
"lottery_no":"20084",
"lottery_date":"2020-09-01",
"lottery_exdate":"2020-10-30",
"lottery_sale_amount":"340,223,360",
"lottery_pool_amount":"997,837,500"
},
{
"lottery_id":"ssq",
"lottery_res":"01,19,25,26,30,31,12",
"lottery_no":"20083",
"lottery_date":"2020-08-30",
"lottery_exdate":"2020-10-28",
"lottery_sale_amount":"375,628,538",
"lottery_pool_amount":"1,046,377,044"
}
],
"page":1,
"pageSize":2,
"totalPage":1296
]
}
~~~
## 接口4:中奖计算器
### 请求地址
```
GET https://api.topthink.com/lottery/bonus
```
### 请求参数
| 名称 | 必填 | 类型 | 说明 |
| --- | --- | --- | --- |
| appCode| 是| string|用户授权码,参考[API调用](https://docs.topthink.com/think-api/1835086) |
| lotteryId | 是 | string | 彩票ID |
| lotteryRes | 是 | string | 购买的号码,号码之间用英文逗号隔开,红色球和蓝色求之间用@连接,例如:01,11,02,09,14,22,25@05,03 |
| lotteryNo | 否 | string | 开奖期数,默认最新一期 |
### 返回参数
| 名称 | 类型 | 说明 |
| --- | --- | --- |
| 见JSON返回示例 | \- |
## SDK调用
```
$client = new Client("YourAppCode");
$result = $client->lotteryBonus()
->withLotteryId('ssq')
->withLotteryRes('01,11,02,09,14,22,25@05,03')
->request();
```
返回示例:
~~~
{
"code":0,
"message": "成功的返回",
"data": [
"lottery_id": "ssq",
"lottery_name": "双色球",
"lottery_no": "18029",
"lottery_date": "2018-03-15",
"real_lottery_res": "01,02,09,14,22,25,05",
"lottery_res": "01,11,02,09,14,22,25@05,03",
"in_money": "28",
"buy_red_ball_num": "7",
"buy_blue_ball_num": "2",
"hit_red_ball_num": "6",
"hit_blue_ball_num": "1",
"is_prize": "1",
"prize_msg": "恭喜您中奖了",
"lottery_prize": [
{
"prize_name": "一等奖",
"prize_require": "6+1",
"prize_num": "1",
"prize_money": "8,926,329"
},
{
"prize_name": "二等奖",
"prize_require": "6+0",
"prize_num": "1",
"prize_money": "288,700"
},
{
"prize_name": "三等奖",
"prize_require": "5+1",
"prize_num": "6",
"prize_money": "3,000"
},
{
"prize_name": "四等奖",
"prize_require": "4+1,5+0",
"prize_num": "6",
"prize_money": "200"
}
]
]
}
~~~
';