diff --git a/pom.xml b/pom.xml
index c359964..972aaa2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,24 +81,24 @@
org.seleniumhq.selenium
selenium-java
- 4.1.4
+ 4.2.1
org.seleniumhq.selenium
selenium-chrome-driver
- 4.1.4
+ 4.2.1
org.seleniumhq.selenium
selenium-api
- 4.1.4
+ 4.2.1
org.seleniumhq.selenium
selenium-remote-driver
- 4.1.4
+ 4.2.1
diff --git a/src/main/java/com/yutou/qqbot/QQBotApplication.java b/src/main/java/com/yutou/qqbot/QQBotApplication.java
index de64df1..99bb40e 100644
--- a/src/main/java/com/yutou/qqbot/QQBotApplication.java
+++ b/src/main/java/com/yutou/qqbot/QQBotApplication.java
@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class QQBotApplication {
- public static final String version="QQBot v.1.2.28";
+ public static final String version="QQBot v.1.2.29";
public static void main(String[] args) {
System.out.println("version = " + version);
SpringApplication.run(QQBotApplication.class, args);
diff --git a/src/main/java/com/yutou/qqbot/models/WebSign/BaiHeHui.java b/src/main/java/com/yutou/qqbot/models/WebSign/BaiHeHui.java
index 5349625..41dff47 100644
--- a/src/main/java/com/yutou/qqbot/models/WebSign/BaiHeHui.java
+++ b/src/main/java/com/yutou/qqbot/models/WebSign/BaiHeHui.java
@@ -6,7 +6,6 @@ import com.yutou.qqbot.QQBotManager;
import com.yutou.qqbot.models.Model;
import com.yutou.qqbot.utlis.*;
import org.openqa.selenium.By;
-import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
@@ -37,7 +36,7 @@ public class BaiHeHui extends Model {
try {
if (sign()) {
QQBotManager.getInstance().sendMessage(QQBotManager.defGroup, "百合会签到成功");
- }else{
+ } else {
QQBotManager.getInstance().sendMessage(QQBotManager.defGroup, "百合会签到失败");
}
} catch (Exception e) {
@@ -57,19 +56,24 @@ public class BaiHeHui extends Model {
JSONArray array = JSON.parseArray(cookie);
driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
driver.get("https://bbs.yamibo.com/forum.php");
- driver.manage().deleteAllCookies();
+ login(driver);
+ // driver.manage().deleteAllCookies();
+ /* Thread.sleep(1000);
for (Cookie _cookie : WebClient.loadCookie(array)) {
+ System.err.println(_cookie);
driver.manage().addCookie(_cookie);
- }
+ Thread.sleep(100);
+ }*/
try {
- Thread.sleep(500);
+ Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
driver.navigate().refresh();
+ driver.get("https://bbs.yamibo.com/forum.php");
for (WebElement element : driver.findElements(By.xpath("//a"))) {
if ("打卡签到".equals(element.getText())) {
- element.click();
+ element.click();
break;
}
}
@@ -78,12 +82,24 @@ public class BaiHeHui extends Model {
e.printStackTrace();
return false;
} finally {
- driver.close();
- driver.quit();
+ driver.close();
+ driver.quit();
+ }
+ }
+
+ private void login(WebDriver driver) {
+ driver.get("https://bbs.yamibo.com/member.php?mod=logging&action=login");
+ driver.findElement(By.name("username")).sendKeys("z583819556");
+ driver.findElement(By.name("password")).sendKeys("u8fi4Qfr.5D2wZ5");
+ driver.findElement(By.name("loginsubmit")).submit();
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
}
}
public static void main(String[] args) {
-
+ new BaiHeHui().sign();
}
}
diff --git a/src/main/java/com/yutou/qqbot/models/WebSign/Tsdm.java b/src/main/java/com/yutou/qqbot/models/WebSign/Tsdm.java
index 90e0402..a07e31c 100644
--- a/src/main/java/com/yutou/qqbot/models/WebSign/Tsdm.java
+++ b/src/main/java/com/yutou/qqbot/models/WebSign/Tsdm.java
@@ -154,6 +154,6 @@ public class Tsdm extends Model {
}
public static void main(String[] args) {
-
+ new Tsdm().tsdmSign();
}
}
diff --git a/src/main/java/com/yutou/qqbot/utlis/WebClient.java b/src/main/java/com/yutou/qqbot/utlis/WebClient.java
index 3b783cd..6e9f960 100644
--- a/src/main/java/com/yutou/qqbot/utlis/WebClient.java
+++ b/src/main/java/com/yutou/qqbot/utlis/WebClient.java
@@ -38,14 +38,21 @@ public class WebClient {
boolean containsDate = json.containsKey("expirationDate");
long t = 0;
if (containsDate) {
- t = Long.parseLong(json.getString("expirationDate").replace(".", "")) / 1000;
+ String _time=json.getString("expirationDate");
+ if(_time.contains(".")){
+ _time =_time.split("\\.")[0];
+ }
+ t = Long.parseLong(_time);
+ }else{
+ t=(System.currentTimeMillis())/1000;
}
+ t*=1000;
Cookie cookie = new Cookie(json.getString("name"),
json.getString("value"),
json.getString("domain"),
json.getString("path"),
- containsDate ? new Date(t) : new Date(),
+ new Date(t),
json.getBooleanValue("secure"),
json.getBooleanValue("httpOnly")