彩票兑换插件前端对接文档
本文档面向前端开发与联调人员,说明当前 lotto-redeem 插件已提供的接口、字段结构、页面建议对接顺序、状态流转和注意事项。
当前日期:2026-06-16
插件目录:/Users/water/Desktop/www/shop/plugins/lotto-redeem
1. 功能范围
当前已支持的业务范围:
- 彩票首页
- 开奖记录列表
- 中奖提醒弹窗
- 兑换页
- 提交兑换
- 兑换成功页
- 会员兑换记录列表
- 会员兑换记录详情
- 开奖信息页
- 会员中心入口
当前已支持的彩票类型:
- 双色球
ssq - 福彩3D
fc3d
当前已支持的兑换资产方式:
- 积分
points - 消费积分
integral - 可用爱心值
love
说明:
-
integral和love是否展示,取决于对应插件是否开启。 - 前端不要写死“消费积分”“可用爱心值”名称,要使用接口返回的动态名称。
- 前端提交和筛选
game_type时,不要再传中文,统一传英文 code:-
ssq表示双色球 -
fc3d表示福彩3D
-
2. 通用说明
2.1 接口返回格式
接口基于商城 successJson / errorJson 返回。
成功时通常结构为:
{
"result": 1,
"msg": "ok",
"data": {}
}
失败时通常结构为:
{
"result": 0,
"msg": "错误信息",
"data": []
}
前端处理建议:
-
result == 1视为成功 -
result == 0直接提示msg
2.2 登录要求
以下接口依赖会员登录:
- 提交兑换
- 兑换成功页
- 兑换记录列表
- 兑换记录详情
- 开奖信息
- 中奖通知详情
- 中奖通知已读
- 会员中心接口
未登录时会返回:
{
"result": 0,
"msg": "请先登录"
}
2.3 页面文案不要写死的部分
以下内容建议完全使用接口返回值:
- 插件名称
- 兑换方式名称
- 每注消耗文案
- 按钮文案
- 活动规则/兑换须知内容
3. 页面对接顺序建议
建议按以下顺序联调:
- 首页
home - 兑换页
exchange-page - 提交兑换
exchange-submit - 成功页
exchange-success - 会员兑换记录
exchange-records - 兑换记录详情
exchange-record-detail - 开奖信息页
lottery-info - 中奖提醒
notice-detail / notice-read - 会员中心
member-center
这样可以先跑通主链路,再补记录和提醒页面。
3.1 前端最短开发路径
如果前端要最快跑通一个可用版本,建议只按下面顺序做:
- 首页拉取
home - 点击某个彩票进入兑换页,拉取
exchange-page - 本地完成选号、选择兑换方式、勾选协议
- 调用
exchange-submit - 成功后跳转
exchange-success - 再补
exchange-records - 再补
exchange-record-detail - 最后补
lottery-info和winning_notice
这样前端不需要一开始就把所有页面一次性做完。
3.2 页面初始化与跳转关系
首页
- 页面进入时调用
home - 用户切换彩票 tab 时:
- 可以重新调用
home - 或只调用
open-records
- 可以重新调用
- 用户点击“兑换”时,带
game_type跳转兑换页
兑换页
- 页面进入时调用
exchange-page - 页面根据
number_panel渲染选号器 - 页面根据
method_options渲染兑换方式 - 用户点击“确认兑换”时调用
exchange-submit
成功页
- 提交成功后拿到
record_id - 跳转成功页时必须带
record_id - 成功页进入时再调用
exchange-success
兑换记录页
- 页面进入时调用
exchange-records - 切换游戏 tab 时重新带
game_type请求 - 切换状态 tab 时重新带
status请求 - 点击某一条记录时跳详情页
兑换记录详情页
- 页面进入时带
record_id - 调用
exchange-record-detail - 如果页面还有“查看开奖信息”入口,则继续跳
lottery-info
4. 接口清单
4.1 首页
路由:
plugin.lotto-redeem.frontend.index.home
用途:
- 获取首页展示信息
- 获取游戏列表
- 获取最新开奖列表
- 获取中奖提醒
请求参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| game_type | string | 否 | 当前选中的彩票类型,默认 ssq,可选 ssq / fc3d |
返回字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| page_title | string | 页面标题 |
| plugin_name | string | 插件自定义名称 |
| banner | string | 广告图完整地址 |
| notice_content | string | 兑换须知富文本 |
| rule_content | string | 活动规则富文本 |
| rule_link_text | string | 规则按钮文案 |
| exchange_link | string | 占位跳转链接 |
| current_game_type | string | 当前彩票类型 |
| current_game_type_name | string | 当前彩票中文名称 |
| game_list | array | 游戏列表 |
| open_record_list | array | 开奖记录列表 |
| winning_notice | object/null | 中奖提醒,没有则为 null |
| available_redeem_methods | array | 当前可用兑换方式,已按插件开启状态和基础设置勾选过滤 |
game_list 子项结构:
| 字段 | 类型 | 说明 |
|---|---|---|
| game_type | string | 彩票类型 |
| game_type_name | string | 彩票中文名称 |
| name | string | 显示名称 |
| desc | string | 描述 |
| exchange_button_text | string | 兑换按钮文案 |
| exchange_link | string | 占位链接 |
| cost_text | string | 每注消耗文案 |
| available_redeem_methods | array | 当前游戏可用兑换方式,子项结构同 method_options |
open_record_list 子项结构:
| 字段 | 类型 | 说明 |
|---|---|---|
| game_type | string | 彩票类型 |
| game_type_name | string | 彩票中文名称 |
| issue_no | string | 期号 |
| lottery_time | string | 开奖日期 |
| numbers | array | 开奖号码 |
numbers 子项结构:
| 字段 | 类型 | 说明 |
|---|---|---|
| value | string | 号码值,始终补零格式,例如 01 |
| color | string | red 或 blue |
winning_notice 结构:
| 字段 | 类型 | 说明 |
|---|---|---|
| record_id | int | 记录 ID |
| title | string | 标题 |
| message | string | 提示内容 |
| confirm_text | string | 确认按钮文案 |
| cancel_text | string | 取消按钮文案 |
| game_type | string | 彩票类型 |
| game_type_name | string | 彩票中文名称 |
| issue_no | string | 期号 |
| lottery_time | string | 开奖时间 |
| prize_amount | string/number | 奖金 |
| betting_number | string | 投注号码原始串 |
| lottery_no | string | 开奖号码原始串 |
前端处理建议:
- 首页游戏切换时,可重新请求
home或请求open-records -
winning_notice == null时不要弹窗 -
rule_content支持富文本展示
请求示例:
{
"game_type": "ssq"
}
前端使用示例:
this.$http.post('plugin.lotto-redeem.frontend.index.home', {
game_type: 'ssq'
}).then(res => {
const data = res.data.data
this.banner = data.banner
this.gameList = data.game_list
this.openRecordList = data.open_record_list
this.winningNotice = data.winning_notice
})
4.2 开奖记录列表
路由:
plugin.lotto-redeem.frontend.index.open-records
请求参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| game_type | string | 否 | 默认 ssq,可选 ssq / fc3d |
返回字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| current_game_type | string | 当前彩票类型 |
| current_game_type_name | string | 当前彩票中文名称 |
| open_record_list | array | 开奖记录列表 |
说明:
- 结构与首页里的
open_record_list一致
请求示例:
{
"game_type": "fc3d"
}
4.3 中奖通知详情
路由:
plugin.lotto-redeem.frontend.index.notice-detail
请求参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| record_id | int | 是 | 兑换记录 ID |
返回结构:
与首页 winning_notice 一致。
失败提示:
-
中奖记录不存在
请求示例:
{
"record_id": 12
}
4.4 中奖通知已读
路由:
plugin.lotto-redeem.frontend.index.notice-read
请求参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| record_id | int | 是 | 兑换记录 ID |
返回:
成功只返回 ok。
说明:
- 前端点击“查看中奖信息”前或关闭弹窗后,都可以调用一次
- 已读后该提醒不会再通过首页
winning_notice返回
请求示例:
{
"record_id": 12
}
4.5 兑换页
路由:
plugin.lotto-redeem.frontend.index.exchange-page
请求参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| game_type | string | 否 | ssq 或 fc3d,默认 ssq |
返回字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| page_title | string | 页面标题 |
| game_type | string | 彩票类型 |
| game_type_name | string | 彩票中文名称 |
| game_name | string | 游戏名 |
| random_button_text | string | 机选按钮文案 |
| clear_button_text | string | 清空按钮文案 |
| agreement_checked_default | bool | 协议是否默认勾选 |
| agreement_text | string | 协议前缀 |
| agreement_link_text | string | 协议链接文案 |
| agreement_content | string | 协议富文本内容 |
| redirect_link | string | 占位跳转链接 |
| redirect_link_type | string | 当前固定为 link |
| method_options | array | 兑换方式列表 |
| available_redeem_methods | array | 与 method_options 一致,建议前端统一使用这个字段渲染 |
| default_method | string | 默认兑换方式 |
| confirm_button_text | string | 默认确认按钮文案 |
| selected_rule_text | string | 选号区域标题 |
| number_panel | object | 选号面板结构 |
method_options 子项结构:
| 字段 | 类型 | 说明 |
|---|---|---|
| value | string | points / integral / love |
| label | string | 动态名称 |
| cost | string | 每注消耗数量,两位小数 |
| cost_text | string | 每注消耗展示文案 |
说明:
-
method_options/available_redeem_methods已经做过双重过滤:- 对应资产插件必须已开启
- 基础设置里必须勾选该兑换方式
- 对应每注消耗数量必须大于
0
- 前端不要自己推导哪些兑换方式可选,直接用接口返回值。
number_panel 结构:
双色球:
{
"groups": [
{
"key": "red",
"title": "红色球选号(可选6个号码)",
"select_count": 6,
"color": "red",
"numbers": ["01", "02"]
},
{
"key": "blue",
"title": "蓝色球选号(可选1个号码)",
"select_count": 1,
"color": "blue",
"numbers": ["01", "02"]
}
]
}
福彩3D:
{
"groups": [
{
"key": "hundreds",
"title": "百位选号",
"select_count": 1,
"color": "blue",
"numbers": ["00", "01"]
},
{
"key": "tens",
"title": "十位选号",
"select_count": 1,
"color": "blue",
"numbers": ["00", "01"]
},
{
"key": "units",
"title": "个位选号",
"select_count": 1,
"color": "blue",
"numbers": ["00", "01"]
}
]
}
前端处理建议:
- 页面初始化时使用
default_method - 兑换按钮文案可直接使用
confirm_button_text -
agreement_content可做弹窗或详情页展示
请求示例:
{
"game_type": "ssq"
}
前端渲染建议:
- 用
available_redeem_methods或method_options渲染兑换方式单选 - 用
default_method作为初始选中项 - 用
number_panel.groups渲染选号区域 - 用
agreement_content渲染协议内容 - 用
confirm_button_text渲染底部按钮
示例伪代码:
const data = res.data.data
this.form.game_type = data.game_type
this.form.redeem_method = data.default_method
this.methodOptions = data.available_redeem_methods
this.numberPanel = data.number_panel
this.agreementContent = data.agreement_content
this.submitText = data.confirm_button_text
4.6 提交兑换
路由:
plugin.lotto-redeem.frontend.index.exchange-submit
用途:
- 校验协议、兑换方式、选号
- 扣减资产
- 创建本地兑换记录
- 调用第三方下单
请求参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| game_type | string | 是 | ssq / fc3d |
| redeem_method | string | 是 | points / integral / love |
| agree_notice | int | 是 | 1 表示已勾选协议 |
| selected_numbers | object | 是 | 选号结构 |
4.6.1 前端到底该怎么传 selected_numbers
这是前端最关键的部分,实际只要按下面结构传即可。
双色球 ssq 传值规则
-
red必须是数组 - 数组里必须正好 6 个号码
- 每个号码建议传两位字符串,如
01 -
blue必须是数组 - 数组里必须正好 1 个号码
正确示例:
{
"red": ["01", "02", "03", "04", "05", "06"],
"blue": ["07"]
}
错误示例:
{
"red": ["01", "02"],
"blue": ["07"]
}
福彩3D fc3d 传值规则
-
hundreds必须是数组,且正好 1 个值 -
tens必须是数组,且正好 1 个值 -
units必须是数组,且正好 1 个值 - 建议统一传两位字符串
正确示例:
{
"hundreds": ["01"],
"tens": ["02"],
"units": ["03"]
}
错误示例:
{
"hundreds": ["01", "02"],
"tens": ["02"],
"units": ["03"]
}
前端能不能传数字
当前后端最终会做规范化处理,理论上数字也能转,但前端不要混传:
- 不要一会儿传
1 - 一会儿又传
"01"
建议统一传字符串并补零。
前端本地建议维护的数据结构
双色球:
selectedNumbers = {
red: [],
blue: []
}
福彩3D:
selectedNumbers = {
hundreds: [],
tens: [],
units: []
}
双色球 selected_numbers 示例:
{
"red": ["01", "02", "03", "04", "05", "06"],
"blue": ["07"]
}
福彩3D selected_numbers 示例:
{
"hundreds": ["01"],
"tens": ["02"],
"units": ["03"]
}
成功返回字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| record_id | int | 本地兑换记录 ID |
| order_sn | string | 本地订单号 |
| issue_no | string | 彩票期号 |
| third_order_code | string | 第三方订单号 |
| request_id | string | 第三方请求 ID |
| game_type | string | 彩票类型 |
| game_type_name | string | 彩票中文名称 |
| redeem_method | string | 兑换方式 |
| selected_numbers | object | 规范化后的选号结构 |
| confirm_button_text | string | 按钮文案 |
| redirect_link | string | 占位链接 |
| redirect_link_type | string | 固定 link |
| available_redeem_methods | array | 当前可用兑换方式,带消耗数量 |
失败场景:
- 未登录:
请先登录 - 插件未开启:
插件未开启 - 未勾选协议:
请先勾选兑换须知 - 未选择兑换方式:
请选择兑换方式 - 选号不正确:按具体错误返回
- 资产不足:返回具体错误
- 第三方下单失败:返回第三方错误信息
前端处理建议:
- 成功后缓存
record_id - 然后跳转成功页时带上
record_id - 不要依赖前端自己组装成功页内容
提交兑换完整请求示例
双色球 + 积分兑换:
{
"game_type": "ssq",
"redeem_method": "points",
"agree_notice": 1,
"selected_numbers": {
"red": ["01", "02", "03", "04", "05", "06"],
"blue": ["07"]
}
}
福彩3D + 消费积分兑换:
{
"game_type": "fc3d",
"redeem_method": "integral",
"agree_notice": 1,
"selected_numbers": {
"hundreds": ["01"],
"tens": ["02"],
"units": ["03"]
}
}
提交兑换成功返回示例
{
"result": 1,
"msg": "ok",
"data": {
"record_id": 15,
"order_sn": "LR202606161230001234",
"issue_no": "20260616",
"third_order_code": "TH202606160001",
"request_id": "req_xxx_001",
"game_type": "ssq",
"game_type_name": "双色球",
"redeem_method": "points",
"selected_numbers": {
"red": ["01", "02", "03", "04", "05", "06"],
"blue": ["07"],
"display": "01 02 03 04 05 06 07"
},
"confirm_button_text": "确认消耗10.00积分兑换",
"redirect_link": "/placeholder/lotto-redeem/index",
"redirect_link_type": "link",
"available_redeem_methods": [
{
"value": "points",
"label": "积分",
"cost": "10.00",
"cost_text": "10.00积分"
}
]
}
}
提交兑换失败返回示例
未勾选协议:
{
"result": 0,
"msg": "请先勾选兑换须知"
}
选号不正确:
{
"result": 0,
"msg": "请正确选择6个红球号码"
}
资产不足:
{
"result": 0,
"msg": "积分余额不足"
}
提交成功后的前端动作
建议前端收到成功后按下面顺序处理:
- 取出
record_id - 取出
order_sn - 跳转成功页
- 成功页再请求
exchange-success
伪代码:
submitExchange() {
this.$http.post('plugin.lotto-redeem.frontend.index.exchange-submit', payload)
.then(res => {
if (!res.data.result) {
this.$message.error(res.data.msg)
return
}
const data = res.data.data
this.$router.push({
path: '/lotto/success',
query: {
record_id: data.record_id
}
})
})
}
4.7 兑换成功页
路由:
plugin.lotto-redeem.frontend.index.exchange-success
请求参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| record_id | int | 是 | 提交兑换成功后返回的记录 ID |
返回字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| page_title | string | 页面标题 |
| status_text | string | 状态文案 |
| order_sn | string | 订单号 |
| consume_num | string/number | 消耗数量 |
| redeem_method_name | string | 兑换方式名称 |
| home_button_text | string | 首页按钮文案 |
| record_button_text | string | 记录按钮文案 |
| home_link | string | 首页占位链接 |
| record_link | string | 记录页占位链接 |
说明:
- 这里只代表“兑换请求提交成功”,不代表开奖结果已出
请求示例:
{
"record_id": 15
}
4.8 会员兑换记录列表
路由:
plugin.lotto-redeem.frontend.index.exchange-records
请求参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| game_type | string | 否 | 默认 ssq |
| status | string | 否 | '' / 0 / 1 / 2 |
返回字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| page_title | string | 页面标题 |
| current_game_type | string | 当前彩票类型 |
| current_game_type_name | string | 当前彩票中文名称 |
| game_tabs | array | 游戏切换标签 |
| status_tabs | array | 状态切换标签 |
| list | array | 记录列表 |
list 子项结构:
| 字段 | 类型 | 说明 |
|---|---|---|
| record_id | int | 记录 ID |
| game_type | string | 彩票类型 |
| game_type_name | string | 彩票中文名称 |
| issue_no | string | 期号 |
| status | int | 0待开奖 1未中奖 2已中奖 |
| status_name | string | 状态名称 |
| numbers | array | 投注号码格式化结果 |
| order_sn | string | 订单号 |
| consume_num | string/number | 消耗数量 |
| redeem_method_name | string | 兑换方式名称 |
| consume_text | string | 消耗展示文案 |
| created_at | string | 创建时间 |
| open_record_button_text | string | 按钮文案 |
请求示例:
{
"game_type": "ssq",
"status": ""
}
待开奖筛选示例:
{
"game_type": "ssq",
"status": "0"
}
4.9 兑换记录详情
路由:
plugin.lotto-redeem.frontend.index.exchange-record-detail
请求参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| record_id | int | 是 | 记录 ID |
返回字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| record_id | int | 记录 ID |
| game_type | string | 彩票类型 |
| game_type_name | string | 彩票中文名称 |
| issue_no | string | 期号 |
| status | int | 状态值 |
| status_name | string | 状态文案 |
| betting_numbers | array | 投注号码 |
| lottery_numbers | array | 开奖号码 |
| order_sn | string | 订单号 |
| consume_num | string/number | 消耗数量 |
| redeem_method_name | string | 兑换方式名称 |
| created_at | string | 创建时间 |
| lottery_time | string | 开奖时间 |
| prize_amount | string/number | 奖金 |
| open_result | string | 开奖说明 |
请求示例:
{
"record_id": 15
}
4.10 开奖信息页
路由:
plugin.lotto-redeem.frontend.index.lottery-info
请求参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| record_id | int | 是 | 记录 ID |
返回字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| page_title | string | 页面标题 |
| game_type | string | 彩票类型 |
| game_type_name | string | 彩票中文名称 |
| issue_no | string | 期号 |
| status | int | 状态值 |
| status_name | string | 状态名 |
| open_numbers | array | 开奖号码 |
| open_time | string | 开奖时间 |
| summary | object | 汇总信息 |
| betting_list | array | 投注列表 |
| qr_code | string | 验奖二维码 |
| query_desc | string | 查询描述 |
| query_tips | string | 查询提示 |
| open_result | string | 说明 |
summary 结构:
待开奖:
{
"title": "待开奖",
"desc": "暂未开奖",
"winning_amount": "0.00",
"award_list": []
}
未中奖:
{
"title": "未中奖",
"desc": "展示这一期会员兑换的全部注数!",
"winning_amount": "0.00",
"award_list": []
}
已中奖:
{
"title": "恭喜中奖",
"desc": "",
"winning_amount": "100.00",
"award_list": [
{
"award_name": "中奖",
"count": 1,
"amount": "100.00"
}
]
}
betting_list 子项结构:
| 字段 | 类型 | 说明 |
|---|---|---|
| status_name | string | 状态名 |
| numbers | array | 当前注号码 |
| amount | string | 中奖金额,未中奖/待开奖为空 |
说明:
-
qr_code来自第三方回调qr_code - 当前回调文档里没有奖金、开奖号、开奖时间等更多字段,所以这些字段是否有值取决于后台后续补充
请求示例:
{
"record_id": 15
}
4.11 会员中心接口
路由:
plugin.lotto-redeem.frontend.index.member-center
请求参数:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| game_type | string | 否 | 默认 ssq |
| status | string | 否 | 状态筛选 |
返回字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| page_title | string | 插件名称 |
| member_info | object | 会员信息 |
| summary | object | 中奖金额汇总 |
| current_game_type | string | 当前游戏 |
| current_game_type_name | string | 当前游戏中文名称 |
| game_tabs | array | 游戏切换 |
| status_tabs | array | 状态切换 |
| list | array | 记录列表 |
| available_redeem_methods | array | 当前可用兑换方式,带消耗数量 |
| h5_placeholder_url | string | H5 占位地址 |
| mini_placeholder_url | string | 小程序占位地址 |
member_info 结构:
| 字段 | 类型 | 说明 |
|---|---|---|
| avatar | string | 头像完整地址 |
| nickname | string | 昵称 |
summary 结构:
| 字段 | 类型 | 说明 |
|---|---|---|
| total_prize_amount | string | 总中奖金额 |
| ssq_prize_amount | string | 双色球中奖金额 |
| fc3d_prize_amount | string | 福彩3D中奖金额 |
说明:
-
list结构与exchange-records基本一致
请求示例:
{
"game_type": "ssq",
"status": ""
}
5. 号码字段说明
5.1 双色球
提交结构:
{
"red": ["01", "02", "03", "04", "05", "06"],
"blue": ["07"]
}
校验规则:
- 红球必须正好 6 个
- 蓝球必须正好 1 个
后端落库格式:
01,02,03,04,05,06,07
5.2 福彩3D
提交结构:
{
"hundreds": ["01"],
"tens": ["02"],
"units": ["03"]
}
校验规则:
- 百位正好 1 个
- 十位正好 1 个
- 个位正好 1 个
后端落库格式:
01,02,03
6. 状态说明
6.1 业务状态 status
| 值 | 说明 |
|---|---|
| 0 | 待开奖 |
| 1 | 未中奖 |
| 2 | 已中奖 |
6.2 第三方出票状态 ticket_status
| 值 | 说明 |
|---|---|
| 0 | 待处理 |
| 1 | 出票中 |
| 2 | 已出票 |
| 3 | 未中奖 |
| 4 | 已中奖 |
| 9 | 已撤销 |
6.3 资产返还状态 refund_status
| 值 | 说明 |
|---|---|
| 0 | 未返还 |
| 1 | 已返还 |
当前返还规则:
- 仅当回调
ticket_status = 9时返还资产 - 为了避免重复回调导致重复返还,后端做了幂等控制
7. 第三方接口入库情况
当前与第三方文档字段的对应关系如下:
7.1 下单请求
| 第三方字段 | 当前存储方式 |
|---|---|
| order_code | order_sn |
| lottery_type | request_data |
| bet_info | request_data |
7.2 下单响应
| 第三方字段 | 当前存储方式 |
|---|---|
| status | response_data |
| error_code | response_data |
| msg | response_data |
| request_id | request_id + response_data |
| data.lottery_period | issue_no + response_data |
| data.third_order_code | third_order_code + response_data |
7.3 回调数据
| 第三方字段 | 当前存储方式 |
|---|---|
| order_code | order_sn |
| status | ticket_status + callback_data |
| qr_code | callback_qr_code + callback_data |
8. 前端联调注意事项
-
不要假设
integral和love一定可用。 必须以接口返回的available_redeem_methods或method_options为准。 -
game_type不要再传中文。 前端请求统一传ssq/fc3d,展示时使用接口返回的game_type_name。 -
不要自己写兑换方式名称。 必须使用接口里的
label或redeem_method_name。 -
成功页只代表请求提交成功,不代表中奖。 中奖结果以后续记录页和开奖信息页为准。
-
兑换提交后建议保留
record_id。 后续成功页、记录详情、开奖信息页都依赖它。 -
qr_code只有第三方回调后才可能有值。 前端要允许为空字符串。 -
prize_amount、lottery_no、lottery_time在当前阶段可能为空。 前端不要强依赖这些字段一定返回。 -
富文本内容可能为空。
notice_content、rule_content、agreement_content为空时要兼容空展示。 -
按钮文案尽量直接使用接口返回值。 尤其是兑换按钮和协议相关文案。
9. 推荐页面状态流
9.1 首页进入兑换
- 请求
home - 渲染
game_list - 点击某个游戏“兑换”
- 带
game_type请求exchange-page
9.2 提交兑换
- 用户选号
- 用户选择兑换方式
- 用户勾选协议
- 调用
exchange-submit - 成功后保存
record_id - 跳转
exchange-success?record_id=xxx
9.3 查看记录
- 请求
exchange-records - 点击某条记录
- 调用
exchange-record-detail - 如需看开奖页,再调用
lottery-info
9.4 中奖提醒
- 首页
home返回winning_notice - 前端弹窗展示
- 用户查看详情时先调
notice-read - 再跳转开奖信息页或记录详情页
9.5 前端页面开发参考伪代码
首页进入兑换页
goExchange(gameType) {
this.$router.push({
path: '/lotto/exchange',
query: {
game_type: gameType
}
})
}
兑换页初始化
initExchangePage() {
this.$http.post('plugin.lotto-redeem.frontend.index.exchange-page', {
game_type: this.$route.query.game_type || 'ssq'
}).then(res => {
const data = res.data.data
this.gameType = data.game_type
this.methodOptions = data.available_redeem_methods
this.redeemMethod = data.default_method
this.numberPanel = data.number_panel
this.agreementContent = data.agreement_content
})
}
兑换页提交
submit() {
const payload = {
game_type: this.gameType,
redeem_method: this.redeemMethod,
agree_notice: this.agreeNotice ? 1 : 0,
selected_numbers: this.selectedNumbers
}
this.$http.post('plugin.lotto-redeem.frontend.index.exchange-submit', payload)
.then(res => {
if (!res.data.result) {
this.$message.error(res.data.msg)
return
}
this.$router.push({
path: '/lotto/success',
query: {
record_id: res.data.data.record_id
}
})
})
}
记录页筛选
fetchRecords() {
this.$http.post('plugin.lotto-redeem.frontend.index.exchange-records', {
game_type: this.currentGameType,
status: this.currentStatus
}).then(res => {
this.records = res.data.data.list || []
})
}
10. 已知限制
- 当前只支持双色球和福彩3D。
- 当前回调文档只提供
order_code/status/qr_code,没有提供开奖号码、开奖时间、奖金明细等更丰富字段。 -
copy_link、copy_h5_link、copy_mini_link目前是占位地址,真实地址待前端正式页面提供后替换。
11. 接口路由汇总
| 页面/功能 | 路由 |
|---|---|
| 首页 | plugin.lotto-redeem.frontend.index.home |
| 开奖记录列表 | plugin.lotto-redeem.frontend.index.open-records |
| 中奖通知详情 | plugin.lotto-redeem.frontend.index.notice-detail |
| 中奖通知已读 | plugin.lotto-redeem.frontend.index.notice-read |
| 兑换页 | plugin.lotto-redeem.frontend.index.exchange-page |
| 提交兑换 | plugin.lotto-redeem.frontend.index.exchange-submit |
| 兑换成功页 | plugin.lotto-redeem.frontend.index.exchange-success |
| 兑换记录列表 | plugin.lotto-redeem.frontend.index.exchange-records |
| 兑换记录详情 | plugin.lotto-redeem.frontend.index.exchange-record-detail |
| 开奖信息页 | plugin.lotto-redeem.frontend.index.lottery-info |
| 会员中心 | plugin.lotto-redeem.frontend.index.member-center |
12. 文档位置
当前文档文件: