互动-抽奖
核心类
类名 | 类描述 |
---|---|
VHallLottery | 抽奖类 |
VHallLottery 基础属性
属性 | 属性描述 |
---|---|
delegate | 代理对象 |
VHallLottery 关键方法
方法 | 方法描述 |
---|---|
submitLotteryInfo | 提交个人中奖信息 |
getSubmitConfigWithWebinarId | 获取领奖页中奖信息列表 |
lotteryParticipationWithRoomId | 参加口令抽奖 |
getLotteryWinListWithLotteryId | 获取中奖名单 |
fetchLotteryListShowAll | 获取抽奖列表接口 |
lotteryWinningUserInfoWithRoomId | 获取中奖人信息 |
lotteryWinningUserDetail | 查看中奖详情 |
VHallLotteryDelegate 关于文档的代理方法
方法 | 方法描述 |
---|---|
startLottery | 抽奖开始 |
endLottery | 抽奖结束 |
提交个人中奖信息
- (void)submitLotteryInfo:(NSDictionary *)info
success:(void(^)(void))success
failed:(void (^)(NSDictionary *failedData))reslutFailedCallback;
参数名称 | 是否必须 | 示例 | 备注 |
---|---|---|---|
info | 是 | @{@"name":姓名,@"phone":手机号,...} | 个人信息 |
success | 成功回调 | ||
reslutFailedCallback | 失败回调 字典结构:{code:错误码,content:错误信息} |
/// 抽奖对象
@property (nonatomic, strong) VHallLottery * lottery;
self.lottery = [[VHallLottery alloc] initWithObject:self.inavRoom];
self.lottery.delegate = self;
[self.lottery submitLotteryInfo:dic success:^{
// 提交成功
} failed:^(NSDictionary *failedData) {
// 提交失败
}];
获取领奖页中奖信息列表
通过各项中的 field_key 作为 key,以及对应输入内容作为 value,一起组成字典,用于提交中奖信息接口传参 (v6.0 新增,仅支持 v3 控制台新建的直播抽奖使用)
- (void)getSubmitConfigWithWebinarId:(NSString *)webinar_id
lottery_id:(NSString *)lottery_id
success:(void(^)(NSArray <VHallLotterySubmitConfig *> *submitList, NSInteger receive_award_way))success
failed:(void (^)(NSDictionary *failedData))reslutFailedCallback;
参数名称 | 是否必须 | 示例 | 备注 |
---|---|---|---|
webinar_id | 是 | 123456789 | 活动 id |
lottery_id | 是 | 123456 | 抽奖 id |
success | 成功回调 | submitList 信息列表 receive_award_way 领奖方式 1 寄送奖品,2 私信兑奖,3 无需领奖 | |
reslutFailedCallback | 失败回调 字典结构:{code:错误码,content:错误信息} |
VHallLotterySubmitConfig 参数详解
参数名称 | 备注 |
---|---|
is_required | 是否必填 1:必填 0:非必填 |
is_system | 是否是系统选项,即非自定义项 1:是 0:否 |
rank | 输入项显示位置,控制台添加的自定义项显示顺序,越大越靠后显示 |
field | 该输入项标题 |
placeholder | 该输 入项 placeholder |
field_key | 提交中奖信息传参字典对应的 key |
__weak __typeof(self)weakSelf = self;
[self.vhLottery getSubmitConfigWithWebinarId:@"活动id" lottery_id:@"抽奖id" success:^(NSArray<VHallLotterySubmitConfig *> *submitList, NSInteger receive_award_way) {
// 判断领奖方式 1寄送奖品,2私信兑奖,3无需领奖
if (receive_award_way == 1) {
// 寄送界面 填写信息弹窗
}
if (receive_award_way == 2) {
// 私信领奖
}
} failed:^(NSDictionary *failedData) {
NSString * msg = [NSString stringWithFormat:@"%@",failedData[@"content"]];
[VHProgressHud showToast:msg];
}];
参加口令抽奖
v6.0 新增,仅支持 v3 控制台新建的直播抽奖使用
- (void)lotteryParticipationWithRoomId:(NSString *)room_id
lottery_id:(NSString *)lottery_id
command:(NSString *)command
success:(void(^)(void))success
failed:(void (^)(NSDictionary *failedData))reslutFailedCallback;
参数名称 | 是否必须 | 示例 | 备注 |
---|---|---|---|
room_id | 是 | lss_xxxxxx | 房间 id 可以从消息回调的模型中获取 |
lottery_id | 是 | 123456 | 抽奖 id |
success | 成功回调 | ||
success | 成功回调 | ||
reslutFailedCallback | 失败回调 字典结构:{code:错误码,content:错误信息} |
[self.vhLottery lotteryParticipationWithRoomId:self.startModel.huadieInfo.room_id lottery_id:self.startModel.huadieInfo.lottery_id command:self.startModel.huadieInfo.command success:^{
[VHProgressHud showToast:@"参与成功"];
} failed:^(NSDictionary *failedData) {
NSString * msg = [NSString stringWithFormat:@"%@",failedData[@"content"]];
[VHProgressHud showToast:msg];
}];
获取中奖名单
v6.0 新增,仅支持 v3 控制台新建的直播抽奖使用
- (void)getLotteryWinListWithLotteryId:(NSString *)lottery_id
success:(void(^)(VHallLotteryResultModel * lotteryResult))success
failed:(void (^)(NSDictionary *failedData))reslutFailedCallback;
参数名称 | 是否必须 | 示例 | 备注 |
---|---|---|---|
lottery_id | 是 | 123456 | 抽奖 id |
success | 成功回调 | submitList | |
reslutFailedCallback | 失败回调 字典结构:{code:错误码,content:错误信息} |
VHallLotteryResultModel 参数详解
参数名称 | 备注 |
---|---|
total | 中奖总人数 |
lottery_id | 抽奖 id |
user_win | 自己是否中奖 |
list | 中奖人 id |
VHallLotteryResultModel_ListItem 参数详情
参数名称 | 备注 |
---|---|
win | 是否中奖 |
lottery_user_id | 中奖者 id |
lottery_user_nickname | 中奖者昵称 |
lottery_user_avatar | 中奖者头像 |
lottery_award_id | 奖品 id |
lottery_award_name | 奖品名称 |
__weak __typeof(self)weakSelf = self;
[self.vhLottery getLotteryWinListWithLotteryId:self.endLotteryModel.huadieInfo.lottery_id success:^(VHallLotteryResultModel *lotteryResult) {
//收到数据用列表展示,切刷新列表
[weakSelf.dataSource setArray:lotteryResult.list];
[weakSelf.tableView reloadData];
} failed:^(NSDictionary *failedData) {
NSString * msg = [NSString stringWithFormat:@"%@",failedData[@"content"]];
[VHProgressHud showToast:msg];
}];
获取抽奖列表接口
- (void)fetchLotteryListShowAll:(NSInteger)showAll
webinarId:(NSString *)webinarId
success:(void (^)(VHLotteryListModel * listModel))success
fail:(void (^)(NSError * error))fail;
参数名称 | 是否必须 | 示例 | 备注 |
---|---|---|---|
showAll | 是 | YES | 是否需要展示所有抽奖 0-否(默认:仅展示进行中、已中奖抽奖) 1-全部抽奖 2 已中奖抽奖(sdk 专用) |
webinarId | 是 | 123456789 | 活动 id |
listModel | 成功返回数据 | array | 抽奖列表 |
success | 失败回调 |
VHLotteryModel 参数详解
参数名称 | 备注 |
---|---|
award_snapshoot | 奖品快照 |
title | 抽奖标题 |
created_at | 创建时间 |
icon | 图标地址 |
img_order | 抽奖动图下标 |
remark | 本次抽奖说明 |
lottery_id | 抽奖 id |
win | 已中奖 |
take_award | 已领奖 |
need_take_award | 是否需要领奖 |
publish_winner | 是否显示中奖名单 |
[self.lottery fetchLotteryListShowAll:2 webinarId:self.roomId success:^(VHLotteryListModel * _Nonnull listModel) {
} fail:^(NSError * _Nonnull error) {
}];
获取中奖人信息
- (void)lotteryWinningUserInfoWithRoomId:(NSString *)room_id
complete:(void(^)(VHallLotteryUserInfo * userInfo, NSError *error))complete;
参数名称 | 是否必须 | 示例 | 备注 |
---|---|---|---|
room_id | 是 | lss_xxx | 房间 id |
VHallLotteryUserInfo 参数详解
参数名称 | 备注 |
---|---|
lottery_id | 抽奖 id |
lottery_user_name | 姓名 |
lottery_user_phone | 手机 |
lottery_user_nickname | 昵称 |
lottery_user_address | 地址 |
lottery_user_remark | 备注 |
[self.vhLottery lotteryWinningUserInfoWithRoomId:endLotteryModel.huadieInfo.room_id complete:^(VHallLotteryUserInfo *userInfo, NSError *error) {
// userInfo 为详细信息
}];
查看中奖详情
+ (void)lotteryWinningUserDetail:(NSString *)room_id
lottery_id:(NSString *)lottery_id
success:(void(^)(NSDictionary *responseObject))success
fail:(void(^)(NSError *error))fail;
参数名称 | 是否必须 | 示例 | 备注 |
---|---|---|---|
room_id | 是 | lss_xxx | 房间 id |
lottery_id | 是 | 123456 | 抽奖 id |
VHallLotteryUserInfo 参数详解
参数名称 | 备注 |
---|---|
lottery_id | 抽奖 id |
lottery_user_name | 姓名 |
lottery_user_phone | 手机 |
lottery_user_nickname | 昵称 |
lottery_user_address | 地址 |
lottery_user_remark | 备注 |
[self.lottery lotteryWinningUserDetail:self.webinarInfo.webinarInfoData.interact.room_id lottery_id:self.endLotteryModel.lottery_id complete:^(VHallLotteryUserInfo *userInfo, NSError *error) {
}];
抽奖开始
- (void)startLottery:(VHallStartLotteryModel *)msg;
VHallStartLotteryModel 参数详解
参数名称 | 备注 |
---|---|
继承 VHallLotteryModel | 详解 |
num | 抽奖人数 |
title | 抽奖标题 |
remark | 抽奖说明 |
icon | 抽奖动图 |
command | 抽奖口令(如果是口令抽奖) |
type | 抽奖类型 (0:普通抽奖 1:口令抽奖) |
huadieInfo | 化蝶源数据 |
VhallLotteryInfo 参数详解
参数名称 | 备注 |
---|---|
lottery_winners_award | 中奖人名单和奖品 |
award | 奖品信息 |
room_id | 直播房间 id lss_ |
lottery_creator_avatar | 抽奖发起者头像 |
lottery_creator_id | 抽奖发起者 id |
lottery_creator_nickname | 抽奖发起者昵称 |
lottery_id | 抽奖 id |
lottery_status | 抽奖状态:0 开始抽奖 1 |
icon | 抽奖动画图片 url |
remark | 抽奖说明 |
command | 口令 |
lottery_number | 抽奖人数 |
title | 抽奖标题 |
type | |
lottery_publisher_id | |
lottery_winners | 中奖人 id,逗号隔开的 |
actual_lottery_number | 实际中奖人数 |
publish_winner | 抽奖结束后是否显示中奖名单 |
is_new | 是否为新版抽奖 1:是 |
lottery_type | 抽奖类型:_ 1 全体参会用户 _ 2 参与问卷的参会者 _ 3 参与签到的参会者 _ 4.全体观众 _ 5.已登录观众 _ 6.参与问卷的观众 _ 7.参与签到的观众 _ 8.口令参与 _ 9.分享参与 _ 10.邀请人数参与 _ 20 批量上传用户 _ 21 参与快问快答', |
is_last_batch | 是否为最后一批,1: 是最后一批 |
need_take_award | 是否需要领奖, 1: 需要领奖 |
img_order | |
can_look_award_pool | |
isWin_userId | 自己中奖的用户 id(自己中奖才有值) |
isWin | 自己是否中 奖 |
isCallBack | 中奖结果是否已经回调出去(防止分批接收中奖结果消息,出现延迟很久才收到消息的异常情况发生时引发多次回调) |
VhallLotteryInfoAwardItem 参数详解
参数名称 | 备注 |
---|---|
uid | 用户 id |
award_name | 奖品名称 |
VhallLotteryAward 参数详解
参数名称 | 备注 |
---|---|
award_name | 奖品名 |
award_desc | 奖品描述 |
ID | 奖品 id |
image_url | 奖品图片 |
link_url | 奖品链接 |
created_at | |
source_id | |
app_id | |
quantity | |
surplus | |
lottery_id | |
sort | |
business_uid |
抽奖结束
- (void)endLottery:(VHallEndLotteryModel *)msg;
参数名称 | 备注 |
---|---|
isWin | 自己是否中奖 |
account | 自己的登录账号(自己中奖才有值) |
resultModels | 中奖名单 (旧版抽奖会返回此值,新版抽奖结束消息将不会返回此值,请使用 VHallLottery 调用接口获取中奖名单) |
prizeInfo | 奖品信息 |
publish_winner | 是否显示中奖名单 |
need_take_award | 是否需要领奖 |
修改于 2025-05-27 11:59:31