Copy 1、查询频道发起抽奖记录
2、接口支持https协议
Copy http://api.polyv.net/live/v4/channel/lottery/list
Copy http://api.polyv.net/live/v4/channel/lottery/list?appId=frlr1zazn3&sign=CD02AC6E60EE047E7B491C8CB32D23AD&startTime=1629679376000&endTime=1661215376000&channelId=2974342×tamp=1661480931047
强烈建议您使用直播Java SDK 完成API的功能对接,直播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
Copy private static final Logger log = LoggerFactory . getLogger ( getClass() );
/**
* 查询频道中奖统计记录
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@ Test
public void getLotteryListTest() throws IOException , NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super . appId ;
String appSecret = super . appSecret ;
String timestamp = String . valueOf ( System . currentTimeMillis ());
//业务参数
String url = "http://api.polyv.net/live/v4/channel/lottery/list" ;
String channelId = "2974342" ;
String lotteryId = "gcfflpd4ex" ;
String sessionId = "" ;
String startTime = "" ;
String endTime = "" ;
//http 调用逻辑
Map < String , String > requestMap = new HashMap <>();
requestMap . put ( "appId" , appId);
requestMap . put ( "timestamp" , timestamp);
requestMap . put ( "channelId" , channelId);
requestMap . put ( "lotteryId" , lotteryId);
requestMap . put ( "sessionId" , sessionId);
requestMap . put ( "startTime" , startTime);
requestMap . put ( "endTime" , endTime);
requestMap . put ( "sign" , LiveSignUtil . getSign (requestMap , appSecret));
String response = HttpUtil . get (url , requestMap);
log . info ( "测试查询频道中奖统计记录成功:{}" , response);
//do somethings
}
Copy {
"code" : 200 ,
"status" : "success" ,
"requestId" : "c4a7fb9af5624cbabeb47a4d04c4e13b.72.16614809866840885" ,
"data" : {
"pageNumber" : 1 ,
"pageSize" : 10 ,
"totalPages" : 1 ,
"totalItems" : 1 ,
"contents" : [
{
"winnerCount" : 2 ,
"totalUsers" : 11 ,
"lotteryId" : "gcfflpd4ex" ,
"channelId" : 2974342 ,
"userId" : "1b448be323" ,
"sessionId" : "gcfd814thr" ,
"lotteryRange" : "all" ,
"actor" : null ,
"prize" : "一等奖" ,
"amount" : 3 ,
"preset" : "" ,
"lotteryExt" : {
"collectInfo" : [
{
"field" : "姓名:" ,
"tips" : "请输入您的真实姓名"
} ,
{
"field" : "手机:" ,
"tips" : "请输入您的手机号码"
}
]
} ,
"createdTime" : 1660022052000
}
]
} ,
"success" : true
}
Copy {
"code" : 400 ,
"status" : "error" ,
"requestId" : "d310b70bc329403f87f77f9203d50f89.128.16360831552223589" ,
"error" : {
"code" : 20001 ,
"desc" : "application not found."
} ,
"success" : false
}