修复B站签到未登录时的状态
This commit is contained in:
parent
938d3d532a
commit
3bc4c164e0
@ -3,8 +3,10 @@ package com.yutou.qqbot.bilibili;
|
|||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.yutou.qqbot.QQBotManager;
|
||||||
import com.yutou.qqbot.utlis.ConfigTools;
|
import com.yutou.qqbot.utlis.ConfigTools;
|
||||||
import com.yutou.qqbot.utlis.HttpTools;
|
import com.yutou.qqbot.utlis.HttpTools;
|
||||||
|
import com.yutou.qqbot.utlis.QRCodeUtils;
|
||||||
import com.yutou.qqbot.utlis.StringUtils;
|
import com.yutou.qqbot.utlis.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -33,6 +35,12 @@ public class BiliLogin {
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void loginAsQQ() {
|
||||||
|
String url = login().getString("url");
|
||||||
|
File code = QRCodeUtils.createQRCode("bili_login", url);
|
||||||
|
QQBotManager.getInstance().sendMessage(code, qq, "B站未登录,请扫码登陆后再试");
|
||||||
|
}
|
||||||
|
|
||||||
public void waitLogin(String oauthKey) {
|
public void waitLogin(String oauthKey) {
|
||||||
long time = System.currentTimeMillis();
|
long time = System.currentTimeMillis();
|
||||||
String bd = "gourl=https%3A%2F%2Fpassport.bilibili.com%2Fajax%2FminiLogin%2Fredirect&oauthKey=" + oauthKey;
|
String bd = "gourl=https%3A%2F%2Fpassport.bilibili.com%2Fajax%2FminiLogin%2Fredirect&oauthKey=" + oauthKey;
|
||||||
|
@ -40,9 +40,7 @@ public class BiliBiliLive extends Model {
|
|||||||
super.onTime(qq, time);
|
super.onTime(qq, time);
|
||||||
if ("00:01:00".equals(time)) {
|
if ("00:01:00".equals(time)) {
|
||||||
if(!new BiliLogin(qq).testLogin()){
|
if(!new BiliLogin(qq).testLogin()){
|
||||||
String url = new BiliLogin(QQBotManager.defQQ).login().getString("url");
|
new BiliLogin(QQBotManager.defQQ).loginAsQQ();
|
||||||
File code = QRCodeUtils.createQRCode("bili_login", url);
|
|
||||||
QQBotManager.getInstance().sendMessage(code, qq, "B站未登录,请扫码登陆后再试");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
signLive(QQBotManager.defQQ, qq);
|
signLive(QQBotManager.defQQ, qq);
|
||||||
@ -50,6 +48,10 @@ public class BiliBiliLive extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void signLive(long qq, long sendQQ) {
|
private void signLive(long qq, long sendQQ) {
|
||||||
|
if(!new BiliLogin(qq).testLogin()){
|
||||||
|
new BiliLogin(qq).loginAsQQ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
BiliBiliUtils biliUtils = BiliBiliUtils.getInstance(qq);
|
BiliBiliUtils biliUtils = BiliBiliUtils.getInstance(qq);
|
||||||
QQBotManager.getInstance().sendMessage(sendQQ, biliUtils.liveSignIn());
|
QQBotManager.getInstance().sendMessage(sendQQ, biliUtils.liveSignIn());
|
||||||
Set<String> biliLive = RedisTools.list_get("bili_live");
|
Set<String> biliLive = RedisTools.list_get("bili_live");
|
||||||
@ -98,9 +100,7 @@ public class BiliBiliLive extends Model {
|
|||||||
}
|
}
|
||||||
Integer roomId = Integer.parseInt(msg);
|
Integer roomId = Integer.parseInt(msg);
|
||||||
if(!new BiliLogin(qq).testLogin()){
|
if(!new BiliLogin(qq).testLogin()){
|
||||||
String url = new BiliLogin(user).login().getString("url");
|
new BiliLogin(qq).loginAsQQ();
|
||||||
File code = QRCodeUtils.createQRCode("bili_login", url);
|
|
||||||
QQBotManager.getInstance().sendMessage(code, qq, "B站未登录,请扫码登陆后再试");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (biliUtils.checkLiveRoom(roomId) && roomId != 0) {
|
if (biliUtils.checkLiveRoom(roomId) && roomId != 0) {
|
||||||
|
@ -44,9 +44,7 @@ public class BiliBiliMangeSign extends Model {
|
|||||||
}
|
}
|
||||||
QQBotManager.getInstance().sendMessage(qq, msg);
|
QQBotManager.getInstance().sendMessage(qq, msg);
|
||||||
} else {
|
} else {
|
||||||
String url = new BiliLogin(user).login().getString("url");
|
new BiliLogin(user).loginAsQQ();
|
||||||
File code = QRCodeUtils.createQRCode("bili_login", url);
|
|
||||||
QQBotManager.getInstance().sendMessage(code, qq, "B站未登录,请扫码登陆后再试");
|
|
||||||
}
|
}
|
||||||
} else if (msg.equals(QQFromCommands.BILI_MANGA_PAY)) {
|
} else if (msg.equals(QQFromCommands.BILI_MANGA_PAY)) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
Loading…
Reference in New Issue
Block a user