LuckyDraw 抽奖
获取抽奖信息
Mudu.Room.LuckyDraw.Get(function (response) {
response = JSON.parse(response)
if (response.status === 'y') {
console.log('获取成功,数据为:', response.data)
}
if (response.status === 'n') {
console.log('获取失败')
}
})
{
"status": "y",
"flag": 100,
"info": "获取抽奖信息成功",
"data": {
"lucky_draw": {
"id": 41988,
"award_name": "iphone 一部",
"deadline": "2017-05-16 23:48:00",
"join_type": 2,
"auto_open": 1,
"lucky_count": 3,
"address": {
"guide_msg": "请填写邮寄地址",
"is_show": 1,
"name": "请填写详细地址、收件人和联系方式",
},
},
"timestamp": 1494898605,
"time_str": "2017-05-16 09:36:45"
}
}
flag |
info |
status |
100 |
获取抽奖信息成功 |
y |
102 |
无数据 |
n |
名称 |
说明 |
类型 |
id |
抽奖id |
int |
award_name |
奖项名称 |
string |
deadline |
抽奖截止时间 |
string |
join_type |
参与类型,0 不允许任何观众,1 仅导入观众 ,2 仅报名观众,4 全部观众 |
int |
auto_open |
到抽奖报名截止事件是否自动开奖,0不自动开奖,1自动 |
int |
lucy_count |
中奖名额 |
int |
抽奖报名
Mudu.Room.LuckyDraw.SignUp(
{
userName: 'xiaobaitu23',
voucher: '13155818359',
custom_voucher: '123@163.com',
custom_field: ['自定义字段1','自定义字段2'],
},
function (response) {
response = JSON.parse(response)
if (response.status === 'y') {
console.log('抽奖报名成功')
}
if (response.status === 'n') {
console.log(response.info || '抽奖报名失败')
}
}
)
{
status : 'y',
flag: 100,
info: '参与成功!等待主办方开奖',
}
flag |
info |
status |
100 |
参与成功!等待主办方开奖 |
y |
101 |
已参与!等待主办方开奖 |
n |
102 |
服务器繁忙 |
n |
103 |
缺少参数 |
n |
104 |
抽奖不存在,请稍后再试 |
n |
105 |
请等待下次抽奖机会 |
n |
106 |
您来晚了 |
n |
获取开奖结果
Mudu.Room.LuckyDraw.Result(
function (response) {
response = JSON.parse(response)
if (response.status === 'y') {
console.log('获取成功,数据为:', response.data)
}
if (response.status === 'n') {
console.log('获取失败')
}
}
)
{
"status": "y",
"flag": 100,
"info": "抽奖结果获取成功",
"data": {
"is_lucky": true,
"remark": "iphone 一部",
"uptime_timestamp": "1649834207",
"service_timestamp": "1649834207",
"disable_edit_time": "1649834207",
"ld_record_id": "xxx",
"luckers": [
{
"uname": "张先生",
"voucher": "1655564432",
"remark": "iphone 一部"
},
{
"uname": "李先生",
"voucher": "16654335267",
"remark": "iphone 一部"
},
......
]
}
}
flag |
info |
status |
100 |
抽奖结果获取成功 |
y |
101 |
查无结果 |
n |
名称 |
说明 |
类型 |
uname |
观众名 |
string |
voucher |
抽奖凭证 |
string |
remark |
奖项名称 |
string |
LuckyDraw.Open事件
LuckyDraw.Open事件会在后台开奖的时候被触发
Mudu.MsgBus.On(
"LuckyDraw.Open",
function (response) {
var response = JSON.parse(response)
console.log('开奖啦')
})
- response与
获取开奖结果
时的response格式相同
LuckyDraw.Changed事件
LuckyDraw.Changed事件会在后台保存抽奖信息的时候被触发
Mudu.MsgBus.On(
"LuckyDraw.Changed",
function (response) {
var response = JSON.parse(response)
console.log('抽奖信息变更啦')
})
- response与
获取抽奖信息
时的response格式相同
获取已填写的收货地址
Mudu.Room.LuckyDraw.GetAddress(recordId,function (response) {
response = JSON.parse(response)
if (response.status === 'y') {
console.log('获取成功,数据为:', response.data)
}
if (response.status === 'n') {
console.log('获取失败')
}
})
{
"status": "y",
"flag": 100,
"info": "获取信息成功",
"data": {
"address": "杭州"
}
}
设置收货地址
Mudu.Room.LuckyDraw.SetAddress(address,recordId,function (response) {
response = JSON.parse(response)
if (response.status === 'y') {
console.log('提交成功')
}
if (response.status === 'n') {
console.log('获取失败')
}
})
{
"status": "y",
"flag": 100,
"info": "获取信息成功",
}