Polyv Help Center

Help Center

lotteryActivityService

Updated: 2025-09-11 15:18:09

1. Query Lottery Activity

Description

查询抽奖活动
接口地址(仅做说明使用):https://api.polyv.net/live//v4/channel/lottery-activity/get

Call Constraints

  1. The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @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;
        }
    }

Unit Testing Instructions

  1. If the request is correct, a LiveLotteryActivityResponse object is returned. The B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. See PloyvSdkException.getMessage() for error details, e.g., [ Validation failed for input parameter [xxx.chat.LivexxxRequest] object, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
id true Long Lottery activity ID
appId false String POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings)
appSecret false String POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings)

Return Object Description

Parameter Name Type Description
id Long Lottery activity ID
activityName String Lottery activity name
lotteryCondition String Lottery type
status String Lottery activity status
amount Integer Number of winners
hiddenWinnerAmount String Whether to hide the number of winners
lotteryRange String User type participating in the lottery: all: all users, customGroup: custom group
customGroupLotteryType String Group drawing method, average: equal drawing, random: random drawing
customGroupLotteryAmount Integer Number drawn per group
hiddenAttendeeNumber String Whether to hide the number of participants
repeatWinEnabled String Allow repeated winning
receiveEnabled String Whether to fill in shipping information
prizeName String Prize name
thumbnail String Prize image
activityDuration String Activity duration (minutes)
inviteType String Invitation method
externalListLink String External list link
externalInviteNumLink String Link to get the number of invitees
inviteNum Integer Number of invitees
duration Integer Viewing duration
comment String Comment content
acceptType String Prize claim method, form: form, link: external link, qrCode: QR code
prizeUrl String Prize link for prize claim method
qrCode String QR code link for prize claim method
qrCodeTips String QR code prompt for prize claim method
realPrice BigDecimal Discounted price [See BigDecimal Parameter Description for details]
price BigDecimal Original prize price [See BigDecimal Parameter Description for details]
questionGroupId Long Question group template ID
perAnswerDuration Integer Answer duration per question
customGroup Array Custom group information [See CustomGroup Parameter Description for details]
receiveInfo Array Shipping field information list, filled in for unconditional lottery [See ReceiveInfo Parameter Description for details]
formInfo Array Prize claim method form field information [See ReceiveInfo Parameter Description for details]
prizeInfo Array Prize information [See PrizeInfo Parameter Description for details]
CustomGroup Parameter Description
Parameter Type Description
id Long Group ID
title String Group title
type String Group type
count String Number of group members
ReceiveInfo Parameter Description
Parameter Type Description
type String Type: userName (name), userPhone (phone number), custom (custom)
field String Field name
tips String Prompt text
required Boolean Whether required: true/false
ReceiveInfo Parameter Description
Parameter Type Description
type String Type: userName (name), userPhone (phone number), custom (custom)
field String Field name
tips String Prompt text
required Boolean Whether required, true/false
PrizeInfo Parameter Description
Parameter Name Type Description
prizeItem String Prize item name
correctAnswerCount Integer Number of correct answers
prizeName String Prize name
thumbnail String Prize image
realPrice BigDecimal Discounted price [See BigDecimal Parameter Description for details]
price BigDecimal Original prize price [See BigDecimal Parameter Description for details]
acceptType String Prize claim method: form (form), link (external link), qrCode (QR code)
prizeUrl String Prize link for claim method
qrCode String QR code link for claim method
qrCodeTips String QR code prompt text for claim method
amount Integer Number of winners
hiddenWinnerAmount String Whether to hide the number of winners
formInfo Array Form field information for claim method [See ReceiveInfo Parameter Description for details]
ReceiveInfo Parameter Description
Parameter Type Description
type String Type: userName (name), userPhone (phone number), custom (custom)
field String Field name
tips String Prompt text
required Boolean Whether required, true/false






2. Creating a Lucky Draw Event

Description

创建抽奖活动
接口地址(仅做说明使用):https://api.polyv.net/live//v4/channel/lottery-activity/create

Call Constraints

  1. The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @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;
        }
    }

