修复fastjson的代码
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
package com.yutou.nas.bangumi;
|
||||
|
||||
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.nas.mybatis.dao.BangumiItemDao;
|
||||
import com.yutou.nas.mybatis.dao.BangumiListDao;
|
||||
import com.yutou.nas.mybatis.model.BangumiItem;
|
||||
@@ -67,7 +68,7 @@ public class AnimationController {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", 0);
|
||||
json.put("msg", "ok");
|
||||
json.put("data", JSONArray.toJSON(listDao.selectByExample(new BangumiListExample())));
|
||||
json.put("data", JSON.toJSON(listDao.selectByExample(new BangumiListExample())));
|
||||
return json.toJSONString();
|
||||
}
|
||||
@ResponseBody
|
||||
@@ -107,7 +108,7 @@ public class AnimationController {
|
||||
example.createCriteria().andBidEqualTo(type);
|
||||
json.put("code", 0);
|
||||
json.put("msg", "ok");
|
||||
json.put("data", JSONArray.toJSON(itemDao.selectByExample(example)));
|
||||
json.put("data", JSON.toJSON(itemDao.selectByExample(example)));
|
||||
return json.toJSONString();
|
||||
}
|
||||
@ResponseBody
|
||||
@@ -128,7 +129,7 @@ public class AnimationController {
|
||||
item.setCategories(animationData.nameToValue(item.getCategories(),false)+"");
|
||||
item.setAuthor(animationData.nameToValue(item.getAuthor(),true)+"");
|
||||
}
|
||||
JSONArray array= (JSONArray) JSONArray.toJSON(list);
|
||||
JSONArray array= (JSONArray) JSON.toJSON(list);
|
||||
return array.toJSONString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.yutou.nas.bangumi;
|
||||
|
||||
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.nas.utils.HttpTools;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
@@ -25,7 +26,7 @@ public class AnimationData {
|
||||
com.yutou.nas.utils.Log.i(String.format(animUrl, "" + index, title,type,team));
|
||||
com.yutou.nas.utils.Log.i(rss2jsonUrl + URLEncoder.encode(String.format(animUrl, "" + index, title,type,team), "UTF-8") +String.format( "&api_key=%s&count=500",rss2jsonApi_2));
|
||||
String js= HttpTools.get(rss2jsonUrl+ URLEncoder.encode(String.format(animUrl,""+index,title,type,team),"UTF-8")+String.format( "&api_key=%s&count=500",rss2jsonApi_2));
|
||||
JSONObject json=JSONObject.parseObject(js);
|
||||
JSONObject json= JSON.parseObject(js);
|
||||
if(json.getString("status").equals("ok")){
|
||||
return json.getJSONArray("items");
|
||||
}
|
||||
@@ -37,9 +38,9 @@ public class AnimationData {
|
||||
public int nameToValue(String name,boolean isTeam){
|
||||
JSONArray array;
|
||||
if(isTeam){
|
||||
array=JSONArray.parseArray(team);
|
||||
array=JSON.parseArray(team);
|
||||
}else{
|
||||
array=JSONArray.parseArray(type);
|
||||
array=JSON.parseArray(type);
|
||||
}
|
||||
for (Object o : array) {
|
||||
JSONObject json= (JSONObject) o;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.yutou.nas.bangumi;
|
||||
|
||||
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.nas.utils.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
@@ -22,7 +23,7 @@ public class BangumiTools {
|
||||
*/
|
||||
public static JSONObject getBangumi(int day) {
|
||||
String str = HttpTools.get(toDayBangumi);
|
||||
JSONArray main = JSONArray.parseArray(str);
|
||||
JSONArray main = JSON.parseArray(str);
|
||||
if (day == -1) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("bangumi", main);
|
||||
@@ -57,7 +58,7 @@ public class BangumiTools {
|
||||
*/
|
||||
public static JSONObject getBangumiInfo(int id) {
|
||||
String str = HttpTools.get(String.format(BangumiInfo, id + ""));
|
||||
return JSONObject.parseObject(str);
|
||||
return JSON.parseObject(str);
|
||||
}
|
||||
|
||||
public static JSONArray getPeople(int id) {
|
||||
@@ -114,7 +115,7 @@ public class BangumiTools {
|
||||
*/
|
||||
public static JSONObject search(String key) {
|
||||
String str = HttpTools.get(String.format(SearchBangumi, key));
|
||||
return JSONObject.parseObject(str);
|
||||
return JSON.parseObject(str);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user