Skip to content

Commit

Permalink
fix: bug修复
Browse files Browse the repository at this point in the history
  • Loading branch information
liu-roy committed Mar 1, 2025
1 parent 3dd2166 commit ea71cf0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ public void stop() {
*/
public void scheduleTask(Runnable task, long delay, TimeUnit unit) {
if (isRunning.get()) {
if (delayQueue.size() > 20) {
log.warn("delay queue is more than 20, reject new task.");
return;
}
delayQueue.put(new DelayedTask(task, delay, unit));
} else {
throw new IllegalStateException("任务调度器未启动,请调用 start() 方法!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ public class BuguTvCheckinService extends AbstractCheckinService {
@Value("${bugutv.password}")
private String password;

private static final String LOGIN_URL = "https://www.bugutv.org";
private static final String USER_URL = "https://www.bugutv.org/user";
@Value("${bugutv.url}")
private String LOGIN_URL = "https://www.bugutv.vip";

private final String USER_URI = "/user";


@Scheduled(fixedDelay = 11 * 60 * 60 * 1000+30000)
Expand Down Expand Up @@ -70,7 +72,7 @@ protected void login(WebDriver browser) {

@Override
protected boolean performCheckIn(WebDriver browser) {
browser.get(USER_URL);
browser.get(LOGIN_URL+USER_URI);

// 检查是否已经签到
WebElement alreadySignIn = safeWaitForElement(browser, By.xpath("//button[contains(text(), '今日已签到')]"), 10);
Expand Down Expand Up @@ -103,12 +105,5 @@ private void waitForAjaxLoad(WebDriver driver) {
}


@Scheduled(cron = "0 0 6 * * ?") // 每天早上6点执行
public void scheduleCheckIn() {
if (!doCheckIn()) {
log.warn("签到失败,稍后尝试再次签到...");
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ public class ShaoshurenCheckinService extends AbstractCheckinService {
@Value("${shaoshuren.password}")
private String password;

private static final String LOGIN_URL = "https://xn--gmqz83awjh.net/auth/login";
private static final String USER_URL = "https://xn--gmqz83awjh.net/user";
@Value("${shaoshuren.url}")
private String LOGIN_URL = "https://xn--gmqz83awjh.net/auth/login";

private String USER_URI = "/user";


@Scheduled(fixedDelay = 11 * 60 * 60 * 1000)
public void loginAndCheckIn() {
if (!doCheckIn()) {
Expand All @@ -55,7 +59,7 @@ protected void login(WebDriver browser) {
WebElement loginButton = browser.findElement(By.id("login_submit"));
loginButton.click();
// 等待登录完成
wait.until(ExpectedConditions.urlContains("/user"));
wait.until(ExpectedConditions.urlContains(USER_URI));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ swagger:
bugutv:
username: xxxx
password: xxxx
url: https://www.bugutv.vip
shaoshuren:
username: [email protected]
password: xxxx
url: https://xn--gmqz83awjh.net/auth/login
3 changes: 2 additions & 1 deletion goodluck-checkin-service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ swagger:
bugutv:
username: xxxx
password: xxxx
url: https://www.bugutv.vip
shaoshuren:
username: [email protected]
password: xxxx

url: https://xn--gmqz83awjh.net/auth/login

0 comments on commit ea71cf0

Please sign in to comment.