Unit Testing Instructions

  1. If the request is correct, a LiveCreateLotteryActivityResponse object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID
activityName true String Lottery activity name
lotteryCondition true String Lottery activity type: none (unconditional), invite (invite friends), duration (watch duration), comment (comment lottery), question (quiz lottery)
amount true Integer Number of winners
prizeName true String Prize name
hiddenWinnerAmount false String Whether to hide the number of winners: Y/N, default N
lotteryRange false String User type for lottery participation: all (all), customGroup (custom group)
customGroupLotteryType false String Group drawing method: average (equal drawing), random (random drawing)
customGroupLotteryAmount false Integer Number of draws per group
hiddenAttendeeNumber false String Whether to hide the number of participants: Y/N, default N
repeatWinEnabled false String Allow repeated winning: Y/N, default N
receiveEnabled false String Whether to fill in shipping information: Y/N, default N
thumbnail false String Prize image
activityDuration false String Activity duration (minutes), required for non-unconditional lotteries
inviteType false String Invitation method: poster (invitation poster), external (external invitation), required for invitation lotteries
externalListLink false String External list link, required for invitation lotteries with external invitation method
externalInviteNumLink false String Link to get the number of invited users, required for invitation lotteries with external invitation method
inviteNum false Integer Number of invited users, required for invitation lotteries
duration false Integer Watch duration, required for watch duration lotteries
comment false String Comment content, required for comment lotteries
acceptType false String Prize claim method: form (form), link (external link), qrCode (QR code), required for non-unconditional and non-quiz lotteries
prizeUrl false String Prize claim link, required when the claim method is external link
qrCode false String QR code link for prize claim, required when the claim method is QR code
qrCodeTips false String QR code prompt text for prize claim, filled when the claim method is QR code
realPrice false BigDecimal Discounted price [See BigDecimal Parameter Description]
price false BigDecimal Original prize price [See BigDecimal Parameter Description]
questionGroupId false Long Quiz group template ID, required for quiz lotteries
perAnswerDuration false Integer Answer duration per question, required for quiz lotteries
customGroupIds false Array Custom group IDs, valid when the lottery user type is custom
receiveInfo false Array Shipping field information list, filled for unconditional lotteries [See ReceiveInfo Parameter Description]
formInfo false Array Prize claim form field information, filled when the claim method is form [See ReceiveInfo Parameter Description]
prizeInfo false Array Prize information, required for quiz lotteries [See PrizeInfo Parameter Description]
appId false String POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set multi-account calls). Obtained by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings)
appSecret false String POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set multi-account calls). Obtained by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings)
ReceiveInfo Parameter Description
Parameter Required Type Description
type false String Type: userName (name), userPhone (phone number), custom (custom)
field true String Field name
tips true String Prompt text
required false Boolean Whether required, true/false
ReceiveInfo Parameter Description
Parameter Required Type Description
type false String Type: userName (name), userPhone (phone number), custom (custom)
field true String Field name
tips true String Prompt text
required false Boolean Whether required, true/false
PrizeInfo Parameter Description
Parameter Name Required Type Description
prizeItem true String Prize item name
correctAnswerCount true Integer Number of correct answers
prizeName true String Prize name
thumbnail false String Prize image
realPrice false BigDecimal Discounted price [See BigDecimal parameter description for details]
price false BigDecimal Original prize price [See BigDecimal parameter description for details]
acceptType true String Prize claim method: form (form), link (external link), qrCode (QR code scan)
prizeUrl false String Prize link for claim method, required when claim method is external link
qrCode false String QR code link for claim method, required when claim method is QR code
qrCodeTips false String QR code prompt text for claim method, filled when claim method is QR code
amount true Integer Number of winners
hiddenWinnerAmount false String Whether to hide the number of winners, values: Y/N, default N
formInfo false Array Form field information for claim method, filled when claim method is form [See ReceiveInfo parameter description for details]
ReceiveInfo Parameter Description
Parameter Required Type Description
type false String Type: userName (name), userPhone (phone number), custom (custom)
field true String Field name
tips true String Prompt text
required false Boolean Whether required, true/false

