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:辨識QR Code,非無條件和答題抽獎必填 |
| prizeUrl | false | String | 領獎方式獎品連結,領獎方式為外鏈必填 |
| qrCode | false | String | 領獎方式QR Code連結,領獎方式為QR Code必填 |
| qrCodeTips | false | String | 領獎方式QR Code提示語,領獎方式為QR Code填寫 |
| 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:辨識QR Code, |
| prizeUrl | String | 領獎方式獎品連結 |
| qrCode | String | 領獎方式QR Code連結 |
| qrCodeTips | String | 領獎方式QR Code提示語 |
| 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:辨識QR Code |
| prizeUrl | String | 領獎方式獎品連結 |
| qrCode | String | 領獎方式QR Code連結 |
| qrCodeTips | String | 領獎方式QR Code提示語 |
| 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:辨識QR Code, 非無條件和答題抽獎必填 |
| prizeUrl | false | String | 領獎方式獎品連結, 領獎方式為外鏈必填 |
| qrCode | false | String | 領獎方式QR Code連結, 領獎方式為QR Code必填 |
| qrCodeTips | false | String | 領獎方式QR Code提示語, 領獎方式為QR Code填寫 |
| 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:掃描QR Code |
| formInfo | Array | 領獎方式表單欄位資訊【詳見ReceiveInfo參數說明】 |
| prizeUrl | String | 領獎方式獎品連結 |
| qrCode | String | 領獎方式QR Code連結 |
| qrCodeTips | String | 領獎方式QR Code提示語 |
| 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:辨識QR Code |
| formInfo | Array | 領獎方式表單欄位資訊【詳見ReceiveInfo參數描述】 |
| prizeUrl | String | 領獎方式獎品連結 |
| qrCode | String | 領獎方式QR Code連結 |
| qrCodeTips | String | 領獎方式QR Code提示語 |
| amount | Integer | 中獎人數 |
| hiddenWinnerAmount | String | 是否隱藏中獎人數 |
ReceiveInfo參數描述
| 參數名 | 類型 | 說明 |
|---|---|---|
| type | String | 類型,userName:姓名、userPhone:手機號碼、custom:自訂 |
| field | String | 欄位名稱 |
| tips | String | 提示文字 |
| required | Boolean | 是否必填,true/false |
