| 方法 | 方法描述 |
|---|---|
| imReceiveRoomMessage | 消息回调监听 |
| 方法 | 方法描述 |
|---|---|
| VHRoomEventType.WATCH_GIFT_OPEN | 推送观看有礼消息 |
| VHRoomEventType.WATCH_GIFT_END | 观看有礼结束消息 |
public getWatchGiftLastInfo(webinarId: number, callback: VHWatchGiftCallback)| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| webinarId | 是 | 987009283 | 活动id |
| callback | 是 | xx | VHWatchGiftCallback回调接口 |
在进入直播间时调用,或监听到VHRoomEventType.WATCH_GIFT_OPEN时调用
//参与观看有礼 需要先调用此接口,表示开始参与,否则会提示参与时长不够
VHSaaSDK.getInstance().getWatchGiftLastInfo(this.webinar_info?.webinar?.id!, {
// 成功
onSucceed: (data: VHWatchGiftInfo) => {
//进入直播间如果正在推送且没有到达观 看限制,则显示观看有礼信息
if (data.state == 1 && data?.watch_minute! * 60 > data?.online_duration!) {
this.handleWatchGift(data);
}
},
// 失败
onFailure: (errorCode: number, errorMsg: string) => {
}
})if (type == VHRoomEventType.WATCH_GIFT_OPEN) {
this.handleWatchGiftOpen(message)
} else if (type == VHRoomEventType.WATCH_GIFT_END) {
this.handleWatchGiftEnd(message)
}| VHWatchGiftInfo | 类型 | 备注 |
|---|---|---|
| id | number | 观看有礼 ID |
| business_uid | business_uid | B 端用户 ID ,活动发起者用户id |
| title | string | 标题 |
| watch_minute | number | 观看时长,观看几分钟能抽奖 |
| display_of_results | number | 展示效果 0 全屏展示,1 半屏展示 |
| can_look_winner_list | number | 是否可以显示中将名单 0不显示 1 显示 |
| state | number | 状态: 1 已推送,2 已结束 |
| winners_times | number | 中奖次数(当前用户在本场活动中过几次奖) |
| winners_state | number | 当前观看有礼中奖状态, 0 未抽奖,1 未中奖,2 已中奖,3 已领奖 |
| take_award_times | number | take_award_times |
| online_duration | number | 在线时长 |
public getWatchGiftAwardList(webinarId: number, watchGiftId: number, callback: VHWatchGiftAwardListCallback)| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| webinarId | 是 | 987009283 | 活动id |
| watchGiftId | 是 | 观看有礼id,通过getWatchGiftLastInfo接口获得 | |
| callback | 是 | xx | VHWatchGiftAwardListCallback |
VHSaaSDK.getInstance().getWatchGiftAwardList(this.webinar_info?.webinar?.id!,this.watchGiftId?.id!,{
onSucceed: (data: VHWatchGiftAward) => {
this.isCheckAwardList = true;
if(data.total > 0){
this.highlightDataSource.updateData(data.list);
}
},
onFailure: (errorCode: number, errorMsg: string) => {
}
});
})| VHWatchGiftInfo | 类型 | 备注 |
|---|---|---|
| total | number | 奖项总数 |
| list | VHGiftAwardItem[] | 奖项列表 |
| VHGiftAwardItem | 类型 | 备注 |
|---|---|---|
| quantity | number | 数量 |
| sort | number | 排序值 |
| scenes | number | 场景:0=抽奖 1=观看有礼 |
| extension | string | 扩展信息 |
| award_id | number | 奖项ID |
| award_name | string | 奖项名称 |
| award_img_url | string | 奖项图片URL |
| award_desc | string | 奖项描述 |
| create_time | string | 创建时间(格式:YYYY-MM-DD HH:MM:SS) |
| award_type | string | 奖品类型:0-自定义奖品 1-优惠券奖品 2-礼品 3-三方奖品 默认0 |
| coupon_id | string | 优惠券ID |
| third_lottery_id | string | 第三方抽奖ID |
public setWatchGiftParticipate(webinarId: number, watchGiftId: number, roomsId: string, switchId: number,
callback: VHWatchGiftParticipateCallback)| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| webinarId | 是 | 987009283 | 活动id |
| watchGiftId | 是 | 观看有礼id,通过getWatchGiftLastInfo接口获得 | |
| roomId | 是 | 房间id | |
| switchId | 是 | 场次id | |
| callback | 是 | xx | VHWatchGiftParticipateCallback |
//参与中将 VHSaaSDK.getInstance().setWatchGiftParticipate(this.webinar_info.webinar?.id!,this.watchGiftId.id!,this.webinar_info?.interact?.room_id!,this.webinar_info?.switch_info?.switch_id!,{
onSucceed: (participateData: VHWatchGiftParticipate) => {
this.participateGift = participateData;
},
onFailure: (errorCode: number, errorMsg: string) => {
}
})
},
onFailure: (errorCode: number, errorMsg: string) => {
}
});
}| VHWatchGiftParticipate | 类型 | 备注 |
|---|---|---|
| winning | number | 是否中将 0未中奖,1 中奖 |
| award_id | number | 中奖id |
| award_name | string | 奖品名称 |
| award_img_url | string | 奖品预览地址 |
| award_desc | number | 奖品描述 |
public getWatchGiftWinnerDetail(watchGiftId: number, callback: VHWatchGiftWinnerDetailCallback)| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| watchGiftId | 是 | 观看有礼id,通过getWatchGiftLastInfo接口获得 | |
| callback | 是 | xx | VHWatchGiftWinnerDetailCallback |
VHSaaSDK.getInstance().getWatchGiftWinnerDetail(this.watchGiftId?.id!,{
onSucceed: (giftData: VHWatchGiftWinnerDetail) => {
if(giftData.can_look_winner_list == 1){
this.timeClose = "查看中奖名单"
}else{
this.timeClose = "关闭"
}
},
onFailure: (errorCode: number, errorMsg: string) => {
}
});| VHWatchGiftWinnerDetail | 类型 | 备注 |
|---|---|---|
| watch_gift_id | number | 观看有礼id |
| winner_join_id | number | 中奖者id |
| award_name | string | 奖品名称 |
| award_img_url | string | 奖品预览地址 |
| winner_award_remark | number | 是否允许查看中奖用户列表 |
| can_look_winner_list | number | 是否允许查看中奖用户列表 |
public getWatchGiftAwardSetting(webinarId: number, watchGiftId: number, callback: VHWatchGiftAwardSettingCallback)| 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| webinarId | 是 | 获得id | |
| watchGiftId | 是 | 观看有礼id,通过getWatchGiftLastInfo接口获得 | |
| callback | 是 | xx | VHWatchGiftAwardSettingCallback |
VHSaaSDK.getInstance().getWatchGiftAwardSetting(this.webinar_info?.webinar?.id!,this.watchGiftId.id!,{
onSucceed: (data: VHWatchGiftSetting)=>{
this.giftSetting = data;
if(data.receive_award_way == 1){//地址领取
if(data.receive_award_field.length > 0){
this.settingDataSource = data.receive_award_field ;
this.showSetting = true;
}
}else if(data.receive_award_way == 2){//私信
this.showQRGift = true;
}else if(data.receive_award_way == 3){//无需领奖
}
},
onFailure: (errorCode: number, errorMsg: string) =>{
}
});| VHWatchGiftSetting | 类型 | 备注 |
|---|---|---|
| receive_award_way | number | 领奖方式。 1:寄送礼品,2:私信兑奖 3:无需领奖 |
| compulsory_award | number | 强制领奖开关。 开启后,中奖用户在未完成领奖时将无法关闭中奖页面及提交领奖页 |
| receive_award_field | VHGiftAwardFiled[] | 寄送礼品,填写信息 |
public saveWatchGift(watchGiftId: number, award: string, callback: VHCallBack) | 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| watchGiftId | 是 | 观看有礼id,通过getWatchGiftLastInfo接口获得 | |
| award | 是 | 领奖信息 | |
| callback | 是 | xx | VHCallBack |
| VHGiftAwardFiled | 类型 | 备注 |
|---|---|---|
| field_value | string | 填写内容 |
| field | string | field名称 |
| field_key | string | field_key 名字 |
| is_required | boolean | 是否必填 true 必填,false 非必填 |
| is_system | number | 是否系统自带选项。1 是 0否(自定义填写内容) |
| placeholder | string | 提示语 |
| rank | number | 排列顺序 |
| is_check | number | 是否需要校验 1:需要校验 |
public getWatchGiftWinnerRank(watchGiftId: number, pos: number, limit: number, callback: VHWatchGiftWinnersCallback) | 参数名称 | 是否必须 | 示例 | 备注 |
|---|---|---|---|
| watchGiftId | 是 | 观看有礼id,通过getWatchGiftLastInfo接口获得 | |
| pos | 是 | 查询位置 | |
| limit | 是 | 查询条数 | |
| callback | 是 | xx | VHWatchGiftWinnersCallback |
VHSaaSDK.getInstance().getWatchGiftWinnerRank(this.watchGiftId?.id!,0,10,{
onSucceed: (data: VHWinner) => {
this.isShowWinnerList = true;
this.winners.updateData(data.list);
this.awardState = 4;
},
onFailure: (errorCode: number, errorMsg: string) => {
}
});| VHWinner | 类型 | 备注 |
|---|---|---|
| total | number | 中奖人数 |
| list | VHWatchGiftWinner[] | 中奖列表 |
| VHWatchGiftWinner | 类型 | 备注 |
|---|---|---|
| watch_gift_id | number | 观看有礼id |
| winner_join_id | number | 中奖者id |
| winner_nickname | string | 中奖者昵称 |
| winner_name | string | 中奖者名字 |
| winner_avatar | string | 中奖者头像 |
| webinar_id | string | 活动id |
| award_name | string | 奖品名称 |
| award_img_url | string | 奖品url |
| winner_at | string | 中奖时间 |