完成 获取获奖记录 的 API

This commit is contained in:
czp 2018-04-02 10:14:06 +08:00
parent 693f96f180
commit 8cc01b311b
3 changed files with 218 additions and 16 deletions

View File

@ -552,10 +552,9 @@ public interface LiveService {
//TODO 头衔工坊(没有可升级头衔, 暂不明确此 API)
//TODO 获奖记录(没有获奖记录, 暂不明确返回值)
//侧拉抽屉 -> 直播中心 -> 获奖记录
@GET("AppUser/awards")
Call<AwardsEntity> getAwards();
Call<AwardsEntity> getAwardRecords();
/**
* 瓜子商店

View File

@ -1,6 +1,5 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;
import java.util.List;
@ -9,7 +8,7 @@ public class AwardsEntity {
/**
* code : 0
* message : OK
* data : {"list":[],"use_count":0,"count":0}
* data : {"list":[{"id":100000,"uid":1000000,"gift_name":"小电视","gift_type":"2","gift_num":1,"user_name":"打码","user_phone":"打码","user_address":"打码","user_extra_field":"{\"user_area\":\"打码\",\"user_post_code\":\"打码\",\"user_city\":\"打码\",\"user_province\":\"打码\"}","source":"小电视抽奖","source_id":10000,"create_time":"2018-02-01 00:00:00","update_time":null,"expire_time":"2018-02-16 00:00:00","comment":null,"status":0,"expire":true,"finished":true},{"id":10000,"uid":1000000,"gift_name":"小米Max2手机","gift_type":"2","gift_num":1,"user_name":"打码","user_phone":"打码","user_address":"打码","user_extra_field":"{\"user_province\":\"\\u6253\\u7801\",\"user_city\":\"\\u6253\\u7801\",\"user_area\":\"\\u6253\\u7801\",\"user_post_code\":\"打码\"}","source":"小米Max2超耐久直播第二季","source_id":1,"create_time":"2017-06-01 00:00:00","update_time":"2017-06-01 00:00:00","expire_time":"2017-06-30 00:00:00","comment":null,"status":0,"expire":true,"finished":true}],"use_count":0,"count":2}
*/
@SerializedName("code")
@ -17,7 +16,7 @@ public class AwardsEntity {
@SerializedName("message")
private String message;
@SerializedName("data")
private Data data;
private DataEntity data;
public int getCode() {
return code;
@ -35,19 +34,19 @@ public class AwardsEntity {
this.message = message;
}
public Data getData() {
public DataEntity getData() {
return data;
}
public void setData(Data data) {
public void setData(DataEntity data) {
this.data = data;
}
public static class Data {
public static class DataEntity {
/**
* list : []
* list : [{"id":100000,"uid":1000000,"gift_name":"小电视","gift_type":"2","gift_num":1,"user_name":"打码","user_phone":"打码","user_address":"打码","user_extra_field":"{\"user_area\":\"打码\",\"user_post_code\":\"打码\",\"user_city\":\"打码\",\"user_province\":\"打码\"}","source":"小电视抽奖","source_id":10000,"create_time":"2018-02-01 00:00:00","update_time":null,"expire_time":"2018-02-16 00:00:00","comment":null,"status":0,"expire":true,"finished":true},{"id":10000,"uid":1000000,"gift_name":"小米Max2手机","gift_type":"2","gift_num":1,"user_name":"打码","user_phone":"打码","user_address":"打码","user_extra_field":"{\"user_province\":\"\\u6253\\u7801\",\"user_city\":\"\\u6253\\u7801\",\"user_area\":\"\\u6253\\u7801\",\"user_post_code\":\"打码\"}","source":"小米Max2超耐久直播第二季","source_id":1,"create_time":"2017-06-01 00:00:00","update_time":"2017-06-01 00:00:00","expire_time":"2017-06-30 00:00:00","comment":null,"status":0,"expire":true,"finished":true}]
* use_count : 0
* count : 0
* count : 2
*/
@SerializedName("use_count")
@ -55,7 +54,7 @@ public class AwardsEntity {
@SerializedName("count")
private int count;
@SerializedName("list")
private List<JsonObject> list;
private List<AwardEntity> awardList;
public int getUseCount() {
return useCount;
@ -73,12 +72,216 @@ public class AwardsEntity {
this.count = count;
}
public List<?> getList() {
return list;
public List<AwardEntity> getAwardList() {
return awardList;
}
public void setList(List<JsonObject> list) {
this.list = list;
public void setAwardList(List<AwardEntity> awardList) {
this.awardList = awardList;
}
public static class AwardEntity {
/**
* id : 100000
* uid : 1000000
* gift_name : 小电视
* gift_type : 2
* gift_num : 1
* user_name : 打码
* user_phone : 打码
* user_address : 打码
* user_extra_field : {"user_area":"打码","user_post_code":"打码","user_city":"打码","user_province":"打码"}
* source : 小电视抽奖
* source_id : 10000
* create_time : 2018-02-01 00:00:00
* update_time : null
* expire_time : 2018-02-16 00:00:00
* comment : null
* status : 0
* expire : true
* finished : true
*/
@SerializedName("id")
private int id;
@SerializedName("uid")
private int uid;
@SerializedName("gift_name")
private String giftName;
@SerializedName("gift_type")
private String giftType;
@SerializedName("gift_num")
private int giftNum;
@SerializedName("user_name")
private String userName;
@SerializedName("user_phone")
private String userPhone;
@SerializedName("user_address")
private String userAddress;
@SerializedName("user_extra_field")
private String userExtraField;
@SerializedName("source")
private String source;
@SerializedName("source_id")
private int sourceId;
@SerializedName("create_time")
private String createTime;
@SerializedName("update_time")
private Object updateTime;
@SerializedName("expire_time")
private String expireTime;
@SerializedName("comment")
private Object comment;
@SerializedName("status")
private int status;
@SerializedName("expire")
private boolean expire;
@SerializedName("finished")
private boolean finished;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public String getGiftName() {
return giftName;
}
public void setGiftName(String giftName) {
this.giftName = giftName;
}
public String getGiftType() {
return giftType;
}
public void setGiftType(String giftType) {
this.giftType = giftType;
}
public int getGiftNum() {
return giftNum;
}
public void setGiftNum(int giftNum) {
this.giftNum = giftNum;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPhone() {
return userPhone;
}
public void setUserPhone(String userPhone) {
this.userPhone = userPhone;
}
public String getUserAddress() {
return userAddress;
}
public void setUserAddress(String userAddress) {
this.userAddress = userAddress;
}
public String getUserExtraField() {
return userExtraField;
}
public void setUserExtraField(String userExtraField) {
this.userExtraField = userExtraField;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public int getSourceId() {
return sourceId;
}
public void setSourceId(int sourceId) {
this.sourceId = sourceId;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public Object getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Object updateTime) {
this.updateTime = updateTime;
}
public String getExpireTime() {
return expireTime;
}
public void setExpireTime(String expireTime) {
this.expireTime = expireTime;
}
public Object getComment() {
return comment;
}
public void setComment(Object comment) {
this.comment = comment;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public boolean isExpire() {
return expire;
}
public void setExpire(boolean expire) {
this.expire = expire;
}
public boolean isFinished() {
return finished;
}
public void setFinished(boolean finished) {
this.finished = finished;
}
}
}
}

View File

@ -13,7 +13,7 @@ public class GetAwardsTest {
public void getAwards() throws Exception {
BILIBILI_API
.getLiveService(Collections.emptyList(), HttpLoggingInterceptor.Level.BODY)
.getAwards()
.getAwardRecords()
.execute()
.body();
}