新增B站大会员积分签到

修复B站操作前没做登陆校验的问题
This commit is contained in:
Yutousama 2023-01-06 01:23:34 +08:00
parent 5d15f24847
commit 938d3d532a
3 changed files with 9 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package com.yutou.qqbot.bilibili;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
@ -12,7 +13,7 @@ public class AppUserTask {
private long progress;
private long target;
private Wallet wallet;
private List<WeekTask> weekTask;
private List<WeekTask> weekTask = new ArrayList<>();
private long weekTotal;
private long weekGroup;
private DayTask dayTask;
@ -35,8 +36,9 @@ public class AppUserTask {
public String toMessageFormat() {
return switch (getStatus()) {
case 0 -> "不可领取,需要发送弹幕:" + getTarget() + ",进度:" + getProgress();
case 2 -> "未领取";
case 0 -> "不可领取,需要发送弹幕数:" + getTarget() + ",进度:" + getProgress();
case 1 -> "进行中,需要发送弹幕数:" + getTarget() + ",进度:" + getProgress();
case 2 -> "可领取";
case 3 -> "已领取";
default -> "未知状态:" + this;
};
@ -64,7 +66,7 @@ public class AppUserTask {
return switch (getStatus()) {
case 0 ->
"任务id:" + id + ",不可领取, 进度天数:" + totalNum + ",需要天数:" + minimalDay + ",任务奖励电池:" + rewardNum;
case 2 -> "任务id:" + id + ":领取" + ",任务奖励电池:" + rewardNum;
case 2 -> "任务id:" + id + ":领取" + ",任务奖励电池:" + rewardNum;
case 3 -> "任务id:" + id + ":已领取" + ",任务奖励电池:" + rewardNum;
default -> "未知状态:" + this;
};

View File

@ -102,6 +102,7 @@ public class BiliBiliAppUtils {
public AppUserTask getTaskProgress() {
JSONObject task = biliUtils.http_get("https://api.live.bilibili.com/xlive/app-ucenter/v1/userTask/GetUserTaskProgress");
System.out.println("task = " + task);
assert task != null;
return task.getObject("data", AppUserTask.class);
}

View File

@ -364,7 +364,7 @@ public class BiliBiliUtils {
JSONObject toCoin = http_post("https://api.live.bilibili.com/xlive/revenue/v1/wallet/silver2coin", HttpTools.toUrlParams(body));
JSONObject liveSign = http_get("https://api.live.bilibili.com/xlive/web-ucenter/v1/sign/DoSign");
JSONObject vipSign = http_post("https://api.bilibili.com/pgc/activity/score/task/sign", null);
return "银瓜子兑换硬币:"+toCoin.getString("message") + "|" +"直播签到:"+ liveSign.getString("message")+"|大会员中心签到:"+vipSign.getString("message");
return "银瓜子兑换硬币:" + toCoin.getString("message") + "|" + "直播签到:" + liveSign.getString("message") + "|大会员中心签到:" + vipSign.getString("message");
}
public JSONObject getLiveRoom(int roomId) {