package com.yutou.bilibili.Test; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.yutou.bilibili.BiliBili.Live; import com.yutou.bilibili.BiliBili.LiveUtils; import com.yutou.bilibili.BiliBili.Tools.LiveT; import com.yutou.bilibili.BiliBili.Tools.SaveLive; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller public class TestController { @ResponseBody @RequestMapping("/add.do") public String test(int a) { return "ok"; } @ResponseBody @RequestMapping("/get.do") public JSONObject get(){ JSONObject json=new JSONObject(); JSONArray array=new JSONArray(); json.put("size", Live.lives.size()); for (Live live :Live.lives.values()) { JSONObject item=new JSONObject(); item.put("info", JSON.toJSON(live.getInfo())); item.put("data",JSON.toJSON(live.geData())); item.put("isLive", live.geData().getLive()==1); array.add(item); } json.put("array",array); json.put("saveVideo",JSONArray.toJSON(SaveLive.getInstance().getLiveList())); return json; } }