Return Object Description

Parameter Name Type Description
id Long Lottery activity ID
activityName String Lottery activity name
lotteryCondition String Lottery type
status String Lottery activity status
amount Integer Number of winners
hiddenWinnerAmount String Whether to hide the number of winners
lotteryRange String User type for lottery participation: all: all users, customGroup: custom group
customGroupLotteryType String Group drawing method, average: equal drawing, random: random drawing
customGroupLotteryAmount Integer Number drawn per group
hiddenAttendeeNumber String Whether to hide the number of participants
repeatWinEnabled String Allow repeated winning
receiveEnabled String Whether to fill in shipping information
prizeName String Prize name
thumbnail String Prize image
activityDuration String Activity duration (minutes)
inviteType String Invitation method
externalListLink String External list link
externalInviteNumLink String Link to get the number of invitees
inviteNum Integer Number of invitees
duration Integer Viewing duration
comment String Comment content
acceptType String Prize claim method, form: form, link: external link, qrCode: QR code
prizeUrl String Prize link for claim method
qrCode String QR code link for claim method
qrCodeTips String QR code prompt for claim method
realPrice BigDecimal Discounted price [See BigDecimal Parameter Description]
price BigDecimal Original prize price [See BigDecimal Parameter Description]
questionGroupId Long Question group template ID
perAnswerDuration Integer Answer duration per question
customGroup Array Custom group information [See CustomGroup Parameter Description]
receiveInfo Array Shipping field information list, filled in for unconditional lottery [See ReceiveInfo Parameter Description]
formInfo Array Form field information for prize claim method [See ReceiveInfo Parameter Description]
prizeInfo Array Prize information [See PrizeInfo Parameter Description]
CustomGroup Parameter Description
Parameter Type Description
id Long Group ID
title String Group title
type String Group type
count String Number of group members
ReceiveInfo Parameter Description
Parameter Type Description
type String Type: userName (name), userPhone (phone number), custom (custom)
field String Field name
tips String Prompt text
required Boolean Whether required: true/false
ReceiveInfo Parameter Description
Parameter Type Description
type String Type: userName (name), userPhone (phone number), custom (custom)
field String Field name
tips String Prompt text
required Boolean Whether required, true/false
PrizeInfo Parameter Description
Parameter Name Type Description
prizeItem String Prize item name
correctAnswerCount Integer Number of correct answers
prizeName String Prize name
thumbnail String Prize image
realPrice BigDecimal Discounted price [See BigDecimal parameter description for details]
price BigDecimal Original prize price [See BigDecimal parameter description for details]
acceptType String Prize claim method: form (form), link (external link), qrCode (QR code)
prizeUrl String Prize link for the claim method
qrCode String QR code link for the claim method
qrCodeTips String QR code prompt text for the claim method
amount Integer Number of winners
hiddenWinnerAmount String Whether to hide the number of winners
formInfo Array Form field information for the claim method [See ReceiveInfo parameter description for details]
ReceiveInfo Parameter Description
Parameter Type Description
type String Type: userName (name), userPhone (phone number), custom (custom)
field String Field name
tips String Prompt text
required Boolean Whether required: true/false






3. Update Lottery Activity

Description

更新抽奖活动
接口地址(仅做说明使用):https://api.polyv.net/live//v4/channel/lottery-activity/update

Call Constraints

  1. The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @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;
        }
    }

