lotteryActivityService
1、查询抽奖活动
描述
查询抽奖活动
接口地址(仅做说明使用):https://api.polyv.net/live//v4/channel/lottery-activity/get
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testGetLotteryActivity() throws Exception, NoSuchAlgorithmException {
LiveLotteryActivityRequest liveLotteryActivityRequest = new LiveLotteryActivityRequest();
LiveLotteryActivityResponse liveLotteryActivityResponse;
try {
liveLotteryActivityRequest.setChannelId(super.createChannel()).setId(30632L);
liveLotteryActivityResponse = new LiveLotteryActivityServiceImpl().getLotteryActivity(
liveLotteryActivityRequest);
Assert.assertNotNull(liveLotteryActivityResponse);
if (liveLotteryActivityResponse != null) {
//to do something ......
log.debug("测试查询抽奖活动成功,{}", JSON.toJSONString(liveLotteryActivityResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
单元测试说明
1、请求正确,返回LiveLotteryActivityResponse对象,B端依据此对象处理业务逻辑;
2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]
3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]
请求入参描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| channelId | true | String | 频道号 |
| id | true | Long | 抽奖活动id |
| appId | false | String | POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置) |
| appSecret | false | String | POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置) |
返回对象描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| id | Long | 抽奖活动ID |
| activityName | String | 抽奖活动名称 |
| lotteryCondition | String | 抽奖类型 |
| status | String | 抽奖活动状态 |
| amount | Integer | 中奖人数 |
| hiddenWinnerAmount | String | 是否隐藏中奖人数 |
| lotteryRange | String | 参与抽奖用户类型: all:全部,customGroup:自定义分组 |
| customGroupLotteryType | String | 分组抽取方式, average:等额抽奖, random:随机抽奖 |
| customGroupLotteryAmount | Integer | 每组抽取数量 |
| hiddenAttendeeNumber | String | 是否隐藏参与人数 |
| repeatWinEnabled | String | 允许重复中奖 |
| receiveEnabled | String | 是否填写收货信息 |
| prizeName | String | 奖品名称 |
| thumbnail | String | 奖品图片 |
| activityDuration | String | 活动时长(分钟) |
| inviteType | String | 邀请方式 |
| externalListLink | String | 外部名单链接 |
| externalInviteNumLink | String | 获取邀请人数链接 |
| inviteNum | Integer | 邀请人数 |
| duration | Integer | 观看时长 |
| comment | String | 评论内容 |
| acceptType | String | 领奖方式,form:表单,link:外链,qrCode:识别二维码, |
| prizeUrl | String | 领奖方式奖品链接 |
| qrCode | String | 领奖方式二维码链接 |
| qrCodeTips | String | 领奖方式二维码提示语 |
| realPrice | BigDecimal | 优惠价格【详见BigDecimal参数描述】 |
| price | BigDecimal | 奖品原价【详见BigDecimal参数描述】 |
| questionGroupId | Long | 问答组模板ID |
| perAnswerDuration | Integer | 每道题的答题时长 |
| customGroup | Array | 自定义分组信息【详见CustomGroup参数描述】 |
| receiveInfo | Array | 收货字段信息列表,无条件抽奖时填写【详见ReceiveInfo参数描述】 |
| formInfo | Array | 领奖方式表单字段信息【详见ReceiveInfo参数描述】 |
| prizeInfo | Array | 奖品信息【详见PrizeInfo参数描述】 |
CustomGroup参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| id | Long | 分组ID |
| title | String | 分组标题 |
| type | String | 分组类型 |
| count | String | 分组人数 |
ReceiveInfo参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | String | 字段名 |
| tips | String | 提示语 |
| required | Boolean | 是否必填,true/false |
ReceiveInfo参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | String | 字段名 |
| tips | String | 提示语 |
| required | Boolean | 是否必填,true/false |
PrizeInfo参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| prizeItem | String | 奖项名称 |
| correctAnswerCount | Integer | 答对题目数 |
| prizeName | String | 奖品名称 |
| thumbnail | String | 奖品图片 |
| realPrice | BigDecimal | 优惠价格【详见BigDecimal参数描述】 |
| price | BigDecimal | 奖品原价【详见BigDecimal参数描述】 |
| acceptType | String | 领奖方式,form:表单,link:外链,qrCode:识别二维码 |
| prizeUrl | String | 领奖方式奖品链接 |
| qrCode | String | 领奖方式二维码链接 |
| qrCodeTips | String | 领奖方式二维码提示语 |
| amount | Integer | 中奖人数 |
| hiddenWinnerAmount | String | 是否隐藏中奖人数 |
| formInfo | Array | 领奖方式表单字段信息【详见ReceiveInfo参数描述】 |
ReceiveInfo参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | String | 字段名 |
| tips | String | 提示语 |
| required | Boolean | 是否必填,true/false |
2、创建抽奖活动
描述
创建抽奖活动
接口地址(仅做说明使用):https://api.polyv.net/live//v4/channel/lottery-activity/create
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testCreateLotteryActivity() throws Exception, NoSuchAlgorithmException {
LiveCreateLotteryActivityRequest liveCreateLotteryActivityRequest = new LiveCreateLotteryActivityRequest();
LiveCreateLotteryActivityResponse liveCreateLotteryActivityResponse;
try {
liveCreateLotteryActivityRequest.setChannelId(super.createChannel())
.setActivityName("polyv抽奖活动")
.setLotteryCondition("none")
.setAmount(1)
.setPrizeName("一等奖")
.setPrice(BigDecimal.valueOf(12.1))
.setRealPrice(BigDecimal.valueOf(200.33));
liveCreateLotteryActivityResponse = new LiveLotteryActivityServiceImpl().createLotteryActivity(
liveCreateLotteryActivityRequest);
Assert.assertNotNull(liveCreateLotteryActivityResponse);
if (liveCreateLotteryActivityResponse != null) {
//to do something ......
log.debug("测试创建抽奖活动成功,{}", JSON.toJSONString(liveCreateLotteryActivityResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
单元测试说明
1、请求正确,返回LiveCreateLotteryActivityResponse对象,B端依据此对象处理业务逻辑;
2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]
3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]
请求入参描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| channelId | true | String | 频道号 |
| activityName | true | String | 抽奖活动名称 |
| lotteryCondition | true | String | 抽奖活动类型, none:无条件, invite:邀请好友, duration:观看时长, comment:评论抽奖, question:答题抽奖 |
| amount | true | Integer | 中奖人数 |
| prizeName | true | String | 奖品名称 |
| hiddenWinnerAmount | false | String | 是否隐藏中奖人数, 值:Y/N, 默认N |
| lotteryRange | false | String | 参与抽奖用户类型: all:全部,customGroup:自定义分组 |
| customGroupLotteryType | false | String | 分组抽取方式, average:等额抽奖, random:随机抽奖 |
| customGroupLotteryAmount | false | Integer | 每组抽取数量 |
| hiddenAttendeeNumber | false | String | 是否隐藏参与人数, 值:Y/N, 默认N |
| repeatWinEnabled | false | String | 允许重复中奖, 值:Y/N, 默认N |
| receiveEnabled | false | String | 是否填写收货信息, 值:Y/N, 默认N |
| thumbnail | false | String | 奖品图片 |
| activityDuration | false | String | 活动时长(分钟),非无条件抽奖时必填 |
| inviteType | false | String | 邀请方式,poster:邀请海报,external:外部邀请,邀请抽奖时必填 |
| externalListLink | false | String | 外部名单链接,邀请抽奖且邀请方式为外部邀请时必填 |
| externalInviteNumLink | false | String | 获取邀请人数链接,邀请抽奖且邀请方式为外部邀请时必填 |
| inviteNum | false | Integer | 邀请人数,邀请抽奖时必填 |
| duration | false | Integer | 观看时长,观看时长抽奖时必填 |
| comment | false | String | 评论内容,评论抽奖时必填 |
| acceptType | false | String | 领奖方式,form:表单,link:外链,qrCode:识别二维码, 非无条件和答题抽奖必填 |
| prizeUrl | false | String | 领奖方式奖品链接, 领奖方式为外链必填 |
| qrCode | false | String | 领奖方式二维码链接, 领奖方式为二维码必填 |
| qrCodeTips | false | String | 领奖方式二维码提示语, 领奖方式为二维码填写 |
| realPrice | false | BigDecimal | 优惠价格【详见BigDecimal参数描述】 |
| price | false | BigDecimal | 奖品原价【详见BigDecimal参数描述】 |
| questionGroupId | false | Long | 问答组模板ID, 答题抽奖必填 |
| perAnswerDuration | false | Integer | 每道题的答题时长, 答题抽奖必填 |
| customGroupIds | false | Array | 自定义分组ID, 抽奖用户类型为自定义时有效 |
| receiveInfo | false | Array | 收货字段信息列表,无条件抽奖时填写【详见ReceiveInfo参数描述】 |
| formInfo | false | Array | 领奖方式表单字段信息, 领奖方式为表单填写【详见ReceiveInfo参数描述】 |
| prizeInfo | false | Array | 奖品信息,答题抽奖时必填【详见PrizeInfo参数描述】 |
| appId | false | String | POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置) |
| appSecret | false | String | POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置) |
ReceiveInfo参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| type | false | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | true | String | 字段名 |
| tips | true | String | 提示语 |
| required | false | Boolean | 是否必填,true/false |
ReceiveInfo参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| type | false | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | true | String | 字段名 |
| tips | true | String | 提示语 |
| required | false | Boolean | 是否必填,true/false |
PrizeInfo参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| prizeItem | true | String | 奖项名称 |
| correctAnswerCount | true | Integer | 答对题目数 |
| prizeName | true | String | 奖品名称 |
| thumbnail | false | String | 奖品图片 |
| realPrice | false | BigDecimal | 优惠价格【详见BigDecimal参数描述】 |
| price | false | BigDecimal | 奖品原价【详见BigDecimal参数描述】 |
| acceptType | true | String | 领奖方式,form:表单,link:外链,qrCode:识别二维码 |
| prizeUrl | false | String | 领奖方式奖品链接, 领奖方式为外链必填 |
| qrCode | false | String | 领奖方式二维码链接, 领奖方式为二维码必填 |
| qrCodeTips | false | String | 领奖方式二维码提示语, 领奖方式为二维码填写 |
| amount | true | Integer | 中奖人数 |
| hiddenWinnerAmount | false | String | 是否隐藏中奖人数, 值:Y/N, 默认N |
| formInfo | false | Array | 领奖方式表单字段信息, 领奖方式为表单填写【详见ReceiveInfo参数描述】 |
ReceiveInfo参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| type | false | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | true | String | 字段名 |
| tips | true | String | 提示语 |
| required | false | Boolean | 是否必填,true/false |
返回对象描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| id | Long | 抽奖活动ID |
| activityName | String | 抽奖活动名称 |
| lotteryCondition | String | 抽奖类型 |
| status | String | 抽奖活动状态 |
| amount | Integer | 中奖人数 |
| hiddenWinnerAmount | String | 是否隐藏中奖人数 |
| lotteryRange | String | 参与抽奖用户类型: all:全部,customGroup:自定义分组 |
| customGroupLotteryType | String | 分组抽取方式, average:等额抽奖, random:随机抽奖 |
| customGroupLotteryAmount | Integer | 每组抽取数量 |
| hiddenAttendeeNumber | String | 是否隐藏参与人数 |
| repeatWinEnabled | String | 允许重复中奖 |
| receiveEnabled | String | 是否填写收货信息 |
| prizeName | String | 奖品名称 |
| thumbnail | String | 奖品图片 |
| activityDuration | String | 活动时长(分钟) |
| inviteType | String | 邀请方式 |
| externalListLink | String | 外部名单链接 |
| externalInviteNumLink | String | 获取邀请人数链接 |
| inviteNum | Integer | 邀请人数 |
| duration | Integer | 观看时长 |
| comment | String | 评论内容 |
| acceptType | String | 领奖方式,form:表单,link:外链,qrCode:识别二维码, |
| prizeUrl | String | 领奖方式奖品链接 |
| qrCode | String | 领奖方式二维码链接 |
| qrCodeTips | String | 领奖方式二维码提示语 |
| realPrice | BigDecimal | 优惠价格【详见BigDecimal参数描述】 |
| price | BigDecimal | 奖品原价【详见BigDecimal参数描述】 |
| questionGroupId | Long | 问答组模板ID |
| perAnswerDuration | Integer | 每道题的答题时长 |
| customGroup | Array | 自定义分组信息【详见CustomGroup参数描述】 |
| receiveInfo | Array | 收货字段信息列表,无条件抽奖时填写【详见ReceiveInfo参数描述】 |
| formInfo | Array | 领奖方式表单字段信息【详见ReceiveInfo参数描述】 |
| prizeInfo | Array | 奖品信息【详见PrizeInfo参数描述】 |
CustomGroup参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| id | Long | 分组ID |
| title | String | 分组标题 |
| type | String | 分组类型 |
| count | String | 分组人数 |
ReceiveInfo参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | String | 字段名 |
| tips | String | 提示语 |
| required | Boolean | 是否必填,true/false |
ReceiveInfo参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | String | 字段名 |
| tips | String | 提示语 |
| required | Boolean | 是否必填,true/false |
PrizeInfo参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| prizeItem | String | 奖项名称 |
| correctAnswerCount | Integer | 答对题目数 |
| prizeName | String | 奖品名称 |
| thumbnail | String | 奖品图片 |
| realPrice | BigDecimal | 优惠价格【详见BigDecimal参数描述】 |
| price | BigDecimal | 奖品原价【详见BigDecimal参数描述】 |
| acceptType | String | 领奖方式,form:表单,link:外链,qrCode:识别二维码 |
| prizeUrl | String | 领奖方式奖品链接 |
| qrCode | String | 领奖方式二维码链接 |
| qrCodeTips | String | 领奖方式二维码提示语 |
| amount | Integer | 中奖人数 |
| hiddenWinnerAmount | String | 是否隐藏中奖人数 |
| formInfo | Array | 领奖方式表单字段信息【详见ReceiveInfo参数描述】 |
ReceiveInfo参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | String | 字段名 |
| tips | String | 提示语 |
| required | Boolean | 是否必填,true/false |
3、更新抽奖活动
描述
更新抽奖活动
接口地址(仅做说明使用):https://api.polyv.net/live//v4/channel/lottery-activity/update
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testUpdateLotteryActivity() throws Exception, NoSuchAlgorithmException {
LiveUpdateLotteryActivityRequest liveUpdateLotteryActivityRequest = new LiveUpdateLotteryActivityRequest();
Boolean liveUpdateLotteryActivityResponse;
try {
liveUpdateLotteryActivityRequest.setChannelId(super.createChannel())
.setId(30951L)
.setActivityName("polyv抽奖活动")
.setLotteryCondition("none")
.setAmount(2)
.setPrizeName("2等奖");
liveUpdateLotteryActivityResponse = new LiveLotteryActivityServiceImpl().updateLotteryActivity(
liveUpdateLotteryActivityRequest);
Assert.assertNotNull(liveUpdateLotteryActivityResponse);
if (liveUpdateLotteryActivityResponse != null) {
//to do something ......
log.debug("更新抽奖活动成功,{}", JSON.toJSONString(liveUpdateLotteryActivityResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
单元测试说明
1、请求正确,返回Boolean对象,B端依据此对象处理业务逻辑;
2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]
3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]
请求入参描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| channelId | true | String | 频道号 |
| id | true | Long | 抽奖活动ID |
| activityName | true | String | 抽奖活动名称 |
| lotteryCondition | true | String | 抽奖活动类型, none:无条件, invite:邀请好友, duration:观看时长, comment:评论抽奖, question:答题抽奖 |
| amount | true | Integer | 中奖人数 |
| hiddenWinnerAmount | false | String | 是否隐藏中奖人数, 值:Y/N, 默认N |
| lotteryRange | false | String | 参与抽奖用户类型: all:全部,customGroup:自定义分组 |
| customGroupLotteryType | false | String | 分组抽取方式, average:等额抽奖, random:随机抽奖 |
| customGroupLotteryAmount | false | Integer | 每组抽取数量 |
| hiddenAttendeeNumber | false | String | 是否隐藏参与人数, 值:Y/N, 默认N |
| repeatWinEnabled | false | String | 允许重复中奖, 值:Y/N, 默认N |
| receiveEnabled | false | String | 是否填写收货信息, 值:Y/N, 默认N |
| prizeName | true | String | 奖品名称 |
| thumbnail | false | String | 奖品图片 |
| activityDuration | false | String | 活动时长(分钟),非无条件抽奖时必填 |
| inviteType | false | String | 邀请方式,poster:邀请海报,external:外部邀请,邀请抽奖时必填 |
| externalListLink | false | String | 外部名单链接,邀请抽奖且邀请方式为外部邀请时必填 |
| externalInviteNumLink | false | String | 获取邀请人数链接,邀请抽奖且邀请方式为外部邀请时必填 |
| inviteNum | false | Integer | 邀请人数,邀请抽奖时必填 |
| duration | false | Integer | 观看时长,观看时长抽奖时必填 |
| comment | false | String | 评论内容,评论抽奖时必填 |
| acceptType | false | String | 领奖方式,form:表单,link:外链,qrCode:识别二维码, 非无条件和答题抽奖必填 |
| prizeUrl | false | String | 领奖方式奖品链接, 领奖方式为外链必填 |
| qrCode | false | String | 领奖方式二维码链接, 领奖方式为二维码必填 |
| qrCodeTips | false | String | 领奖方式二维码提示语, 领奖方式为二维码填写 |
| realPrice | false | BigDecimal | 优惠价格【详见BigDecimal参数描述】 |
| price | false | BigDecimal | 奖品原价【详见BigDecimal参数描述】 |
| questionGroupId | false | Long | 问答组模板ID, 答题抽奖必填 |
| perAnswerDuration | false | Integer | 每道题的答题时长, 答题抽奖必填 |
| receiveInfo | false | Array | 收货字段信息列表,无条件抽奖时填写【详见ReceiveInfo参数描述】 |
| formInfo | false | Array | 领奖方式表单字段信息, 领奖方式为表单填写【详见ReceiveInfo参数描述】 |
| prizeInfo | false | Array | 奖品信息,答题抽奖时必填【详见PrizeInfo参数描述】 |
| appId | false | String | POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置) |
| appSecret | false | String | POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置) |
ReceiveInfo参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| type | false | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | true | String | 字段名 |
| tips | true | String | 提示语 |
| required | false | Boolean | 是否必填,true/false |
ReceiveInfo参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| type | false | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | true | String | 字段名 |
| tips | true | String | 提示语 |
| required | false | Boolean | 是否必填,true/false |
PrizeInfo参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| prizeItem | true | String | 奖项名称 |
| correctAnswerCount | true | Integer | 答对题目数 |
| prizeName | true | String | 奖品名称 |
| thumbnail | false | String | 奖品图片 |
| realPrice | false | BigDecimal | 优惠价格【详见BigDecimal参数描述】 |
| price | false | BigDecimal | 奖品原价【详见BigDecimal参数描述】 |
| acceptType | true | String | 领奖方式,form:表单,link:外链,qrCode:识别二维码 |
| prizeUrl | false | String | 领奖方式奖品链接, 领奖方式为外链必填 |
| qrCode | false | String | 领奖方式二维码链接, 领奖方式为二维码必填 |
| qrCodeTips | false | String | 领奖方式二维码提示语, 领奖方式为二维码填写 |
| amount | true | Integer | 中奖人数 |
| hiddenWinnerAmount | false | String | 是否隐藏中奖人数, 值:Y/N, 默认N |
| formInfo | false | Array | 领奖方式表单字段信息, 领奖方式为表单填写【详见ReceiveInfo参数描述】 |
ReceiveInfo参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| type | false | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | true | String | 字段名 |
| tips | true | String | 提示语 |
| required | false | Boolean | 是否必填,true/false |
返回对象描述
null
4、删除抽奖活动
描述
删除抽奖活动
接口地址(仅做说明使用):https://api.polyv.net/live//v4/channel/lottery-activity/delete
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testDeleteLotteryActivity() throws Exception, NoSuchAlgorithmException {
LiveDeleteLotteryActivityRequest liveDeleteLotteryActivityRequest = new LiveDeleteLotteryActivityRequest();
Boolean liveDeleteLotteryActivityResponse;
try {
liveDeleteLotteryActivityRequest.setChannelId(super.createChannel())
.setId(30951L);
liveDeleteLotteryActivityResponse = new LiveLotteryActivityServiceImpl().deleteLotteryActivity(
liveDeleteLotteryActivityRequest);
Assert.assertNotNull(liveDeleteLotteryActivityResponse);
if (liveDeleteLotteryActivityResponse != null) {
//to do something ......
log.debug("删除抽奖活动成功,{}", JSON.toJSONString(liveDeleteLotteryActivityResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
单元测试说明
1、请求正确,返回Boolean对象,B端依据此对象处理业务逻辑;
2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]
3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]
请求入参描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| channelId | true | String | 频道号 |
| id | true | Long | 抽奖活动id |
| appId | false | String | POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置) |
| appSecret | false | String | POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置) |
返回对象描述
null
5、查询抽奖活动列表
描述
查询抽奖活动列表
接口地址(仅做说明使用):https://api.polyv.net/live//v4/channel/lottery-activity/list
调用约束
1、接口调用有频率限制,详细请查看,调用常见异常,详细请查看
单元测试
@Test
public void testListLotteryActivity() throws IOException, NoSuchAlgorithmException {
LiveLotteryActivityListRequest liveLotteryActivityListRequest = new LiveLotteryActivityListRequest();
LiveLotteryActivityListPageResponse liveLotteryActivityListPageResponse;
try {
liveLotteryActivityListRequest.setChannelId(super.createChannel()).setPageSize(2);
liveLotteryActivityListPageResponse = new LiveLotteryActivityServiceImpl().listLotteryActivity(
liveLotteryActivityListRequest);
Assert.assertNotNull(liveLotteryActivityListPageResponse);
if (liveLotteryActivityListPageResponse != null) {
//to do something ......
log.debug("查询抽奖活动列表成功,{}", JSON.toJSONString(liveLotteryActivityListPageResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
}
单元测试说明
1、请求正确,返回LiveLotteryActivityListPageResponse对象,B端依据此对象处理业务逻辑;
2、请求参数校验不合格,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 输入参数 [xxx.chat.LivexxxRequest]对象校验失败,失败字段 [pic不能为空 / msg不能为空] ]
3、服务器处理异常,抛出PloyvSdkException,错误信息见PloyvSdkException.getMessage(),如 [ 保利威请求返回数据错误,请求流水号:66e7ad29fd04425a84c2b2b562d2025b,错误原因: invalid signature. ]
请求入参描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| channelId | true | String | 频道号 |
| currentPage | false | Integer | 页数,默认为1【对应api文档的pageNumber字段】 |
| pageSize | false | Integer | 每页显示的数据条数,默认每页显示20条数据 |
| appId | false | String | POLYV用户APP_ID,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置) |
| appSecret | false | String | POLYV用户APP_SECRET,多账号调用时该参数必填(即调用了initMultiAccount()设置多账号调用),通过注册保利威官网获取,路径:官网->登录->直播(开发设置) |
返回对象描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| contents | Array | 查询的结果列表【详见LiveLotteryActivityList参数描述】 |
| pageSize | Integer | 每页显示的数据条数,默认每页显示20条数据 |
| currentPage | Integer | 当前页【对应api文档的pageNumber字段】 |
| totalItems | Integer | 记录总条数 |
| totalPage | Integer | 总页数【对应api文档的totalPages字段】 |
LiveLotteryActivityList参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| id | Long | 抽奖活动ID |
| activityName | String | 抽奖活动名称 |
| lotteryCondition | String | 抽奖类型 |
| status | String | 抽奖活动状态 |
| amount | Integer | 中奖人数 |
| hiddenWinnerAmount | String | 是否隐藏中奖人数 |
| lotteryRange | String | 参与抽奖用户类型: all:全部,customGroup:自定义分组 |
| customGroup | Array | 自定义分组信息【详见CustomGroup参数描述】 |
| customGroupLotteryType | String | 分组抽取方式, average:等额抽奖, random:随机抽奖 |
| customGroupLotteryAmount | Integer | 每组抽取数量 |
| hiddenAttendeeNumber | String | 是否隐藏参与人数 |
| repeatWinEnabled | String | 允许重复中奖 |
| receiveEnabled | String | 是否填写收货信息 |
| receiveInfo | Array | 收货字段信息列表,无条件抽奖时填写【详见ReceiveInfo参数描述】 |
| prizeName | String | 奖品名称 |
| thumbnail | String | 奖品图片 |
| activityDuration | String | 活动时长(分钟) |
| inviteType | String | 邀请方式 |
| externalListLink | String | 外部名单链接 |
| externalInviteNumLink | String | 获取邀请人数链接 |
| inviteNum | Integer | 邀请人数 |
| duration | Integer | 观看时长 |
| comment | String | 评论内容 |
| acceptType | String | 领奖方式,form:表单,link:外链,qrCode:识别二维码, |
| formInfo | Array | 领奖方式表单字段信息【详见ReceiveInfo参数描述】 |
| prizeUrl | String | 领奖方式奖品链接 |
| qrCode | String | 领奖方式二维码链接 |
| qrCodeTips | String | 领奖方式二维码提示语 |
| realPrice | BigDecimal | 优惠价格【详见BigDecimal参数描述】 |
| price | BigDecimal | 奖品原价【详见BigDecimal参数描述】 |
| prizeInfo | Array | 奖品信息【详见PrizeInfo参数描述】 |
| questionGroupId | Long | 问答组模板ID |
| perAnswerDuration | Integer | 每道题的答题时长 |
CustomGroup参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| id | Long | 分组ID |
| title | String | 分组标题 |
| type | String | 分组类型 |
| count | String | 分组人数 |
ReceiveInfo参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | String | 字段名 |
| tips | String | 提示语 |
| required | Boolean | 是否必填,true/false |
ReceiveInfo参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | String | 字段名 |
| tips | String | 提示语 |
| required | Boolean | 是否必填,true/false |
PrizeInfo参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| prizeItem | String | 奖项名称 |
| correctAnswerCount | Integer | 答对题目数 |
| prizeName | String | 奖品名称 |
| thumbnail | String | 奖品图片 |
| realPrice | BigDecimal | 优惠价格【详见BigDecimal参数描述】 |
| price | BigDecimal | 奖品原价【详见BigDecimal参数描述】 |
| acceptType | String | 领奖方式,form:表单,link:外链,qrCode:识别二维码 |
| formInfo | Array | 领奖方式表单字段信息【详见ReceiveInfo参数描述】 |
| prizeUrl | String | 领奖方式奖品链接 |
| qrCode | String | 领奖方式二维码链接 |
| qrCodeTips | String | 领奖方式二维码提示语 |
| amount | Integer | 中奖人数 |
| hiddenWinnerAmount | String | 是否隐藏中奖人数 |
ReceiveInfo参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| type | String | 类型, userName:姓名、userPhone:手机号、custom:自定义 |
| field | String | 字段名 |
| tips | String | 提示语 |
| required | Boolean | 是否必填,true/false |
