调整天使动漫签到时间

修复大头菜不记录上周趋势的BUG
调整汇报大头菜结果时加入网页地址
This commit is contained in:
Yutousama 2021-12-26 09:08:54 +08:00
parent e0751972a3
commit 66ae1c4e8b
2 changed files with 41 additions and 34 deletions

View File

@ -40,7 +40,7 @@ public class TurnipProphet extends Model {
}
static int nowTime=-1;
static int nowTime = -1;
@Override
public boolean isUserPublic() {
@ -113,9 +113,12 @@ public class TurnipProphet extends Model {
String pattern = null;
JSONObject json;
JSONArray array;
if (StringUtils.isEmpty(data)||getDay()==0) {
if (StringUtils.isEmpty(data) || getDay() == 0) {
array = new JSONArray();
json = new JSONObject();
if (getDay() == 0 && !StringUtils.isEmpty(data)) {
json = JSONObject.parseObject(data);
}
array.add(-1);
array.add(-1);
array.add(-1);
@ -145,21 +148,23 @@ public class TurnipProphet extends Model {
}
if (getDay() == 0) {
if (json.containsKey("pattern")) {
if (!json.containsKey("tmp_pattern")) {
json.put("old_pattern", json.getString("pattern"));
pattern = json.getString("pattern");
}
if (money >= 90 && money <= 110) {
array.set(0, money);
}
} else {
if (money >= 9 && money <= 660) {
pattern = json.getString("old_pattern");
}
json.put("tmp_pattern", json.getString("pattern"));
}
array.set(0, money);
} else {
json.remove("tmp_pattern");
if (getTime() < 12) {
array.set(getDay() * 2 - 1, money);
} else {
array.set(getDay() * 2, money);
}
}
}
json.put("turnip", array);
StringBuilder builder = new StringBuilder();
for (Object o : array) {
@ -184,8 +189,8 @@ public class TurnipProphet extends Model {
QQBotManager.getInstance().sendMessage(qq, "已记录,正在预测本周走势...");
Map<String, String> map = openTurnip(prices, pattern);
if(map==null){
map=openTurnip(prices,pattern);
if (map == null) {
map = openTurnip(prices, pattern);
}
String tmp_pattern = sendQQ(map, prices, pattern, qq);
if (!StringUtils.isEmpty(tmp_pattern)) {
@ -202,11 +207,11 @@ public class TurnipProphet extends Model {
}
private String sendQQ(Map<String, String> map, String prices, String pattern, long qq) {
if (map == null) {
String url = String.format("https://turnipprophet.io?prices=%s%s",
prices,
pattern == null ? "" : "&pattern=" + pattern
);
if (map == null) {
QQBotManager.getInstance().sendMessage(qq, "没有结果,请检查数据是否有误。 \n网页预览\n" + url);
return null;
}
@ -243,6 +248,7 @@ public class TurnipProphet extends Model {
out.append(tmp.getString(TurnipData.MODEL)).append(":").append(tmp.getString(TurnipData.PR)).append("\n");
}
out.append("------------").append("\n");
out.append("网页版:").append("\n").append(url).append("\n");
out.append("祝好运 :)");
Log.i("TurnipProphet", out.toString());
@ -255,9 +261,10 @@ public class TurnipProphet extends Model {
super.onTime(time);
nowTime = Integer.parseInt(time.split(":")[0]);
}
public int getTime(){
if(nowTime==-1){
nowTime=Integer.parseInt(AppTools.getHours());
public int getTime() {
if (nowTime == -1) {
nowTime = Integer.parseInt(AppTools.getHours());
}
return nowTime;
}
@ -280,7 +287,7 @@ public class TurnipProphet extends Model {
);
System.out.println("url = " + url);
LinkedHashMap<String, String> map = new LinkedHashMap<>();
WebDriver driver =WebClient.getInstance().getWebDriver();
WebDriver driver = WebClient.getInstance().getWebDriver();
driver.get(url);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
@ -330,20 +337,20 @@ public class TurnipProphet extends Model {
}
}
}
int maxMoney=0;
String maxDay=null;
int maxMoney = 0;
String maxDay = null;
for (String key : map.keySet()) {
if(map.get(key).contains("~")){
if (map.get(key).contains("~")) {
for (String s : map.get(key).split("~")) {
if(Integer.parseInt(s)>maxMoney){
maxMoney=Integer.parseInt(s);
maxDay=key;
if (Integer.parseInt(s) > maxMoney) {
maxMoney = Integer.parseInt(s);
maxDay = key;
}
}
}else{
if(Integer.parseInt(map.get(key))>maxMoney){
maxMoney=Integer.parseInt(map.get(key));
maxDay=key;
} else {
if (Integer.parseInt(map.get(key)) > maxMoney) {
maxMoney = Integer.parseInt(map.get(key));
maxDay = key;
}
}
}

View File

@ -40,7 +40,7 @@ public class Tsdm extends Model {
@Override
public void onTime(String time) {
super.onTime(time);
if ("08:00:00".equals(time)) {
if ("08:05:00".equals(time)) {
Log.i("开始天使动漫签到");
try {
tsdmSign();