Unit Testing Instructions

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. See PloyvSdkException.getMessage() for error details, e.g., [ Validation failed for input parameter [xxx.chat.LivexxxRequest] object, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
id true Long Lottery activity ID
activityName true String Lottery activity name
lotteryCondition true String Lottery activity type: none (unconditional), invite (invite friends), duration (watch duration), comment (comment lottery), question (quiz lottery)
amount true Integer Number of winners
hiddenWinnerAmount false String Whether to hide the number of winners: Y/N, default N
lotteryRange false String User type for lottery participation: all (all), customGroup (custom group)
customGroupLotteryType false String Group drawing method: average (equal drawing), random (random drawing)
customGroupLotteryAmount false Integer Number drawn per group
hiddenAttendeeNumber false String Whether to hide the number of participants: Y/N, default N
repeatWinEnabled false String Allow repeated winning: Y/N, default N
receiveEnabled false String Whether to fill in shipping information: Y/N, default N
prizeName true String Prize name
thumbnail false String Prize image
activityDuration false String Activity duration (minutes), required for non-unconditional lotteries
inviteType false String Invitation method: poster (invitation poster), external (external invitation), required for invitation lotteries
externalListLink false String External list link, required for invitation lotteries with external invitation method
externalInviteNumLink false String Link to get the number of invited people, required for invitation lotteries with external invitation method
inviteNum false Integer Number of invited people, required for invitation lotteries
duration false Integer Watch duration, required for watch duration lotteries
comment false String Comment content, required for comment lotteries
acceptType false String Prize claim method: form (form), link (external link), qrCode (QR code), required for non-unconditional and non-quiz lotteries
prizeUrl false String Prize link for the prize claim method, required when the method is external link
qrCode false String QR code link for the prize claim method, required when the method is QR code
qrCodeTips false String QR code prompt text for the prize claim method, filled when the method is QR code
realPrice false BigDecimal Discounted price [See BigDecimal Parameter Description]
price false BigDecimal Original prize price [See BigDecimal Parameter Description]
questionGroupId false Long Quiz group template ID, required for quiz lotteries
perAnswerDuration false Integer Duration per question, required for quiz lotteries
receiveInfo false Array List of shipping field information, filled for unconditional lotteries [See ReceiveInfo Parameter Description]
formInfo false Array Form field information for the prize claim method, filled when the method is form [See ReceiveInfo Parameter Description]
prizeInfo false Array Prize information, required for quiz lotteries [See PrizeInfo Parameter Description]
appId false String POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called for multi-account setup). Obtain by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings)
appSecret false String POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called for multi-account setup). Obtain by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings)
ReceiveInfo Parameter Description
Parameter Required Type Description
type false String Type: userName (name), userPhone (phone number), custom (custom)
field true String Field name
tips true String Prompt text
required false Boolean Whether required, true/false
ReceiveInfo Parameter Description
Parameter Required Type Description
type false String Type: userName (name), userPhone (phone number), custom (custom)
field true String Field name
tips true String Prompt text
required false Boolean Whether required, true/false
PrizeInfo Parameter Description
Parameter Required Type Description
prizeItem true String Prize item name
correctAnswerCount true Integer Number of correct answers
prizeName true String Prize name
thumbnail false String Prize image
realPrice false BigDecimal Discounted price [See BigDecimal parameter description for details]
price false BigDecimal Original prize price [See BigDecimal parameter description for details]
acceptType true String Prize claim method: form (form), link (external link), qrCode (QR code)
prizeUrl false String Prize link for claim method; required when claim method is external link
qrCode false String QR code link for claim method; required when claim method is QR code
qrCodeTips false String QR code prompt text for claim method; filled when claim method is QR code
amount true Integer Number of winners
hiddenWinnerAmount false String Whether to hide the number of winners; values: Y/N, default N
formInfo false Array Form field information for claim method; filled when claim method is form [See ReceiveInfo parameter description for details]
ReceiveInfo Parameter Description
Parameter Required Type Description
type false String Type: userName (name), userPhone (phone number), custom (custom)
field true String Field name
tips true String Prompt text
required false Boolean Whether required: true/false

Return Object Description

null




4. Delete Lottery Activity

Description

删除抽奖活动
接口地址(仅做说明使用):https://api.polyv.net/live//v4/channel/lottery-activity/delete

Call Constraints

  1. The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @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;
        }
    }

Unit Testing Instructions

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
id true Long Lottery activity ID
appId false String POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings)
appSecret false String POLYV user APP_SECRET, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings)

Return Object Description

null




5. Query Lottery Activity List

Description

查询抽奖活动列表
接口地址(仅做说明使用):https://api.polyv.net/live//v4/channel/lottery-activity/list

Call Constraints

  1. The API call has a frequency limit. For details, see here. For common call exceptions, see here.

