update
This commit is contained in:
@@ -55,6 +55,35 @@ public class LiveConfigDatabaseBean extends AbsDatabasesBean {
|
||||
return checkRecordTime(recordLiveDate);
|
||||
}
|
||||
|
||||
public boolean verifyDanmuTimer() {
|
||||
return verifyTimer(recordDanmuDate);
|
||||
}
|
||||
|
||||
public boolean verifyLiveTimer() {
|
||||
return verifyTimer(recordLiveDate);
|
||||
}
|
||||
|
||||
private boolean verifyTimer(String val) {
|
||||
int _length = val.length();
|
||||
boolean isFullDate = (_length - val.replace("*", "").length()) == 3
|
||||
&& (_length - val.replace("*", "").trim().length()) == 0;
|
||||
String[] split = val.split(" ");
|
||||
if (isFullDate) {
|
||||
return true;
|
||||
}
|
||||
String minute = split[0];
|
||||
String hour = split[1];
|
||||
String day = split[2];
|
||||
try {
|
||||
Integer.parseInt(minute);
|
||||
Integer.parseInt(hour);
|
||||
Integer.parseInt(day);
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkRecordTime(String recordDate) {
|
||||
int _length = recordDate.length();
|
||||
boolean isFullDate = (_length - recordDate.replace("*", "").length()) == 3;
|
||||
@@ -70,7 +99,7 @@ public class LiveConfigDatabaseBean extends AbsDatabasesBean {
|
||||
boolean isFullDay = "*".equals(day);
|
||||
Calendar today = Calendar.getInstance();
|
||||
if (!isFullDay) {
|
||||
if (today.get(Calendar.DAY_OF_WEEK) != Integer.parseInt(day)) {
|
||||
if (today.get(Calendar.DAY_OF_WEEK) != Integer.parseInt(day) + 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package com.yutou.biliapi.databases;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.biliapi.bean.login.LoginCookieDatabaseBean;
|
||||
import com.yutou.biliapi.bean.login.LoginUserDatabaseBean;
|
||||
import com.yutou.biliapi.bean.login.UserInfoBean;
|
||||
import com.yutou.common.databases.AbsDatabasesBean;
|
||||
import com.yutou.common.databases.SQLiteManager;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BiliBiliLoginDatabase extends SQLiteManager {
|
||||
@@ -52,7 +56,7 @@ public class BiliBiliLoginDatabase extends SQLiteManager {
|
||||
}
|
||||
|
||||
public LoginUserDatabaseBean getUser(String userId) {
|
||||
List<LoginUserDatabaseBean> list = super.get(cookie.getTableName(), LoginUserDatabaseBean.class);
|
||||
List<LoginUserDatabaseBean> list = getAllUser();
|
||||
if (userId == null && !list.isEmpty()) {
|
||||
return list.getFirst();
|
||||
}
|
||||
@@ -64,6 +68,16 @@ public class BiliBiliLoginDatabase extends SQLiteManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<LoginUserDatabaseBean> getAllUser() {
|
||||
JSONArray jsonArray = super.getJSONArray(new LoginUserDatabaseBean(null).getTableName());
|
||||
List<LoginUserDatabaseBean> list = new ArrayList<>();
|
||||
for (Object o : jsonArray) {
|
||||
JSONObject json= (JSONObject) o;
|
||||
list.add(new LoginUserDatabaseBean(json.to(UserInfoBean.class)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return "bilibili_login.db";
|
||||
|
||||
Reference in New Issue
Block a user