diff --git a/src/main/java/com/hiczp/bilibili/api/ServerErrorCode.java b/src/main/java/com/hiczp/bilibili/api/ServerErrorCode.java index 47980c2..7e0a944 100644 --- a/src/main/java/com/hiczp/bilibili/api/ServerErrorCode.java +++ b/src/main/java/com/hiczp/bilibili/api/ServerErrorCode.java @@ -76,6 +76,16 @@ public class ServerErrorCode { * "每天最多能兑换 1 个" */ public static final int FORBIDDEN = 403; + /** + * 送礼物时房间号与用户号不匹配 + * "只能送给主播(591)" + */ + public static final int ONLY_CAN_SEND_TO_HOST = 200012; + /** + * 赠送一个不存在的礼物 + * "获取包裹数据失败" + */ + public static final int GET_BAG_DATA_FAIL = 200019; /** * "请登录" */ @@ -85,6 +95,7 @@ public class ServerErrorCode { */ public static final int NO_LOGIN = -101; /** + * 搜索时, 关键字字数过少或过多 * "关键字不能小于2个字节或大于50字节" */ public static final int KEYWORD_CAN_NOT_LESS_THAN_2_BYTES_OR_GREATER_THAN_50_BYTES = -609; diff --git a/src/main/java/com/hiczp/bilibili/api/live/LiveService.java b/src/main/java/com/hiczp/bilibili/api/live/LiveService.java index f3293f2..216e525 100644 --- a/src/main/java/com/hiczp/bilibili/api/live/LiveService.java +++ b/src/main/java/com/hiczp/bilibili/api/live/LiveService.java @@ -246,6 +246,8 @@ public interface LiveService { * @param timeStamp 时间戳 * @param bagId 礼物在自己背包里的 ID * @param random 随机数 + * @return roomUserId 与 roomId 不匹配时返回 200012 + * @return bagId 错误时(背包里没有这个礼物)返回 200019 */ @POST("AppBag/send") @FormUrlEncoded diff --git a/src/main/java/com/hiczp/bilibili/api/live/entity/SendGiftResponseEntity.java b/src/main/java/com/hiczp/bilibili/api/live/entity/SendGiftResponseEntity.java index 37a6617..8175875 100644 --- a/src/main/java/com/hiczp/bilibili/api/live/entity/SendGiftResponseEntity.java +++ b/src/main/java/com/hiczp/bilibili/api/live/entity/SendGiftResponseEntity.java @@ -9,12 +9,15 @@ import java.util.List; public class SendGiftResponseEntity { /** * code : 0 - * message : ok + * msg : success + * message : success * data : {"silver":"2696","gold":"0","data":{"giftName":"辣条","num":1,"uname":"czp3009","rcost":31134,"uid":20293030,"top_list":[{"uid":20293030,"uname":"czp3009","coin":25100,"face":"http://i0.hdslb.com/bfs/face/4f65e79399ad5a1bf3f877851b2f819d5870b494.jpg","guard_level":0,"rank":1,"score":25100},{"uid":19946822,"uname":"罗非鱼追上来了","coin":8000,"face":"http://i2.hdslb.com/bfs/face/e71031a931125617fad2c148213381bb6e0e9f26.jpg","guard_level":0,"rank":2,"score":8000},{"uid":8353249,"uname":"TcCoke","coin":3500,"face":"http://i2.hdslb.com/bfs/face/7c3c131f89380db0046024d1a903d3a6e4dc6128.jpg","guard_level":0,"rank":3,"score":3500}],"timestamp":1509972225,"giftId":1,"giftType":0,"action":"喂食","super":0,"price":100,"rnd":"1430788195","newMedal":0,"newTitle":0,"medal":[],"title":"","beatId":0,"biz_source":"live","metadata":"","remain":1,"gold":0,"silver":0,"eventScore":0,"eventNum":0,"smalltv_msg":[],"specialGift":null,"notice_msg":[],"capsule":{"normal":{"coin":10,"change":0,"progress":{"now":2900,"max":10000}},"colorful":{"coin":0,"change":0,"progress":{"now":0,"max":5000}}},"addFollow":0},"remain":1} */ @SerializedName("code") private int code; + @SerializedName("msg") + private String msg; @SerializedName("message") private String message; @SerializedName("data") @@ -28,6 +31,14 @@ public class SendGiftResponseEntity { this.code = code; } + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + public String getMessage() { return message; } @@ -138,7 +149,7 @@ public class SendGiftResponseEntity { @SerializedName("uid") private int uid; @SerializedName("timestamp") - private int timestamp; + private long timestamp; @SerializedName("giftId") private int giftId; @SerializedName("giftType") @@ -181,12 +192,15 @@ public class SendGiftResponseEntity { private int addFollow; @SerializedName("top_list") private List topList; + /** + * medal 可能是空的 JsonArray, 也可能是一个 JsonObject + */ @SerializedName("medal") - private List medal; + private JsonElement medal; @SerializedName("smalltv_msg") - private List smalltvMsg; + private JsonElement smalltvMsg; @SerializedName("notice_msg") - private List noticeMsg; + private JsonElement noticeMsg; public String getGiftName() { return giftName; @@ -228,11 +242,11 @@ public class SendGiftResponseEntity { this.uid = uid; } - public int getTimestamp() { + public long getTimestamp() { return timestamp; } - public void setTimestamp(int timestamp) { + public void setTimestamp(long timestamp) { this.timestamp = timestamp; } @@ -404,27 +418,27 @@ public class SendGiftResponseEntity { this.topList = topList; } - public List getMedal() { + public JsonElement getMedal() { return medal; } - public void setMedal(List medal) { + public void setMedal(JsonElement medal) { this.medal = medal; } - public List getSmalltvMsg() { + public JsonElement getSmalltvMsg() { return smalltvMsg; } - public void setSmalltvMsg(List smalltvMsg) { + public void setSmalltvMsg(JsonElement smalltvMsg) { this.smalltvMsg = smalltvMsg; } - public List getNoticeMsg() { + public JsonElement getNoticeMsg() { return noticeMsg; } - public void setNoticeMsg(List noticeMsg) { + public void setNoticeMsg(JsonElement noticeMsg) { this.noticeMsg = noticeMsg; }