Unit Testing

    @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;
        }
    }
}

Unit Testing Instructions

  1. If the request is correct, a LiveLotteryActivityListPageResponse object is returned. The B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. See PloyvSdkException.getMessage() for error details, e.g., [ Validation failed for input parameter [xxx.chat.LivexxxRequest] object, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
currentPage false Integer Page number, defaults to 1 (corresponds to the pageNumber field in the API documentation)
pageSize false Integer Number of data items displayed per page, defaults to 20
appId false String POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings)
appSecret false String POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings)

Return Object Description

Parameter Type Description
contents Array Query result list See LiveLotteryActivityList parameter description
pageSize Integer Number of data items displayed per page, default is 20 items per page
currentPage Integer Current page [Corresponds to the pageNumber field in the API documentation]
totalItems Integer Total number of records
totalPage Integer Total number of pages [Corresponds to the totalPages field in the API documentation]
LiveLotteryActivityList Parameter Description
Parameter Name Type Description
id Long Lottery activity ID
activityName String Lottery activity name
lotteryCondition String Lottery type
status String Lottery activity status
amount Integer Number of winners
hiddenWinnerAmount String Whether to hide the number of winners
lotteryRange String User type for lottery participation: all: all users, customGroup: custom group
customGroup Array Custom group information [See CustomGroup Parameter Description]
customGroupLotteryType String Group drawing method, average: equal draw, random: random draw
customGroupLotteryAmount Integer Number of draws per group
hiddenAttendeeNumber String Whether to hide the number of participants
repeatWinEnabled String Allow repeated winning
receiveEnabled String Whether to fill in shipping information
receiveInfo Array Shipping field information list, filled in for unconditional lottery [See ReceiveInfo Parameter Description]
prizeName String Prize name
thumbnail String Prize image
activityDuration String Activity duration (minutes)
inviteType String Invitation method
externalListLink String External list link
externalInviteNumLink String Link to get invitation count
inviteNum Integer Number of invitations
duration Integer Viewing duration
comment String Comment content
acceptType String Prize claim method, form: form, link: external link, qrCode: scan QR code
formInfo Array Prize claim method form field information [See ReceiveInfo Parameter Description]
prizeUrl String Prize claim method prize link
qrCode String Prize claim method QR code link
qrCodeTips String Prize claim method QR code prompt
realPrice BigDecimal Discounted price [See BigDecimal Parameter Description]
price BigDecimal Original prize price [See BigDecimal Parameter Description]
prizeInfo Array Prize information [See PrizeInfo Parameter Description]
questionGroupId Long Q&A group template ID
perAnswerDuration Integer Answer duration per question
CustomGroup Parameter Description
Parameter Type Description
id Long Group ID
title String Group title
type String Group type
count String Number of group members
ReceiveInfo Parameter Description
Parameter Type Description
type String Type: userName (name), userPhone (phone number), custom (custom)
field String Field name
tips String Prompt text
required Boolean Whether required, true/false
ReceiveInfo Parameter Description
Parameter Type Description
type String Type: userName (name), userPhone (phone number), custom (custom)
field String Field name
tips String Prompt text
required Boolean Whether required, true/false
PrizeInfo Parameter Description
Parameter Name Type Description
prizeItem String Prize item name
correctAnswerCount Integer Number of correct answers
prizeName String Prize name
thumbnail String Prize image
realPrice BigDecimal Discounted price [See BigDecimal parameter description for details]
price BigDecimal Original prize price [See BigDecimal parameter description for details]
acceptType String Prize claim method: form (form), link (external link), qrCode (QR code)
formInfo Array Form field information for prize claim method [See ReceiveInfo parameter description for details]
prizeUrl String Prize link for claim method
qrCode String QR code link for claim method
qrCodeTips String QR code prompt text for claim method
amount Integer Number of winners
hiddenWinnerAmount String Whether to hide the number of winners
ReceiveInfo Parameter Description
Parameter Type Description
type String Type: userName (name), userPhone (phone number), custom (custom)
field String Field name
tips String Prompt text
required Boolean Whether required, true/false

联系客服,在线咨询