增加 领取信仰任务 的 API

This commit is contained in:
czp 2018-03-15 23:19:43 +08:00
parent b1dd916ff3
commit 8b4d016b00
4 changed files with 790 additions and 0 deletions

View File

@ -141,6 +141,38 @@ public interface LiveService {
return getPlayUrl(cid, "json");
}
/**
* 获取当前这段时间的活动(不定期活动, 每次持续几周)和信仰任务
*
* @param roomId 房间号
*/
@GET("activity/v1/Common/mobileActivity")
Call<MobileActivityEntity> getMobileActivity(@Query("roomid") long roomId);
/**
* 获取用户的信仰任务列表
*
* @return 2018-02 现在只有 double_watch_task 这个任务是有效的
*/
@GET("activity/v1/task/user_tasks")
Call<UserTasksEntity> getUserTasks();
/**
* 领取一个信仰任务
*
* @param taskId 任务名
* @return 任务未完成或者已领取返回 -400
*/
@POST("activity/v1/task/receive_award")
Call<ReceiveUserTaskAward> receiveUserTaskAward(@Query("task_id") String taskId);
/**
* 领取 double_watch_task 任务的奖励
*/
default Call<ReceiveUserTaskAward> receiveDoubleWatchTaskAward() {
return receiveUserTaskAward("double_watch_task");
}
/**
* 发送一个 Restful 心跳包, 五分钟一次. 这被用于统计观看直播的时间, 可以提升观众等级
* 2018-03-06 开始, 只有老爷才能通过观看直播获得经验

View File

@ -0,0 +1,225 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
public class MobileActivityEntity {
/**
* code : 0
* msg :
* message :
* data : {"activity":{"keyword":"lover_2018","icon_web":"","jump_web":"","icon_mobile":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/activity/lover_2018/mobile.png","jump_mobile":"https://live.bilibili.com/blackboard/hour-rank.html#/?1110317","status":1},"task":{"keyword":"task_2017","icon_web":"//i0.hdslb.com/bfs/live/b86792f129a641d8fd4f1ee4a337fcb9d4eac25c.png","jump_web":"//link.bilibili.com/p/center/index#/user-center/achievement/task","jump_mobile":"https://live.bilibili.com/p/eden/task-h5#/","icon_mobile":"https://i0.hdslb.com/bfs/live/61f1b388c1f4ed2838800a4d928dae5ab03d7c44.png","status":0}}
*/
@SerializedName("code")
private int code;
@SerializedName("msg")
private String msg;
@SerializedName("message")
private String message;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* activity : {"keyword":"lover_2018","icon_web":"","jump_web":"","icon_mobile":"https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/activity/lover_2018/mobile.png","jump_mobile":"https://live.bilibili.com/blackboard/hour-rank.html#/?1110317","status":1}
* task : {"keyword":"task_2017","icon_web":"//i0.hdslb.com/bfs/live/b86792f129a641d8fd4f1ee4a337fcb9d4eac25c.png","jump_web":"//link.bilibili.com/p/center/index#/user-center/achievement/task","jump_mobile":"https://live.bilibili.com/p/eden/task-h5#/","icon_mobile":"https://i0.hdslb.com/bfs/live/61f1b388c1f4ed2838800a4d928dae5ab03d7c44.png","status":0}
*/
@SerializedName("activity")
private Activity activity;
@SerializedName("task")
private Task task;
public Activity getActivity() {
return activity;
}
public void setActivity(Activity activity) {
this.activity = activity;
}
public Task getTask() {
return task;
}
public void setTask(Task task) {
this.task = task;
}
public static class Activity {
/**
* keyword : lover_2018
* icon_web :
* jump_web :
* icon_mobile : https://s1.hdslb.com/bfs/static/blive/live-assets/mobile/activity/lover_2018/mobile.png
* jump_mobile : https://live.bilibili.com/blackboard/hour-rank.html#/?1110317
* status : 1
*/
@SerializedName("keyword")
private String keyword;
@SerializedName("icon_web")
private String iconWeb;
@SerializedName("jump_web")
private String jumpWeb;
@SerializedName("icon_mobile")
private String iconMobile;
@SerializedName("jump_mobile")
private String jumpMobile;
@SerializedName("status")
private int status;
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public String getIconWeb() {
return iconWeb;
}
public void setIconWeb(String iconWeb) {
this.iconWeb = iconWeb;
}
public String getJumpWeb() {
return jumpWeb;
}
public void setJumpWeb(String jumpWeb) {
this.jumpWeb = jumpWeb;
}
public String getIconMobile() {
return iconMobile;
}
public void setIconMobile(String iconMobile) {
this.iconMobile = iconMobile;
}
public String getJumpMobile() {
return jumpMobile;
}
public void setJumpMobile(String jumpMobile) {
this.jumpMobile = jumpMobile;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
public static class Task {
/**
* keyword : task_2017
* icon_web : //i0.hdslb.com/bfs/live/b86792f129a641d8fd4f1ee4a337fcb9d4eac25c.png
* jump_web : //link.bilibili.com/p/center/index#/user-center/achievement/task
* jump_mobile : https://live.bilibili.com/p/eden/task-h5#/
* icon_mobile : https://i0.hdslb.com/bfs/live/61f1b388c1f4ed2838800a4d928dae5ab03d7c44.png
* status : 0
*/
@SerializedName("keyword")
private String keyword;
@SerializedName("icon_web")
private String iconWeb;
@SerializedName("jump_web")
private String jumpWeb;
@SerializedName("jump_mobile")
private String jumpMobile;
@SerializedName("icon_mobile")
private String iconMobile;
@SerializedName("status")
private int status;
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public String getIconWeb() {
return iconWeb;
}
public void setIconWeb(String iconWeb) {
this.iconWeb = iconWeb;
}
public String getJumpWeb() {
return jumpWeb;
}
public void setJumpWeb(String jumpWeb) {
this.jumpWeb = jumpWeb;
}
public String getJumpMobile() {
return jumpMobile;
}
public void setJumpMobile(String jumpMobile) {
this.jumpMobile = jumpMobile;
}
public String getIconMobile() {
return iconMobile;
}
public void setIconMobile(String iconMobile) {
this.iconMobile = iconMobile;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
}
}

View File

@ -0,0 +1,55 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class ReceiveUserTaskAward {
/**
* code : 0
* msg :
* message :
* data : []
*/
@SerializedName("code")
private int code;
@SerializedName("msg")
private String msg;
@SerializedName("message")
private String message;
@SerializedName("data")
private List<?> data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public List<?> getData() {
return data;
}
public void setData(List<?> data) {
this.data = data;
}
}

View File

@ -0,0 +1,478 @@
package com.hiczp.bilibili.api.live.entity;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class UserTasksEntity {
/**
* code : 0
* msg : success
* message : success
* data : {"share_info":{"task_id":"share_task","share_count":0,"progress":{"now":0,"max":1},"status":0,"awards":[{"name":"扭蛋币","type":"toycoin","num":5},{"name":"亲密度","type":"intimacy","num":10}]},"watch_info":{"task_id":"single_watch_task","status":0,"progress":{"now":0,"max":1},"awards":[{"name":"银瓜子","type":"silver","num":500}]},"double_watch_info":{"task_id":"double_watch_task","status":2,"web_watch":1,"mobile_watch":1,"progress":{"now":2,"max":2},"awards":[{"name":"银瓜子","type":"silver","num":700},{"name":"友爱金","type":"union_money","num":1000},{"name":"亲密度","type":"intimacy","num":20}]}}
*/
@SerializedName("code")
private int code;
@SerializedName("msg")
private String msg;
@SerializedName("message")
private String message;
@SerializedName("data")
private Data data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public static class Data {
/**
* share_info : {"task_id":"share_task","share_count":0,"progress":{"now":0,"max":1},"status":0,"awards":[{"name":"扭蛋币","type":"toycoin","num":5},{"name":"亲密度","type":"intimacy","num":10}]}
* watch_info : {"task_id":"single_watch_task","status":0,"progress":{"now":0,"max":1},"awards":[{"name":"银瓜子","type":"silver","num":500}]}
* double_watch_info : {"task_id":"double_watch_task","status":2,"web_watch":1,"mobile_watch":1,"progress":{"now":2,"max":2},"awards":[{"name":"银瓜子","type":"silver","num":700},{"name":"友爱金","type":"union_money","num":1000},{"name":"亲密度","type":"intimacy","num":20}]}
*/
@SerializedName("share_info")
private ShareInfo shareInfo;
@SerializedName("watch_info")
private WatchInfo watchInfo;
@SerializedName("double_watch_info")
private DoubleWatchInfo doubleWatchInfo;
public ShareInfo getShareInfo() {
return shareInfo;
}
public void setShareInfo(ShareInfo shareInfo) {
this.shareInfo = shareInfo;
}
public WatchInfo getWatchInfo() {
return watchInfo;
}
public void setWatchInfo(WatchInfo watchInfo) {
this.watchInfo = watchInfo;
}
public DoubleWatchInfo getDoubleWatchInfo() {
return doubleWatchInfo;
}
public void setDoubleWatchInfo(DoubleWatchInfo doubleWatchInfo) {
this.doubleWatchInfo = doubleWatchInfo;
}
public static class ShareInfo {
/**
* task_id : share_task
* share_count : 0
* progress : {"now":0,"max":1}
* status : 0
* awards : [{"name":"扭蛋币","type":"toycoin","num":5},{"name":"亲密度","type":"intimacy","num":10}]
*/
@SerializedName("task_id")
private String taskId;
@SerializedName("share_count")
private int shareCount;
@SerializedName("progress")
private Progress progress;
@SerializedName("status")
private int status;
@SerializedName("awards")
private List<Awards> awards;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public int getShareCount() {
return shareCount;
}
public void setShareCount(int shareCount) {
this.shareCount = shareCount;
}
public Progress getProgress() {
return progress;
}
public void setProgress(Progress progress) {
this.progress = progress;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public List<Awards> getAwards() {
return awards;
}
public void setAwards(List<Awards> awards) {
this.awards = awards;
}
public static class Progress {
/**
* now : 0
* max : 1
*/
@SerializedName("now")
private int now;
@SerializedName("max")
private int max;
public int getNow() {
return now;
}
public void setNow(int now) {
this.now = now;
}
public int getMax() {
return max;
}
public void setMax(int max) {
this.max = max;
}
}
public static class Awards {
/**
* name : 扭蛋币
* type : toycoin
* num : 5
*/
@SerializedName("name")
private String name;
@SerializedName("type")
private String type;
@SerializedName("num")
private int num;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
}
}
public static class WatchInfo {
/**
* task_id : single_watch_task
* status : 0
* progress : {"now":0,"max":1}
* awards : [{"name":"银瓜子","type":"silver","num":500}]
*/
@SerializedName("task_id")
private String taskId;
@SerializedName("status")
private int status;
@SerializedName("progress")
private ProgressX progress;
@SerializedName("awards")
private List<AwardsX> awards;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public ProgressX getProgress() {
return progress;
}
public void setProgress(ProgressX progress) {
this.progress = progress;
}
public List<AwardsX> getAwards() {
return awards;
}
public void setAwards(List<AwardsX> awards) {
this.awards = awards;
}
public static class ProgressX {
/**
* now : 0
* max : 1
*/
@SerializedName("now")
private int now;
@SerializedName("max")
private int max;
public int getNow() {
return now;
}
public void setNow(int now) {
this.now = now;
}
public int getMax() {
return max;
}
public void setMax(int max) {
this.max = max;
}
}
public static class AwardsX {
/**
* name : 银瓜子
* type : silver
* num : 500
*/
@SerializedName("name")
private String name;
@SerializedName("type")
private String type;
@SerializedName("num")
private int num;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
}
}
public static class DoubleWatchInfo {
/**
* task_id : double_watch_task
* status : 2
* web_watch : 1
* mobile_watch : 1
* progress : {"now":2,"max":2}
* awards : [{"name":"银瓜子","type":"silver","num":700},{"name":"友爱金","type":"union_money","num":1000},{"name":"亲密度","type":"intimacy","num":20}]
*/
@SerializedName("task_id")
private String taskId;
@SerializedName("status")
private int status;
@SerializedName("web_watch")
private int webWatch;
@SerializedName("mobile_watch")
private int mobileWatch;
@SerializedName("progress")
private ProgressXX progress;
@SerializedName("awards")
private List<AwardsXX> awards;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getWebWatch() {
return webWatch;
}
public void setWebWatch(int webWatch) {
this.webWatch = webWatch;
}
public int getMobileWatch() {
return mobileWatch;
}
public void setMobileWatch(int mobileWatch) {
this.mobileWatch = mobileWatch;
}
public ProgressXX getProgress() {
return progress;
}
public void setProgress(ProgressXX progress) {
this.progress = progress;
}
public List<AwardsXX> getAwards() {
return awards;
}
public void setAwards(List<AwardsXX> awards) {
this.awards = awards;
}
public static class ProgressXX {
/**
* now : 2
* max : 2
*/
@SerializedName("now")
private int now;
@SerializedName("max")
private int max;
public int getNow() {
return now;
}
public void setNow(int now) {
this.now = now;
}
public int getMax() {
return max;
}
public void setMax(int max) {
this.max = max;
}
}
public static class AwardsXX {
/**
* name : 银瓜子
* type : silver
* num : 700
*/
@SerializedName("name")
private String name;
@SerializedName("type")
private String type;
@SerializedName("num")
private int num;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
}
}
}
}