修复FastJSON大版本更新后API变动
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
package com.yutou.qqbot.models.Animal;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.qqbot.QQBotManager;
|
||||
import com.yutou.qqbot.models.Model;
|
||||
import com.yutou.qqbot.utlis.*;
|
||||
@@ -94,7 +95,7 @@ public class TurnipProphet extends Model {
|
||||
QQBotManager.getInstance().sendMessage(sendQQ, getMessage("没有本周数据,无法预测"));
|
||||
return;
|
||||
}
|
||||
JSONObject json = JSONObject.parseObject(data);
|
||||
JSONObject json = JSON.parseObject(data);
|
||||
String prices = json.getString("prices");
|
||||
String pattern = null;
|
||||
if (json.containsKey("old_pattern")) {
|
||||
@@ -132,7 +133,7 @@ public class TurnipProphet extends Model {
|
||||
array = new JSONArray();
|
||||
json = new JSONObject();
|
||||
if (getDay() == 0 && !StringUtils.isEmpty(data)) {
|
||||
json = JSONObject.parseObject(data);
|
||||
json = JSON.parseObject(data);
|
||||
}
|
||||
array.add(-1);
|
||||
array.add(-1);
|
||||
@@ -148,7 +149,7 @@ public class TurnipProphet extends Model {
|
||||
array.add(-1);
|
||||
array.add(-1);
|
||||
} else {
|
||||
json = JSONObject.parseObject(data);
|
||||
json = JSON.parseObject(data);
|
||||
array = json.getJSONArray("turnip");
|
||||
}
|
||||
if (array.getInteger(0) == -1 && getDay() != 0) {
|
||||
@@ -231,7 +232,7 @@ public class TurnipProphet extends Model {
|
||||
return null;
|
||||
}
|
||||
|
||||
JSONObject pr = JSONObject.parseObject(map.get(TurnipData.MODEL));
|
||||
JSONObject pr = JSON.parseObject(map.get(TurnipData.MODEL));
|
||||
JSONArray prArray = pr.getJSONArray(TurnipData.MODEL);
|
||||
StringBuilder out = new StringBuilder();
|
||||
out.append("预测结果如下:\n");
|
||||
@@ -350,7 +351,7 @@ public class TurnipProphet extends Model {
|
||||
map.put(TurnipProphet.TurnipData.MIX, tmp[15]);
|
||||
map.put(TurnipProphet.TurnipData.MAX, tmp[16]);
|
||||
} else {
|
||||
if (!array.toJSONString().contains(tmp[0])) {
|
||||
if (!array.toJavaList(String.class).contains(tmp[0])) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put(TurnipProphet.TurnipData.MODEL, tmp[0]);
|
||||
json.put(TurnipProphet.TurnipData.PR, tmp[1]);
|
||||
|
||||
Reference in New Issue
Block a user