init
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
package com.yutou.bilibili.BiliBili.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.BiliBili.LiveUtils;
|
||||
import com.yutou.bilibili.Tools.AppTools;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/bili/")
|
||||
public class BiliUserController {
|
||||
@ResponseBody
|
||||
@RequestMapping("/login/get/test.do")
|
||||
public JSONObject testLogin(){
|
||||
JSONObject json=new JSONObject();
|
||||
if(StringUtils.isEmpty(AppTools.readFile(new File("cookies.json")))){
|
||||
json.put("code",-1);
|
||||
json.put("msg","未登录");
|
||||
}else{
|
||||
JSONObject login= LiveUtils.getUserLoginInfo();
|
||||
JSONObject data=new JSONObject();
|
||||
json.put("code",login.getInteger("code"));
|
||||
data.put("uname",login.getJSONObject("data").getString("uname"));
|
||||
data.put("icon",login.getJSONObject("data").getString("face"));
|
||||
json.put("data",data);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
@ResponseBody
|
||||
@RequestMapping("/login/set/login.do")
|
||||
public JSONObject login(){
|
||||
JSONObject login=LiveUtils.http_get("https://passport.bilibili.com/qrcode/getLoginUrl");
|
||||
JSONObject json=new JSONObject();
|
||||
json.put("code",login.getInteger("code"));
|
||||
json.put("url",login.getJSONObject("data").getString("url"));
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
waitLogin(login.getJSONObject("data").getString("oauthKey"));
|
||||
}
|
||||
}).start();
|
||||
return json;
|
||||
}
|
||||
public void waitLogin(String oauthKey){
|
||||
long time=System.currentTimeMillis();
|
||||
String bd="gourl=https%3A%2F%2Fpassport.bilibili.com%2Fajax%2FminiLogin%2Fredirect&oauthKey="+oauthKey;
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
if((System.currentTimeMillis()-time)>5*60*1000){
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
JSONObject json=LiveUtils.http_post("https://passport.bilibili.com/qrcode/getLoginInfo",bd);
|
||||
if(json.containsKey("code")&&json.getInteger("code")==0){
|
||||
String _url=json.getJSONObject("data").getString("url");
|
||||
Map<String,String> map=AppTools.getUrlParams(_url);
|
||||
JSONObject tmp=LiveUtils.http_post(_url,"");
|
||||
JSONObject cookie=new JSONObject();
|
||||
for (String key : map.keySet()) {
|
||||
cookie.put(key,map.get(key));
|
||||
}
|
||||
String sid=tmp.getString("cookie");
|
||||
sid=sid.split("sid=")[1];
|
||||
sid=sid.split(";")[0];
|
||||
cookie.put("sid",sid);
|
||||
cookie.put("Domain",".bilibili.com");
|
||||
AppTools.saveFile(new File("cookies.json"),cookie.toJSONString());
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
},0,1000);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.yutou.bilibili.BiliBili.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.BiliBili.LiveUtils;
|
||||
import com.yutou.bilibili.BiliBili.Services.IBiliBiliLiveService;
|
||||
import com.yutou.bilibili.BiliBili.Tools.BiliTools;
|
||||
import com.yutou.bilibili.Services.IUserService;
|
||||
import com.yutou.bilibili.Tools.AppTools;
|
||||
import com.yutou.bilibili.Tools.ServiceTools;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||
import com.yutou.bilibili.mybatis.model.UUser;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Controller
|
||||
public class BiliVideoController {
|
||||
@Resource
|
||||
IUserService service;
|
||||
@Resource
|
||||
IBiliBiliLiveService liveService;
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/bili/video/get/list.do")
|
||||
public JSONObject videoList(HttpServletRequest request) {
|
||||
JSONObject json = new JSONObject();
|
||||
String token = AppTools.getLoginToken(request);
|
||||
UUser user = service.getUserToToken(token);
|
||||
if (user == null) {
|
||||
json.put("code", -1);
|
||||
json.put("msg", "未登录");
|
||||
json.put("data", new JSONObject());
|
||||
return json;
|
||||
}
|
||||
if (ServiceTools.getInstance().auth(request, user.getUser(), "/bili/video/get/")) {
|
||||
File file = new File("live");
|
||||
if (!file.exists() || Objects.requireNonNull(file.listFiles()).length == 0) {
|
||||
json.put("code", 0);
|
||||
json.put("msg", "文件夹为空");
|
||||
json.put("data", new JSONObject());
|
||||
} else {
|
||||
List<File> list = AppTools.scanFilePath("live");
|
||||
JSONArray array = new JSONArray();
|
||||
for (File f : list) {
|
||||
String date = f.getName().split(" ")[0].substring(1);
|
||||
String time = f.getName().split(" ")[1].split("\\]")[0];
|
||||
String roomid = f.getName().split("\\]")[1].replace(".mp4", "").trim();
|
||||
BilibiliUpInfo info = liveService.queryUpToRoomId(Integer.parseInt(roomid));
|
||||
long size = f.length();
|
||||
String _size;
|
||||
if (size < 1024) {
|
||||
_size = size + "B";
|
||||
} else if (size < 1048576) {
|
||||
_size = (size / 1024) + "KB";
|
||||
} else if (size < 1073741824) {
|
||||
_size = (size / 1048576) + "MB";
|
||||
} else {
|
||||
_size = (size / 1073741824) + "GB";
|
||||
}
|
||||
JSONObject item = new JSONObject();
|
||||
item.put("fileName", f.getName());
|
||||
item.put("fileSize", _size);
|
||||
item.put("date", date);
|
||||
item.put("time", time);
|
||||
item.put("name", info == null ? roomid : info.getName());
|
||||
array.add(item);
|
||||
}
|
||||
json.put("code", 0);
|
||||
json.put("msg", "ok");
|
||||
json.put("data", array);
|
||||
}
|
||||
} else {
|
||||
json.put("code", -2);
|
||||
json.put("msg", "未授权");
|
||||
json.put("data", new JSONObject());
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@RequestMapping("/bili/video/download/get.do")
|
||||
public ResponseEntity<FileSystemResource> download(String fileName) {
|
||||
System.out.println(fileName);
|
||||
String time = fileName.split(" ")[0].substring(1);
|
||||
System.out.println(time);
|
||||
File file = new File("live" + File.separator + time + File.separator + fileName);
|
||||
System.out.println(file.getAbsolutePath());
|
||||
return AppTools.getFile(file);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.yutou.bilibili.BiliBili.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.BiliBili.Datas.LiveData;
|
||||
import com.yutou.bilibili.BiliBili.Services.IBiliBiliLiveService;
|
||||
import com.yutou.bilibili.Tools.AppTools;
|
||||
import com.yutou.bilibili.Tools.ExcelUtils;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveInfo;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class OverviewController {
|
||||
@Resource
|
||||
IBiliBiliLiveService manager;
|
||||
|
||||
@RequestMapping("/overview/get/query.do")
|
||||
@ResponseBody
|
||||
public JSONObject queryOverview(Date startTime, Date endTime, BilibiliUpInfo upData) {
|
||||
JSONObject json = new JSONObject();
|
||||
JSONObject data = new JSONObject();
|
||||
//BiliBiliLiveDatabasesManager manager = BiliBiliLiveDatabasesManager.getInstance();
|
||||
data.put("giftCount", manager.queryGiftSize(upData.getRoomid(), -1, startTime, endTime));
|
||||
data.put("giftUserCount", manager.queryGiftUserToDistinct(upData, startTime, endTime, new String[]{
|
||||
LiveData.SEND_GIFT
|
||||
, LiveData.COMBO_SEND
|
||||
, LiveData.GUARD_BUY}));
|
||||
data.put("price", manager.queryPriceSize(upData.getRoomid(), startTime, endTime));
|
||||
long h = (endTime.getTime() - startTime.getTime()) % (1000 * 24 * 60 * 60) / (1000 * 60 * 60);
|
||||
System.out.println("相差:" + h + "小时");
|
||||
try {
|
||||
data.put("hprice", data.getInteger("price") / h);
|
||||
} catch (Exception e) {
|
||||
data.put("hprice", 0);
|
||||
}
|
||||
|
||||
|
||||
JSONArray array=new JSONArray();
|
||||
List<BilibiliLiveInfo> infos=manager.queryLiveInfo(upData,startTime,endTime);
|
||||
int maxUser=0;
|
||||
for (BilibiliLiveInfo info : infos) {
|
||||
System.out.println(info);
|
||||
maxUser+=info.getUserindex()+info.getVipuserindex();
|
||||
JSONObject item=new JSONObject();
|
||||
String nowTime = new SimpleDateFormat("HH").format(info.getSubtime());
|
||||
item.put("time",nowTime);
|
||||
item.put("popular",info.getPopular());
|
||||
item.put("user",info.getUserindex()+info.getVipuserindex());
|
||||
array.add(item);
|
||||
}
|
||||
try {
|
||||
Map<String, Integer> map = manager.queryUserGiftCount(upData, startTime, endTime);
|
||||
int huserGift = 0;
|
||||
for (String s : map.keySet()) {
|
||||
huserGift += map.get(s);
|
||||
}
|
||||
data.put("userGift", huserGift / maxUser);
|
||||
} catch (Exception e) {
|
||||
data.put("userGift", 0);
|
||||
}
|
||||
data.put("map",array);
|
||||
json.put("data",data);
|
||||
json.put("code",0);
|
||||
return json;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/overview/get/down.do")
|
||||
public JSONObject downExcel(Date startTime, Date endTime, BilibiliUpInfo upData){
|
||||
final String fileName=System.currentTimeMillis()+".xlsx";
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ExcelUtils.getInstance(upData.getRoomid(),startTime,endTime,fileName);
|
||||
}
|
||||
}).start();
|
||||
JSONObject json=new JSONObject();
|
||||
json.put("code",0);
|
||||
json.put("data",fileName);
|
||||
return json;
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("/overview/get/download.do")
|
||||
public ResponseEntity<FileSystemResource> downloadExcel(HttpServletRequest request, String fname){
|
||||
File file=new File("excel"+File.separator+fname);
|
||||
if(file.exists()) {
|
||||
return AppTools.getFile(file);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.yutou.bilibili.BiliBili.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.BiliBili.Datas.LiveData;
|
||||
import com.yutou.bilibili.BiliBili.Live;
|
||||
import com.yutou.bilibili.BiliBili.LiveUtils;
|
||||
import com.yutou.bilibili.BiliBili.Services.IBiliBiliLiveService;
|
||||
import com.yutou.bilibili.Tools.AppTools;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveInfo;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/realTimeData/")
|
||||
public class RealTimeDataController {
|
||||
@Resource
|
||||
IBiliBiliLiveService service;
|
||||
@ResponseBody
|
||||
@RequestMapping("get/query.do")
|
||||
public JSONObject queryToDayLiveData(int roomid,Date startTime,Date endTime) throws ParseException {
|
||||
JSONObject json = new JSONObject();
|
||||
BilibiliUpInfo info = service.queryUpToRoomId(roomid);
|
||||
Live live = LiveUtils.liveContains(info);
|
||||
if(startTime==null){
|
||||
startTime=AppTools.getToDayStartTime();
|
||||
}
|
||||
if(endTime==null){
|
||||
endTime=AppTools.getToDayNowTime();
|
||||
}
|
||||
int userCount = service.queryLiveData(info.getRoomid(), startTime, endTime, new String[]{LiveData.INTERACT_WORD}).size();
|
||||
int vipCount = service.queryLiveData(info.getRoomid(), startTime, endTime, new String[]{LiveData.ENTRY_EFFECT}).size();
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("roomid", roomid);
|
||||
data.put("popular",live==null?0:live.getInfo().getPopular());
|
||||
data.put("userLength", userCount);
|
||||
data.put("vipLength", vipCount);
|
||||
|
||||
JSONArray price = new JSONArray();
|
||||
//改写这个sql可以按时段统计数据
|
||||
List<Map<String, BigDecimal>> ps=service.queryTimeGroup(roomid, startTime, endTime);
|
||||
for (Map<String, BigDecimal> map : ps) {
|
||||
JSONObject pr = new JSONObject();
|
||||
pr.put("price", map.containsKey("price") ? map.get("price") : 0);
|
||||
pr.put("time", map.get("time"));
|
||||
price.add(pr);
|
||||
}
|
||||
|
||||
JSONArray giftArray = new JSONArray();
|
||||
Map<String, Integer> map = service.queryGiftSize(roomid,startTime,endTime);
|
||||
for (String key : map.keySet()) {
|
||||
JSONObject item = new JSONObject();
|
||||
if(key==null||key.equals("null"))
|
||||
continue;
|
||||
item.put("giftName",key);
|
||||
item.put("size",map.get(key));
|
||||
giftArray.add(item);
|
||||
}
|
||||
data.put("price", price);
|
||||
data.put("gift", giftArray);
|
||||
json.put("data", data);
|
||||
json.put("code",0);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.yutou.bilibili.BiliBili.Controllers;
|
||||
|
||||
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.LiveController;
|
||||
import com.yutou.bilibili.BiliBili.LiveUtils;
|
||||
import com.yutou.bilibili.BiliBili.Services.IBiliBiliLiveService;
|
||||
import com.yutou.bilibili.BiliBili.Tools.BiliTools;
|
||||
import com.yutou.bilibili.Services.IUserService;
|
||||
import com.yutou.bilibili.Tools.AppTools;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||
import com.yutou.bilibili.mybatis.model.UUser;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
public class UpInfoController {
|
||||
@Resource
|
||||
IBiliBiliLiveService service;
|
||||
@Resource
|
||||
IUserService userService;
|
||||
|
||||
@RequestMapping("/upinfo/get/list.do")
|
||||
@ResponseBody
|
||||
public JSONObject upInfoList(HttpServletRequest request) {
|
||||
String token= AppTools.getLoginToken(request);
|
||||
UUser user= userService.getUserToToken(token);
|
||||
JSONObject json = new JSONObject();
|
||||
if(user==null){
|
||||
json.put("code",-1);
|
||||
json.put("msg","未登录");
|
||||
json.put("data","[]");
|
||||
return json;
|
||||
}
|
||||
List<BilibiliUpInfo> upDataList =service.getUpInfo(user.getId(),user.getPower());
|
||||
System.out.println("UP用户数:" + upDataList.size());
|
||||
json.put("code", 0);
|
||||
json.put("data", JSONArray.toJSON(upDataList));
|
||||
return json;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/upinfo/set/add.do")
|
||||
public JSONObject addUpInfo(BilibiliUpInfo upData) {
|
||||
JSONObject json = new JSONObject();
|
||||
if (BiliTools.checkout(upData) != null) {
|
||||
upData.setEnable(0);
|
||||
upData = BiliTools.checkout(upData);
|
||||
System.out.println(upData);
|
||||
boolean flag = service.addUpInfo(upData);
|
||||
if (flag) {
|
||||
json.put("code", 0);
|
||||
json.put("msg", "添加成功");
|
||||
} else {
|
||||
json.put("code", -1);
|
||||
json.put("msg", "添加失败,该UP已经存在");
|
||||
}
|
||||
} else {
|
||||
json.put("code", -2);
|
||||
json.put("msg", "添加失败,可能参数有问题或该UP已经存在");
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/upinfo/set/update.do")
|
||||
public JSONObject update(BilibiliUpInfo upData) {
|
||||
JSONObject json = new JSONObject();
|
||||
System.out.println("old data ="+upData);
|
||||
BilibiliUpInfo old = service.queryUp(upData);
|
||||
if (!old.getUrl().equals(upData.getUrl())) {
|
||||
upData = BiliTools.checkout(upData);
|
||||
if (upData != null) {
|
||||
upData.setEnable(0);
|
||||
upData.setSavedanmu(0);
|
||||
upData.setOfflinelistening(0);
|
||||
}
|
||||
}
|
||||
System.out.println("save data = "+upData);
|
||||
boolean flag = service.updateUpInfo(upData);
|
||||
if (flag) {
|
||||
LiveController.getInstance().updateUpInfo(upData);
|
||||
json.put("code", 0);
|
||||
json.put("msg", "更新成功");
|
||||
} else {
|
||||
json.put("code", -1);
|
||||
json.put("msg", "更新失败,可能参数有问题");
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/upinfo/set/delete.do")
|
||||
public JSONObject delete(BilibiliUpInfo upData) {
|
||||
JSONObject json = new JSONObject();
|
||||
System.out.println(upData);
|
||||
boolean flag = service.deleteUp(upData);
|
||||
if (flag) {
|
||||
json.put("code", 0);
|
||||
json.put("msg", "删除成功");
|
||||
} else {
|
||||
json.put("code", -1);
|
||||
json.put("msg", "删除失败,可能参数有问题");
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/upinfo/get/query.do")
|
||||
public JSONObject query(BilibiliUpInfo upData) {
|
||||
upData = service.queryUp(upData);
|
||||
return (JSONObject) JSON.toJSON(upData);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/upinfo/get/liveInfo.do")
|
||||
public JSONObject liveInfo() {
|
||||
List<BilibiliUpInfo> list = service.getUpInfo();
|
||||
List<Live> lives=Live.lives;
|
||||
JSONObject json = new JSONObject();
|
||||
JSONObject data = new JSONObject();
|
||||
JSONArray info = new JSONArray();
|
||||
JSONArray liveArray = new JSONArray();
|
||||
int online=0;
|
||||
for (BilibiliUpInfo up : list) {
|
||||
if (LiveUtils.isLivePlayer(up.getRoomid())) {
|
||||
online++;
|
||||
if(LiveUtils.liveContains(up)==null){
|
||||
up.setLive(0);
|
||||
}else{
|
||||
up.setLive(1);
|
||||
}
|
||||
info.add(JSON.toJSON(up));
|
||||
}
|
||||
}
|
||||
for (Live live : lives) {
|
||||
if(live.geData().getLive()==1){
|
||||
liveArray.add(JSON.toJSON(live.geData()));
|
||||
}
|
||||
}
|
||||
data.put("online", online);
|
||||
data.put("info", info);
|
||||
data.put("live", liveArray);
|
||||
json.put("code", 0);
|
||||
json.put("data", data);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.yutou.bilibili.BiliBili.Datas;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BiliBiliUpData {
|
||||
int id;
|
||||
String name;
|
||||
String url;
|
||||
int roomId;
|
||||
boolean offlineListening;
|
||||
boolean enable;
|
||||
boolean saveDanmu;
|
||||
|
||||
public void setOfflineListening(int offlineListening) {
|
||||
this.offlineListening = offlineListening==1;
|
||||
}
|
||||
|
||||
public void setEnable(int enable) {
|
||||
this.enable = enable==1;
|
||||
}
|
||||
|
||||
public void setSaveDanmu(int saveDanmu) {
|
||||
this.saveDanmu = saveDanmu==1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.yutou.bilibili.BiliBili.Datas;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GiftData {
|
||||
int id;
|
||||
int price;
|
||||
String name;
|
||||
String desc;
|
||||
String rights;
|
||||
String icon;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.yutou.bilibili.BiliBili.Datas;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class LiveData {
|
||||
public static final String INTERACT_WORD="INTERACT_WORD";//普通用户进直播间
|
||||
public static final String ENTRY_EFFECT="ENTRY_EFFECT";//舰长进直播间
|
||||
public static final String DANMU_MSG="DANMU_MSG";//普通弹幕
|
||||
public static final String SEND_GIFT="SEND_GIFT";//送礼
|
||||
public static final String COMBO_SEND="COMBO_SEND";//礼物连击
|
||||
public static final String SUPER_CHAT_MESSAGE="SUPER_CHAT_MESSAGE";//SC
|
||||
public static final String NOTICE_MSG="NOTICE_MSG";//系统通知
|
||||
public static final String GUARD_BUY="GUARD_BUY";//购买、续费舰长等
|
||||
public static final String UNKNOWN_MESSAGE="UNKNOWN_MESSAGE";//未记录的事件
|
||||
int id;
|
||||
int roomId;
|
||||
int uid;
|
||||
String type;
|
||||
String msg;
|
||||
String giftName;
|
||||
int giftIndex;
|
||||
int giftId;
|
||||
int price;
|
||||
int priceOfCommission;
|
||||
Date subTime;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.yutou.bilibili.BiliBili.Datas;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class LiveInfo {
|
||||
int id;
|
||||
int roomId;
|
||||
int popular;
|
||||
int userIndex;
|
||||
int vipUserIndex;
|
||||
Date subTime;
|
||||
}
|
||||
554
src/main/java/com/yutou/bilibili/BiliBili/Live.java
Normal file
554
src/main/java/com/yutou/bilibili/BiliBili/Live.java
Normal file
@@ -0,0 +1,554 @@
|
||||
package com.yutou.bilibili.BiliBili;
|
||||
|
||||
import com.yutou.bilibili.BiliBili.Datas.GiftData;
|
||||
import com.yutou.bilibili.BiliBili.Datas.LiveData;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.BiliBili.Services.IBiliBiliLiveService;
|
||||
import com.yutou.bilibili.BiliBili.Tools.SaveLive;
|
||||
import com.yutou.bilibili.Tools.AppTools;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveData;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveInfo;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||
import com.yutou.bilibili.sqlite.BiliBiliLiveDatabasesManager;
|
||||
import org.java_websocket.client.WebSocketClient;
|
||||
import org.java_websocket.handshake.ServerHandshake;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class Live implements ApplicationContextAware {
|
||||
IBiliBiliLiveService service;
|
||||
|
||||
|
||||
public static List<Live> lives = new ArrayList<>();
|
||||
|
||||
|
||||
private int roomId;
|
||||
private boolean isLogin;
|
||||
private boolean run;
|
||||
private int userId;
|
||||
private WebSocketClient client;
|
||||
private int popular;
|
||||
private BilibiliLiveInfo info;
|
||||
private BilibiliUpInfo upData;
|
||||
private Timer heartBeattimer;
|
||||
private String danmuFileName;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
|
||||
}
|
||||
|
||||
public Live() {
|
||||
if (applicationContext != null)
|
||||
service = getBean(IBiliBiliLiveService.class);
|
||||
info = new BilibiliLiveInfo();
|
||||
info.setGiftuser(0);
|
||||
info.setPopular(0);
|
||||
info.setUserindex(0);
|
||||
info.setVipuserindex(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
*
|
||||
* @param roomId 直播间roomId,不是房间号,有可能是临时房间号,得通过 {@link com.yutou.bilibili.BiliBili.Tools.BiliTools#getBiliUpInfo(String)} 来获取roomId
|
||||
* @param isLogin 是否登录用户
|
||||
*/
|
||||
public void add(int roomId, boolean isLogin) {
|
||||
this.roomId = roomId;
|
||||
this.isLogin = isLogin;
|
||||
this.danmuFileName = "[" + AppTools.getToDayTime() + "]_" + roomId + "_" + System.currentTimeMillis();
|
||||
upData = new BilibiliUpInfo();
|
||||
upData.setRoomid(roomId);
|
||||
info.setRoomid(roomId);
|
||||
info.setGiftuser(0);
|
||||
info.setVipuserindex(0);
|
||||
info.setUserindex(0);
|
||||
Live.lives.add(this);
|
||||
updateUpInfo();
|
||||
System.out.println("roomId = " + roomId + ", isLogin = " + isLogin);
|
||||
}
|
||||
|
||||
private void updateUpInfo() {
|
||||
try {
|
||||
upData = service.queryUp(upData);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private int reloadLike = 0;
|
||||
|
||||
/**
|
||||
* 开始监听
|
||||
*
|
||||
* @throws Exception 发生异常
|
||||
*/
|
||||
public void start() throws Exception {
|
||||
run = true;
|
||||
if (LiveUtils.isLivePlayer(roomId)) {
|
||||
upData.setLive(1);
|
||||
}
|
||||
String url = LiveUtils.getLiveUrl(roomId);
|
||||
HashMap<String, String> header = new HashMap<String, String>();
|
||||
header.put("Sec-WebSocket-Extensions", "permessage-deflate; client_max_window_bits");
|
||||
header.put("Sec-WebSocket-Key", "tORCZd8AI6xIyvqvgvI1Vw==");
|
||||
header.put("Sec-WebSocket-Version", "13");
|
||||
header.put("Cache-Control", "no-cache");
|
||||
header.put("Connection", "Upgrade");
|
||||
header.put("Host", "tx-gz-live-comet-02.chat.bilibili.com");
|
||||
header.put("Origin", "https://live.bilibili.com");
|
||||
header.put("Pragma", "no-cache");
|
||||
header.put("Upgrade", "websocket");
|
||||
header.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36");
|
||||
client = new WebSocketClient(new URI(url), header) {
|
||||
private long time = 0;
|
||||
private boolean init = true;
|
||||
|
||||
@Override
|
||||
public void onOpen(ServerHandshake serverHandshake) {
|
||||
time = System.currentTimeMillis();
|
||||
System.out.println("ws: ok");
|
||||
try {
|
||||
likeLive();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(ByteBuffer bytes) {
|
||||
super.onMessage(bytes);
|
||||
if (init) {
|
||||
heartBeattimer = new Timer();
|
||||
heartBeattimer.schedule(new sendHeartbeat(), 2000, 20000);
|
||||
init = false;
|
||||
}
|
||||
decompress(bytes.array());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose(int i, String s, boolean b) {
|
||||
System.out.println("连接时间:" + (System.currentTimeMillis() - time));
|
||||
if (upData.getOfflinelistening() == 1) {
|
||||
System.err.println(roomId + " 断开连接,重连...");
|
||||
try {
|
||||
init = true;
|
||||
heartBeattimer.cancel();
|
||||
client.close();
|
||||
start();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
stop();
|
||||
client.close();
|
||||
run = false;
|
||||
throw new RuntimeException("连接关闭: code = " + i + " msg = " + s + " b = " + b + " roomId=" + roomId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClosing(int code, String reason, boolean remote) {
|
||||
super.onClosing(code, reason, remote);
|
||||
System.out.println("code = " + code + ", reason = " + reason + ", remote = " + remote);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception e) {
|
||||
e.printStackTrace();
|
||||
run = false;
|
||||
client.close();
|
||||
}
|
||||
};
|
||||
client.connect();
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
run = false;
|
||||
client.close();
|
||||
if (SaveLive.getInstance().checkLive(roomId)) {
|
||||
SaveLive.getInstance().stop(roomId);
|
||||
}
|
||||
Live.lives.remove(this);
|
||||
System.out.printf("退出%d直播间%n", roomId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接房间
|
||||
*
|
||||
* @throws Exception e
|
||||
*/
|
||||
private void likeLive() throws Exception {
|
||||
JSONObject tmp = LiveUtils.http_get("https://api.bilibili.com/x/web-interface/nav");
|
||||
if (tmp.getInteger("code") == -101) {
|
||||
if (isLogin) {
|
||||
new File("cookies.json").deleteOnExit();
|
||||
upData.setLive(0);
|
||||
service.updateUpInfo(upData);
|
||||
stop();
|
||||
return;
|
||||
} else {
|
||||
userId = 0;
|
||||
}
|
||||
} else if (tmp.getInteger("code") == 0) {
|
||||
userId = tmp.getJSONObject("data").getInteger("mid");
|
||||
}
|
||||
JSONObject http = LiveUtils.http_get("https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo?id=" + roomId + "&type=0");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("uid", userId);
|
||||
json.put("roomid", roomId);
|
||||
json.put("protover", 2);
|
||||
json.put("platform", "web");
|
||||
json.put("clientver", "2.6.36");
|
||||
json.put("type", 2);
|
||||
json.put("key", http.getJSONObject("data").getString("token"));
|
||||
System.out.println(json.toJSONString());
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
outputStream.write(LiveUtils.toLH(json.toJSONString().length() + 16));
|
||||
outputStream.write(new byte[]{0, 16, 0, 1, 0, 0, 0, 7, 0, 0, 0, 1});
|
||||
outputStream.write(json.toJSONString().getBytes(StandardCharsets.UTF_8));
|
||||
outputStream.flush();
|
||||
// LiveUtils.printHex(outputStream.toByteArray());
|
||||
client.send(outputStream.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 解压缩
|
||||
*
|
||||
* @param data 待压缩的数据
|
||||
*/
|
||||
public void decompress(byte[] data) {
|
||||
try {
|
||||
|
||||
byte[] bytes = new byte[data.length - 16];
|
||||
System.arraycopy(data, 16, bytes, 0, data.length - 16);
|
||||
|
||||
|
||||
if (data.length > 32) {
|
||||
List<String> list = LiveUtils.getMsgList(LiveUtils.dec(bytes), new ArrayList<>(), true);
|
||||
for (String str : list) {
|
||||
processData(str, data);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
JSONObject json = JSONObject.parseObject(new String(bytes, StandardCharsets.UTF_8));
|
||||
System.out.println(json);
|
||||
} catch (Exception e) {
|
||||
popular = LiveUtils.bytesToInt2(bytes, 0);
|
||||
info.setPopular(popular);
|
||||
}
|
||||
}
|
||||
checkLive();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("----------ERROR----------");
|
||||
System.out.println(new String(data, StandardCharsets.UTF_8));
|
||||
LiveUtils.printHex(LiveUtils.dec(data));
|
||||
System.out.println(new SimpleDateFormat("HH:mm:ss.SSS").format(new Date()));
|
||||
}
|
||||
}
|
||||
|
||||
private void checkLive() {
|
||||
boolean isLive = LiveUtils.isLivePlayer(roomId);
|
||||
upData.setLive(isLive ? 1 : 0);
|
||||
if (isLive && upData.getSavelive() == 1) {
|
||||
SaveLive.getInstance().addLive(this);
|
||||
}
|
||||
}
|
||||
|
||||
public BiliBiliLiveDatabasesManager danmuManager;
|
||||
|
||||
/**
|
||||
* 处理数据
|
||||
*
|
||||
* @param msg 数据json
|
||||
* @param bytes 原始hex数据
|
||||
*/
|
||||
public void processData(String msg, byte[] bytes) {
|
||||
try {
|
||||
JSONObject json = JSONObject.parseObject(msg);
|
||||
JSONObject data;
|
||||
BilibiliLiveData liveData = new BilibiliLiveData();
|
||||
String danmu = null;
|
||||
GiftData giftData;
|
||||
|
||||
switch (json.getString("cmd")) {
|
||||
case "INTERACT_WORD"://普通用户进直播间
|
||||
// System.out.println(json.getJSONObject("data").getString("uname") + " 进入到直播间");
|
||||
danmu = json.getJSONObject("data").getString("uname") + " 进入到直播间";
|
||||
liveData.setUid(json.getJSONObject("data").getInteger("uid"));
|
||||
liveData.setType(LiveData.INTERACT_WORD);
|
||||
liveData.setMsg(danmu);
|
||||
liveData.setRoomid(roomId);
|
||||
liveData.setSubtime(new Date());
|
||||
service.addLiveData(liveData);
|
||||
break;
|
||||
case "DANMU_MSG"://普通弹幕
|
||||
danmu = json.getJSONArray("info").getJSONArray(2).getString(1) + ":" + json.getJSONArray("info").getString(1);
|
||||
liveData.setUid(json.getJSONArray("info").getJSONArray(2).getInteger(0));
|
||||
liveData.setType(LiveData.DANMU_MSG);
|
||||
liveData.setMsg(danmu);
|
||||
liveData.setRoomid(roomId);
|
||||
liveData.setSubtime(new Date());
|
||||
if (upData != null && upData.getSavedanmu() == 1) {
|
||||
// service.addLiveData(liveData);
|
||||
/* if(danmuManager==null){
|
||||
danmuManager=BiliBiliLiveDatabasesManager.getInstance();
|
||||
danmuManager.init(danmuFileName);
|
||||
}
|
||||
danmuManager.addLiveData(liveData);*/
|
||||
}
|
||||
System.out.println(json);
|
||||
break;
|
||||
case "SEND_GIFT"://送礼
|
||||
data = json.getJSONObject("data");
|
||||
giftData = getGiftData(data.getInteger("giftId"));
|
||||
if (giftData == null) {
|
||||
giftData = new GiftData();
|
||||
giftData.setName(data.getString("giftName"));
|
||||
giftData.setId(data.getInteger("giftId"));
|
||||
giftData.setPrice(data.getInteger("price"));
|
||||
giftData.setIcon("");
|
||||
giftData.setDesc("这是阿B没有收录的礼物,金额可能不准(无法判别为免费礼物)");
|
||||
giftData.setRights("?");
|
||||
}
|
||||
danmu = data.getString("uname") + " " + data.getString("action") + " " + giftData.getName();
|
||||
liveData.setType(LiveData.SEND_GIFT);
|
||||
liveData.setUid(data.getInteger("uid"));
|
||||
liveData.setGiftid(giftData.getId());
|
||||
liveData.setGiftindex(data.getInteger("num"));
|
||||
liveData.setGiftname(giftData.getName());
|
||||
liveData.setMsg(danmu);
|
||||
liveData.setPrice(giftData.getPrice());
|
||||
liveData.setPriceofcommission(giftData.getPrice() == 0 ? 0 : giftData.getPrice() / 2);
|
||||
liveData.setSubtime(new Date());
|
||||
liveData.setRoomid(roomId);
|
||||
info.setGiftuser(info.getGiftuser() + 1);
|
||||
service.addLiveData(liveData);
|
||||
break;
|
||||
case "COMBO_SEND"://礼物连击
|
||||
data = json.getJSONObject("data");
|
||||
String gift = data.getString("giftName");
|
||||
if (gift == null || gift.equals("null")) {
|
||||
gift = data.getString("gift_name");
|
||||
}
|
||||
danmu = data.getString("uname") + " " + data.getString("action") + " " + gift + "x" + data.getInteger("batch_combo_num");
|
||||
giftData = getGiftData(data.getInteger("gift_id"));
|
||||
if (giftData == null) {
|
||||
giftData = new GiftData();
|
||||
giftData.setName(data.getString("giftName"));
|
||||
giftData.setId(data.getInteger("giftId"));
|
||||
giftData.setPrice(data.getInteger("price"));
|
||||
giftData.setIcon("");
|
||||
giftData.setDesc("这是阿B没有收录的礼物,金额可能不准(无法判别为免费礼物)");
|
||||
giftData.setRights("?");
|
||||
}
|
||||
liveData.setType(LiveData.COMBO_SEND);
|
||||
liveData.setUid(data.getInteger("uid"));
|
||||
liveData.setGiftid(giftData.getId());
|
||||
liveData.setGiftindex(data.getInteger("batch_combo_num"));
|
||||
liveData.setGiftname(giftData.getName());
|
||||
liveData.setMsg(danmu);
|
||||
liveData.setPrice(giftData.getPrice() * liveData.getGiftindex());
|
||||
liveData.setPriceofcommission(giftData.getPrice() == 0 ? 0 : giftData.getPrice() / 2);
|
||||
liveData.setSubtime(new Date());
|
||||
liveData.setRoomid(roomId);
|
||||
info.setGiftuser(info.getGiftuser() + 1);
|
||||
service.addLiveData(liveData);
|
||||
break;
|
||||
case "ENTRY_EFFECT"://舰长进直播间
|
||||
// System.out.println("[舰长]" + json.getJSONObject("data").getString("uid") + " 进入到直播间");
|
||||
info.setVipuserindex(info.getVipuserindex() + 1);
|
||||
danmu = "[舰长]" + json.getJSONObject("data").getString("uid") + " 进入到直播间";
|
||||
liveData.setUid(json.getJSONObject("data").getInteger("uid"));
|
||||
liveData.setType(LiveData.ENTRY_EFFECT);
|
||||
liveData.setMsg(danmu);
|
||||
liveData.setRoomid(roomId);
|
||||
liveData.setSubtime(new Date());
|
||||
service.addLiveData(liveData);
|
||||
break;
|
||||
case "LIVE_INTERACTIVE_GAME"://彩色弹幕?通过游戏弹幕
|
||||
break;
|
||||
case "SUPER_CHAT_MESSAGE"://SC
|
||||
data = json.getJSONObject("data");
|
||||
danmu = data.getJSONObject("user_info").getString("uname") + " "
|
||||
+ data.getJSONObject("gift").getString("gift_name") + " " + data.getInteger("price") + "元: " + data.getString("message");
|
||||
liveData.setType(LiveData.SUPER_CHAT_MESSAGE);
|
||||
liveData.setUid(data.getInteger("uid"));
|
||||
liveData.setMsg(danmu);
|
||||
liveData.setGiftid(0);
|
||||
liveData.setRoomid(roomId);
|
||||
liveData.setGiftname(data.getJSONObject("gift").getString("gift_name"));
|
||||
liveData.setGiftindex(1);
|
||||
liveData.setPrice(data.getInteger("price") * 1000);
|
||||
liveData.setPriceofcommission(liveData.getPrice() == 0 ? 0 : liveData.getPrice() / 2);
|
||||
liveData.setSubtime(new Date());
|
||||
info.setGiftuser(info.getGiftuser() + 1);
|
||||
service.addLiveData(liveData);
|
||||
break;
|
||||
case "USER_TOAST_MSG":
|
||||
break;
|
||||
case "GUARD_BUY"://开通/续费 牛逼的东西
|
||||
data = json.getJSONObject("data");
|
||||
liveData.setType(LiveData.GUARD_BUY);
|
||||
liveData.setUid(data.getInteger("uid"));
|
||||
liveData.setMsg(data.getString("gift_name"));
|
||||
liveData.setGiftid(-data.getInteger("guard_level"));
|
||||
liveData.setGiftindex(data.getInteger("num"));
|
||||
liveData.setGiftname(data.getString("gift_name"));
|
||||
liveData.setPrice(data.getInteger("price"));
|
||||
liveData.setPriceofcommission(liveData.getPrice() == 0 ? 0 : liveData.getPrice() / 2);
|
||||
liveData.setSubtime(new Date());
|
||||
liveData.setRoomid(roomId);
|
||||
info.setGiftuser(info.getGiftuser() + 1);
|
||||
service.addLiveData(liveData);
|
||||
break;
|
||||
case "SUPER_CHAT_MESSAGE_JPN":
|
||||
case "NOTICE_MSG":
|
||||
case "HOT_RANK_CHANGED"://榜单更新等无用信息
|
||||
case "ONLINE_RANK_COUNT":
|
||||
case "ONLINE_RANK_V2":
|
||||
case "ONLINE_RANK_TOP3":
|
||||
case "ROOM_REAL_TIME_MESSAGE_UPDATE":
|
||||
case "WIDGET_BANNER"://鬼知道是啥
|
||||
case "HOT_RANK_SETTLEMENT":
|
||||
case "LIVE"://开始直播,不过有在心跳包上做检测了,所以也无所谓?
|
||||
case "PK_BATTLE_SETTLE_V2":
|
||||
case "PK_BATTLE_END":
|
||||
case "PK_BATTLE_SETTLE":
|
||||
case "PK_BATTLE_PRE_NEW":
|
||||
case "PK_BATTLE_PRE":
|
||||
|
||||
|
||||
//System.out.println(msg);
|
||||
break;
|
||||
default:
|
||||
System.out.println(msg);
|
||||
liveData = new BilibiliLiveData();
|
||||
liveData.setType(LiveData.UNKNOWN_MESSAGE);
|
||||
liveData.setUid(-1);
|
||||
liveData.setMsg(msg);
|
||||
liveData.setRoomid(roomId);
|
||||
liveData.setSubtime(new Date());
|
||||
service.addLiveData(liveData);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
JSONObject.parseObject(new String(bytes, StandardCharsets.UTF_8));
|
||||
processData(new String(bytes, StandardCharsets.UTF_8), null);
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
System.out.println(msg);
|
||||
System.out.println("---------ERROR !!-----");
|
||||
System.out.println();
|
||||
LiveUtils.printHex(bytes);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void clearInfo() {
|
||||
info = new BilibiliLiveInfo();
|
||||
}
|
||||
|
||||
public BilibiliLiveInfo getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void setSaveDanmo(boolean saveDanmu) {
|
||||
upData.setSavedanmu(saveDanmu ? 1 : 0);
|
||||
}
|
||||
|
||||
private static ApplicationContext applicationContext = null;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
if (Live.applicationContext == null) {
|
||||
Live.applicationContext = applicationContext;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T getBean(Class<T> clazz) {
|
||||
return applicationContext.getBean(clazz);
|
||||
}
|
||||
|
||||
public BilibiliUpInfo geData() {
|
||||
return upData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送心跳包
|
||||
*/
|
||||
public class sendHeartbeat extends TimerTask {
|
||||
|
||||
public sendHeartbeat() {
|
||||
|
||||
}
|
||||
|
||||
public void run() {
|
||||
if (!run) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
updateUpInfo();
|
||||
if (upData.getOfflinelistening() != 1 && !LiveUtils.isLivePlayer(upData.getRoomid())) {
|
||||
stop();
|
||||
}
|
||||
try {
|
||||
// System.out.println("-------发送心跳--------");
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
outputStream.write(LiveUtils.toLH("[object Object]".length() + 16));
|
||||
outputStream.write(new byte[]{0, 16, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1});
|
||||
outputStream.write("[object Object]".getBytes(StandardCharsets.UTF_8));
|
||||
outputStream.flush();
|
||||
client.send(outputStream.toByteArray());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(client.isClosed());
|
||||
System.out.println(client.isOpen());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public GiftData getGiftData(int id) {
|
||||
for (GiftData data : LiveUtils.LiveGiftConfig.giftDataList) {
|
||||
if (data.getId() == id) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
GiftData data = new GiftData();
|
||||
BilibiliLiveData liveData = service.queryGiftOfId(id);
|
||||
if (liveData == null) {
|
||||
return null;
|
||||
}
|
||||
data.setName(liveData.getGiftname());
|
||||
data.setPrice(liveData.getPrice());
|
||||
data.setIcon("");
|
||||
data.setDesc("这是阿B没有收录的礼物,金额可能不准(无法判别为免费礼物)");
|
||||
data.setRights("?");
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.yutou.bilibili.BiliBili;
|
||||
|
||||
import com.yutou.bilibili.BiliBili.Tools.SaveLive;
|
||||
import com.yutou.bilibili.Tools.AppTools;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Timer;
|
||||
|
||||
public class LiveController {
|
||||
private static LiveController controller;
|
||||
private Timer timer;
|
||||
|
||||
public static LiveController getInstance() {
|
||||
if (controller == null) {
|
||||
controller = new LiveController();
|
||||
}
|
||||
return controller;
|
||||
}
|
||||
|
||||
private LiveController() {
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
|
||||
}
|
||||
|
||||
public void updateUpInfo(BilibiliUpInfo data) {
|
||||
Live live = LiveUtils.liveContains(data);
|
||||
if (live != null) {
|
||||
live.setSaveDanmo(data.getSavedanmu() == 1);
|
||||
boolean saveLive=SaveLive.getInstance().checkLive(data.getRoomid());
|
||||
if(data.getSavelive()==1){
|
||||
if(!saveLive){
|
||||
SaveLive.getInstance().addLive(live);
|
||||
}
|
||||
}else{
|
||||
if(saveLive){
|
||||
SaveLive.getInstance().stop(data.getRoomid());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (data.getEnable()==1||data.getOfflinelistening()==1) {
|
||||
if (live == null) {
|
||||
try {
|
||||
live=new Live();
|
||||
live.add(data.getRoomid(), !StringUtils.isEmpty(AppTools.readFile(new File("cookies.json"))));
|
||||
live.start();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (live != null) {
|
||||
live.stop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
351
src/main/java/com/yutou/bilibili/BiliBili/LiveUtils.java
Normal file
351
src/main/java/com/yutou/bilibili/BiliBili/LiveUtils.java
Normal file
@@ -0,0 +1,351 @@
|
||||
package com.yutou.bilibili.BiliBili;
|
||||
|
||||
import com.yutou.bilibili.BiliBili.Datas.GiftData;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.BiliBili.Services.IBiliBiliLiveService;
|
||||
import com.yutou.bilibili.Tools.AppTools;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.zip.Inflater;
|
||||
|
||||
public class LiveUtils {
|
||||
private static String cookie=null;
|
||||
|
||||
public LiveUtils() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static String getLiveUrl(int roomId) {
|
||||
JSONObject json = http_get("https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo?id=" + roomId + "&type=0");
|
||||
return "wss://" + json.getJSONObject("data").getJSONArray("host_list").getJSONObject(0).getString("host") + "/sub";
|
||||
}
|
||||
|
||||
public static void printHex(byte[] bytes) {
|
||||
String str = DatatypeConverter.printHexBinary(bytes);
|
||||
for (int i = 0; i < str.length(); i = i + 4) {
|
||||
if (i % 32 == 0 && i != 0) {
|
||||
System.out.println();
|
||||
}
|
||||
if (str.length() - i > 4) {
|
||||
System.out.print(str.substring(i, i + 4));
|
||||
} else {
|
||||
System.out.println(str.substring(i));
|
||||
}
|
||||
System.out.print(" ");
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] dec(byte[] data) {
|
||||
byte[] output = new byte[0];
|
||||
|
||||
Inflater decompresser = new Inflater();
|
||||
decompresser.reset();
|
||||
decompresser.setInput(data);
|
||||
|
||||
ByteArrayOutputStream o = new ByteArrayOutputStream(data.length);
|
||||
try {
|
||||
byte[] buf = new byte[1024];
|
||||
while (!decompresser.finished()) {
|
||||
int i = decompresser.inflate(buf);
|
||||
o.write(buf, 0, i);
|
||||
}
|
||||
output = o.toByteArray();
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
try {
|
||||
JSONObject json = JSONObject.parseObject(new String(data, StandardCharsets.UTF_8));
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
// outputStream.write(toLH(json.toJSONString().length() + 16));
|
||||
//outputStream.write(new byte[]{0, 16, 0, 1, 0, 0, 0, 5, 0, 0, 0, 1});
|
||||
outputStream.write(json.toJSONString().getBytes(StandardCharsets.UTF_8));
|
||||
output = outputStream.toByteArray();
|
||||
} catch (Exception e1) {
|
||||
output = data;
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
o.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
decompresser.end();
|
||||
return output;
|
||||
}
|
||||
|
||||
public static List<String> getMsgList(byte[] bytes, List<String> list, boolean isOne) {
|
||||
int len = 16;
|
||||
ByteBuffer datas = ByteBuffer.allocate(bytes.length - len);
|
||||
byte[] heads = new byte[4];
|
||||
//获取到头信息
|
||||
System.arraycopy(bytes, 0, heads, 0, 4);
|
||||
int size = bytesToInt2(heads, 0) - 16;
|
||||
|
||||
//datas=MainApp.dec(datas);
|
||||
if (size == datas.array().length) {
|
||||
System.arraycopy(bytes, len, datas.array(), 0, bytes.length - len);
|
||||
list.add(new String(datas.array(), StandardCharsets.UTF_8));
|
||||
} else {
|
||||
try {
|
||||
// System.out.println("datas size = " + size);
|
||||
if (size > 1000000000) {
|
||||
try {
|
||||
JSONObject.parseObject(new String(bytes));
|
||||
list.add(new String(bytes, StandardCharsets.UTF_8));
|
||||
return list;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
datas.clear();
|
||||
datas = ByteBuffer.allocate(size);
|
||||
System.arraycopy(bytes, len, datas.array(), 0, size);
|
||||
list.add(new String(datas.array(), StandardCharsets.UTF_8));
|
||||
byte[] tmps = new byte[bytes.length - size - 16];
|
||||
int length = bytes.length - (size + len);
|
||||
System.arraycopy(bytes, size + (len), tmps, 0, length);
|
||||
|
||||
getMsgList(tmps, list, false);
|
||||
} catch (Exception e) {
|
||||
list.add(new String(bytes, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static byte[] toLH(int n) {
|
||||
byte[] b = new byte[4];
|
||||
b[3] = (byte) (n & 0xff);
|
||||
b[2] = (byte) (n >> 8 & 0xff);
|
||||
b[1] = (byte) (n >> 16 & 0xff);
|
||||
b[0] = (byte) (n >> 24 & 0xff);
|
||||
return b;
|
||||
}
|
||||
|
||||
public static int bytesToInt2(byte[] src, int offset) {
|
||||
int value;
|
||||
value = (int) (((src[offset] & 0xFF) << 24)
|
||||
| ((src[offset + 1] & 0xFF) << 16)
|
||||
| ((src[offset + 2] & 0xFF) << 8)
|
||||
| (src[offset + 3] & 0xFF));
|
||||
return value;
|
||||
}
|
||||
|
||||
public static String getCookie() {
|
||||
if (StringUtils.isEmpty(getFile("cookies.json"))) {
|
||||
|
||||
return "";
|
||||
}
|
||||
JSONObject json = JSONObject.parseObject(getFile("cookies.json"));
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (String s : json.keySet()) {
|
||||
builder.append(s).append("=").append(json.getString(s)).append(";");
|
||||
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
/* public static String createCookie(){
|
||||
String bid="AUTO"+AppTools.randomString(16,new String[]{AppTools.numbers});
|
||||
bid="AUTO6616152607312876";
|
||||
return String.format("LIVE_BUVID=%s; _uuid=%sinfoc; buvid3=%sinfoc; sid=%s; fingerprint=%s; buvid_fp=%sinfoc; buvid_fp_plain=%sinfoc; PVID=%d;"
|
||||
,bid
|
||||
,UUID.randomUUID().toString()
|
||||
,UUID.randomUUID().toString()
|
||||
,"bm3byv4p"
|
||||
,"074eae35a01a56c40558a54ab33179e5"
|
||||
,UUID.randomUUID().toString()
|
||||
,UUID.randomUUID().toString()
|
||||
,AppTools.randomCommon(0,9,1)[0]);
|
||||
}*/
|
||||
|
||||
public static JSONObject http_get(String url) {
|
||||
try {
|
||||
HttpURLConnection connection = getBiliHttpGet(url, getCookie());
|
||||
BufferedInputStream stream = new BufferedInputStream(connection.getInputStream());
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
byte[] bytes = new byte[1024];
|
||||
int len = 0, size;
|
||||
while ((len = stream.read(bytes)) != -1) {
|
||||
outputStream.write(bytes, 0, len);
|
||||
outputStream.flush();
|
||||
}
|
||||
String str = new String(outputStream.toByteArray(), StandardCharsets.UTF_8);
|
||||
outputStream.close();
|
||||
try {
|
||||
JSONObject json = JSON.parseObject(str);
|
||||
return json;
|
||||
} catch (Exception e) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("html", str);
|
||||
return json;
|
||||
} finally {
|
||||
|
||||
stream.close();
|
||||
connection.disconnect();
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new JSONObject();
|
||||
}
|
||||
|
||||
public static JSONObject http_post(String url, String body) {
|
||||
try {
|
||||
HttpURLConnection connection = getBiliHttpPost(url, getCookie());
|
||||
OutputStream connectionOutputStream = null;
|
||||
if (!StringUtils.isEmpty(body)) {
|
||||
connectionOutputStream = connection.getOutputStream();
|
||||
connectionOutputStream.write(body.getBytes(StandardCharsets.UTF_8));
|
||||
connectionOutputStream.flush();
|
||||
}
|
||||
BufferedInputStream stream = new BufferedInputStream(connection.getInputStream());
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
byte[] bytes = new byte[1024];
|
||||
int len = 0, size;
|
||||
while ((len = stream.read(bytes)) != -1) {
|
||||
outputStream.write(bytes, 0, len);
|
||||
outputStream.flush();
|
||||
}
|
||||
String str = new String(outputStream.toByteArray(), StandardCharsets.UTF_8);
|
||||
outputStream.close();
|
||||
try {
|
||||
JSONObject json = JSON.parseObject(str);
|
||||
json.put("cookie", connection.getHeaderField("Set-Cookie"));
|
||||
return json;
|
||||
} catch (Exception e) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("html", str);
|
||||
json.put("cookie", connection.getHeaderField("Set-Cookie"));
|
||||
return json;
|
||||
} finally {
|
||||
stream.close();
|
||||
if (connectionOutputStream != null)
|
||||
connectionOutputStream.close();
|
||||
connection.disconnect();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new JSONObject();
|
||||
}
|
||||
|
||||
public static HttpURLConnection getBiliHttpPost(String url, String cookie) throws Exception {
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setDoOutput(true);
|
||||
connection.setDoInput(true);
|
||||
connection.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
connection.setRequestProperty("Accept-Language", "zh-CN,zh;q=0.8");
|
||||
connection.setRequestProperty("Cache-Control", "max-age=0");
|
||||
connection.setRequestProperty("Referer", "https://live.bilibili.com");
|
||||
connection.setRequestProperty("Connection", "keep-alive");
|
||||
connection.setRequestProperty("Upgrade-Insecure-Requests", "1");
|
||||
connection.setRequestProperty("Cookie", cookie);
|
||||
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36");
|
||||
return connection;
|
||||
}
|
||||
|
||||
public static HttpURLConnection getBiliHttpGet(String url, String cookie) throws IOException {
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
connection.setRequestProperty("Accept-Language", "zh-CN,zh;q=0.8");
|
||||
connection.setRequestProperty("Cache-Control", "max-age=0");
|
||||
connection.setRequestProperty("Referer", "https://live.bilibili.com");
|
||||
connection.setRequestProperty("Connection", "keep-alive");
|
||||
connection.setRequestProperty("Upgrade-Insecure-Requests", "1");
|
||||
connection.setRequestProperty("Cookie", cookie);
|
||||
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36");
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
||||
public static String getFile(String filePath) {
|
||||
File file = new File(filePath);
|
||||
try {
|
||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||
String str = "", tmp;
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
str += tmp;
|
||||
}
|
||||
reader.close();
|
||||
return str;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static JSONObject getUserLoginInfo() {
|
||||
return LiveUtils.http_get("https://api.bilibili.com/x/web-interface/nav");
|
||||
}
|
||||
|
||||
public static Live liveContains(BilibiliUpInfo data) {
|
||||
for (Live live : Live.lives) {
|
||||
if (live.getInfo().getRoomid().equals(data.getRoomid())) {
|
||||
return live;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isLivePlayer(int roomId) {
|
||||
JSONObject json = http_get("https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom?room_id=" + roomId);
|
||||
System.out.println("直播检测:" + roomId+" > "+(json.getJSONObject("data").getJSONObject("room_info").getInteger("live_status") == 1));
|
||||
return json.getJSONObject("data").getJSONObject("room_info").getInteger("live_status") == 1;
|
||||
}
|
||||
|
||||
public static class LiveGiftConfig {
|
||||
@Resource
|
||||
IBiliBiliLiveService service;
|
||||
private static LiveGiftConfig config;
|
||||
public static List<GiftData> giftDataList = new ArrayList<>();
|
||||
|
||||
public static LiveGiftConfig getInstance() {
|
||||
if (config == null) {
|
||||
config = new LiveGiftConfig();
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
private LiveGiftConfig() {
|
||||
init();
|
||||
}
|
||||
|
||||
public void init() {
|
||||
giftDataList = new ArrayList<>();
|
||||
JSONObject json = http_get("https://api.live.bilibili.com/xlive/web-room/v1/giftPanel/giftConfig?platform=pc");
|
||||
JSONArray list = json.getJSONObject("data").getJSONArray("list");
|
||||
for (Object o : list) {
|
||||
JSONObject item = (JSONObject) o;
|
||||
GiftData data = new GiftData();
|
||||
data.setPrice(item.getInteger("price"));
|
||||
data.setName(item.getString("name"));
|
||||
data.setId(item.getInteger("id"));
|
||||
data.setRights(item.getString("rights"));
|
||||
data.setIcon(item.getString("img_basic"));
|
||||
data.setDesc(item.getString("desc"));
|
||||
giftDataList.add(data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.yutou.bilibili.BiliBili.Services;
|
||||
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveData;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveInfo;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IBiliBiliLiveService {
|
||||
|
||||
/**
|
||||
* 获取所有up信息
|
||||
* @return up列表
|
||||
*/
|
||||
List<BilibiliUpInfo> getUpInfo();
|
||||
List<BilibiliUpInfo> getUpInfo(int uid,String power);
|
||||
/**
|
||||
* 根据RoomId查询UP信息
|
||||
* @param data roomId
|
||||
* @return UP信息
|
||||
*/
|
||||
BilibiliUpInfo queryUp(BilibiliUpInfo data);
|
||||
BilibiliUpInfo queryUpToUrl(String url);
|
||||
|
||||
/**
|
||||
* 根据RoomId查询UP信息
|
||||
* @param roomId roomId
|
||||
* @return UP信息
|
||||
*/
|
||||
BilibiliUpInfo queryUpToRoomId(int roomId);
|
||||
/**
|
||||
* 获取所有直播数据
|
||||
* @return 直播数据列表
|
||||
*/
|
||||
List<BilibiliLiveData> getLiveData();
|
||||
/**
|
||||
* 获取所有直播统计
|
||||
* @return 直播统计列表
|
||||
*/
|
||||
List<BilibiliLiveInfo> getLiveInfo();
|
||||
/**
|
||||
* 添加up信息
|
||||
* @param upData up信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean addUpInfo(BilibiliUpInfo upData);
|
||||
/**
|
||||
* 更新UP信息
|
||||
* @param upData up信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updateUpInfo(BilibiliUpInfo upData);
|
||||
/**
|
||||
* 删除指定up信息
|
||||
* @param upData roomId
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteUp(BilibiliUpInfo upData);
|
||||
/**
|
||||
* 新增直播数据
|
||||
* @param data 直播数据
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean addLiveData(BilibiliLiveData data);
|
||||
/**
|
||||
* 添加直播统计
|
||||
* @param data 直播统计
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean addLiveInfo(BilibiliLiveInfo data);
|
||||
|
||||
/**
|
||||
* 查询指定时段直播数据
|
||||
* @param roomId roomId
|
||||
* @param startTime 开始时间,为空表示为当天00:00:00
|
||||
* @param endTime 结束时间,为空表示为当时
|
||||
* @param type 类型
|
||||
* @return 列表
|
||||
*/
|
||||
List<BilibiliLiveData> queryLiveData(int roomId, Date startTime, Date endTime, String[] type);
|
||||
/**
|
||||
* 查询指定时段直播某个礼物总数
|
||||
* @param roomId roomId
|
||||
* @param giftId 礼物id,-1则为全部
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 数量
|
||||
*/
|
||||
int queryGiftSize(int roomId, int giftId, Date startTime, Date endTime);
|
||||
/**
|
||||
* 返回指定时段各个礼物总数
|
||||
* @param roomId roomId
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return {giftName:size}
|
||||
*/
|
||||
Map<String, Integer> queryGiftSize(int roomId, Date startTime, Date endTime);
|
||||
/**
|
||||
* 查询指定时段收益情况
|
||||
* @param roomId roomId
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 未扣除收成比例的金瓜子数量
|
||||
*/
|
||||
int queryPriceSize(int roomId, Date startTime, Date endTime);
|
||||
/**
|
||||
* 根据礼物id查询礼物信息,该方法主要用于阿B接口未收录的礼物信息
|
||||
* @param giftId 礼物id
|
||||
* @return 直播信息
|
||||
*/
|
||||
BilibiliLiveData queryGiftOfId(int giftId);
|
||||
/**
|
||||
* 查询指定时段去重送礼人数
|
||||
*
|
||||
* @param upData up信息
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param type 礼物类型
|
||||
* @return 人数
|
||||
*/
|
||||
int queryGiftUserToDistinct(BilibiliUpInfo upData, Date startTime, Date endTime, String[] type);
|
||||
/**
|
||||
* 查询时段内人气数量
|
||||
* @param upData up信息
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 人气
|
||||
*/
|
||||
int queryPopularCount(BilibiliUpInfo upData,Date startTime, Date endTime);
|
||||
/**
|
||||
* 查询时段内进场人数
|
||||
* @param upData up信息
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 人数
|
||||
*/
|
||||
int queryUserCount(BilibiliUpInfo upData,Date startTime, Date endTime);
|
||||
/**
|
||||
* 查询时段内礼物详情
|
||||
* @param upData up信息
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 人数
|
||||
*/
|
||||
Map<String, Integer> queryUserGiftCount(BilibiliUpInfo upData,Date startTime,Date endTime);
|
||||
|
||||
List<BilibiliLiveInfo> queryLiveInfo(BilibiliUpInfo upInfo,Date startTime,Date endTime);
|
||||
|
||||
List<Map<String, BigDecimal>>queryTimeGroup(int roomId, Date startTime, Date endTime);
|
||||
|
||||
List<Map<String, BigDecimal>>queryGiftTimeGroup(int roomId, Date startTime, Date endTime);
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
package com.yutou.bilibili.BiliBili.Services.impl;
|
||||
|
||||
import com.yutou.bilibili.BiliBili.Services.IBiliBiliLiveService;
|
||||
import com.yutou.bilibili.Services.ISystemConfigService;
|
||||
import com.yutou.bilibili.Tools.Config;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.dao.BilibiliLiveDataDao;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.dao.BilibiliLiveInfoDao;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.dao.BilibiliUpInfoDao;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.*;
|
||||
import com.yutou.bilibili.mybatis.dao.UBiliUpDao;
|
||||
import com.yutou.bilibili.mybatis.model.UBiliUp;
|
||||
import com.yutou.bilibili.mybatis.model.UBiliUpExample;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Service("BiliBiliLiveService")
|
||||
public class BiliBiliLiveServiceImpl implements IBiliBiliLiveService {
|
||||
@Resource
|
||||
BilibiliUpInfoDao upInfoDao;
|
||||
@Resource
|
||||
BilibiliLiveDataDao liveDataDao;
|
||||
@Resource
|
||||
BilibiliLiveInfoDao liveInfoDao;
|
||||
@Resource
|
||||
UBiliUpDao biliUpDao;
|
||||
@Resource
|
||||
ISystemConfigService configService;
|
||||
|
||||
private <T> T getData(List<T> list) {
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BilibiliUpInfo> getUpInfo() {
|
||||
return upInfoDao.selectByExample(new BilibiliUpInfoExample());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BilibiliUpInfo> getUpInfo(int uid, String power) {
|
||||
UBiliUpExample example = new UBiliUpExample();
|
||||
List<BilibiliUpInfo> upInfos = new ArrayList<>();
|
||||
if (power.equals("[-1]")) {
|
||||
upInfos = upInfoDao.selectByExample(new BilibiliUpInfoExample());
|
||||
return upInfos;
|
||||
}
|
||||
example.createCriteria().andUidEqualTo(uid);
|
||||
List<UBiliUp> list = biliUpDao.selectByExample(example);
|
||||
int[] ids = new int[list.size()];
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
ids[i] = list.get(i).getRoomid();
|
||||
}
|
||||
if (list.isEmpty()) {
|
||||
return upInfos;
|
||||
}
|
||||
upInfos = upInfoDao.queryToRoomIds(ids);
|
||||
System.out.println("list = " + upInfos.size());
|
||||
return upInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BilibiliUpInfo queryUp(BilibiliUpInfo data) {
|
||||
if (data.getRoomid() == null)
|
||||
return null;
|
||||
return queryUpToRoomId(data.getRoomid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BilibiliUpInfo queryUpToUrl(String url) {
|
||||
BilibiliUpInfoExample example = new BilibiliUpInfoExample();
|
||||
example.createCriteria().andUrlEqualTo(url);
|
||||
return getData(upInfoDao.selectByExample(example));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BilibiliUpInfo queryUpToRoomId(int roomId) {
|
||||
BilibiliUpInfoExample example = new BilibiliUpInfoExample();
|
||||
example.createCriteria().andRoomidEqualTo(roomId);
|
||||
return getData(upInfoDao.selectByExample(example));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<BilibiliLiveData> getLiveData() {
|
||||
return liveDataDao.selectByExample(new BilibiliLiveDataExample());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BilibiliLiveInfo> getLiveInfo() {
|
||||
return liveInfoDao.selectByExample(new BilibiliLiveInfoExample());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addUpInfo(BilibiliUpInfo upData) {
|
||||
BilibiliUpInfoExample example = new BilibiliUpInfoExample();
|
||||
example.createCriteria().andRoomidEqualTo(upData.getRoomid());
|
||||
if (upInfoDao.selectByExample(example).isEmpty()) {
|
||||
return upInfoDao.insert(upData) > 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateUpInfo(BilibiliUpInfo upData) {
|
||||
return upInfoDao.updateByPrimaryKey(upData) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteUp(BilibiliUpInfo upData) {
|
||||
BilibiliUpInfoExample example = new BilibiliUpInfoExample();
|
||||
example.createCriteria().andRoomidEqualTo(upData.getRoomid());
|
||||
return upInfoDao.deleteByExample(example) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addLiveData(BilibiliLiveData data) {
|
||||
if (!isLive()) {
|
||||
return false;
|
||||
}
|
||||
return liveDataDao.insert(data) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addLiveInfo(BilibiliLiveInfo data) {
|
||||
if (!isLive()) {
|
||||
return false;
|
||||
}
|
||||
return liveInfoDao.insert(data) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BilibiliLiveData> queryLiveData(int roomId, Date startTime, Date endTime, String[] type) {
|
||||
return liveDataDao.queryLiveData(roomId, startTime, endTime, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryGiftSize(int roomId, int giftId, Date startTime, Date endTime) {
|
||||
int count = 0;
|
||||
for (BilibiliLiveData liveData : liveDataDao.queryTimeOfRoomid(roomId, giftId, startTime, endTime)) {
|
||||
count += liveData.getGiftindex() == null ? 0 : liveData.getGiftindex();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> queryGiftSize(int roomId, Date startTime, Date endTime) {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
List<BilibiliLiveData> list = liveDataDao.queryTimeOfRoomid(roomId, -1, startTime, endTime);
|
||||
for (BilibiliLiveData liveData : list) {
|
||||
if (map.containsKey(liveData.getGiftname())) {
|
||||
map.put(liveData.getGiftname(), map.get(liveData.getGiftname()) + (liveData.getGiftindex() == null ? 0 : liveData.getGiftindex()));
|
||||
} else {
|
||||
map.put(liveData.getGiftname(), 1);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryPriceSize(int roomId, Date startTime, Date endTime) {
|
||||
int count = 0;
|
||||
for (BilibiliLiveData liveData : liveDataDao.queryTimeOfRoomid(roomId, -1, startTime, endTime)) {
|
||||
count += liveData.getPrice() == null ? 0 : liveData.getPrice();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BilibiliLiveData queryGiftOfId(int giftId) {
|
||||
BilibiliLiveDataExample example = new BilibiliLiveDataExample();
|
||||
example.createCriteria().andGiftidEqualTo(giftId);
|
||||
List<BilibiliLiveData> list = liveDataDao.selectByExample(example);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return list.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryGiftUserToDistinct(BilibiliUpInfo upData, Date startTime, Date endTime, String[] type) {
|
||||
return liveDataDao.queryGiftUserToDistinct(upData.getRoomid(), -1, startTime, endTime, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryPopularCount(BilibiliUpInfo upData, Date startTime, Date endTime) {
|
||||
int count = 0;
|
||||
for (BilibiliLiveInfo info : liveInfoDao.queryTimeOfRoomid(upData.getRoomid(), startTime, endTime)) {
|
||||
count += info.getPopular();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryUserCount(BilibiliUpInfo upData, Date startTime, Date endTime) {
|
||||
int count = 0;
|
||||
for (BilibiliLiveInfo info : liveInfoDao.queryTimeOfRoomid(upData.getRoomid(), startTime, endTime)) {
|
||||
count += (info.getUserindex() + info.getVipuserindex());
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> queryUserGiftCount(BilibiliUpInfo upData, Date startTime, Date endTime) {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
List<BilibiliLiveInfo> list = liveInfoDao.queryTimeOfRoomid(upData.getRoomid(), startTime, endTime);
|
||||
for (BilibiliLiveInfo info : list) {
|
||||
map.put(new SimpleDateFormat("HH").format(info.getSubtime()), info.getGiftuser() == null ? 0 : info.getGiftuser());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BilibiliLiveInfo> queryLiveInfo(BilibiliUpInfo upInfo, Date startTime, Date endTime) {
|
||||
return liveInfoDao.queryTimeOfRoomid(upInfo.getRoomid(), startTime, endTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, BigDecimal>> queryTimeGroup(int roomId, Date startTime, Date endTime) {
|
||||
return liveDataDao.queryPriceTimeGroup(roomId, startTime, endTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, BigDecimal>> queryGiftTimeGroup(int roomId, Date startTime, Date endTime) {
|
||||
return liveDataDao.queryGiftTimeGroup(roomId, startTime, endTime);
|
||||
}
|
||||
|
||||
public boolean isLive() {
|
||||
String flag = configService.getConfig(Config.BILI_LIVE_FLAG);
|
||||
if (flag != null) {
|
||||
return !flag.equals("0");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.yutou.bilibili.BiliBili.Tools;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.BiliBili.Datas.BiliBiliUpData;
|
||||
import com.yutou.bilibili.BiliBili.LiveUtils;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||
import com.yutou.bilibili.sqlite.BiliBiliLiveDatabasesManager;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
public class BiliTools {
|
||||
public static BilibiliUpInfo checkout(BilibiliUpInfo info) {
|
||||
if (StringUtils.isEmpty(info.getUrl())) {
|
||||
return null;
|
||||
}
|
||||
if (!info.getUrl().contains("http")) {
|
||||
info.setUrl("https://live.bilibili.com/" + info.getUrl());
|
||||
}
|
||||
BilibiliUpInfo data = getBiliUpInfo(info.getUrl());
|
||||
info.setUrl(data.getUrl());
|
||||
info.setRoomid(data.getRoomid());
|
||||
info.setName(data.getName());
|
||||
return info;
|
||||
}
|
||||
|
||||
public static BilibiliUpInfo getBiliUpInfo(String url) {
|
||||
if(!url.startsWith("http")){
|
||||
url="https://live.bilibili.com/"+url;
|
||||
}
|
||||
BilibiliUpInfo upData = new BilibiliUpInfo();
|
||||
JSONObject json = LiveUtils.http_get("https://api.live.bilibili.com/xlive/web-room/v1/index/getInfoByRoom?room_id=" + url.replace("https://live.bilibili.com/", "").split("\\?")[0]);
|
||||
System.out.println(json);
|
||||
String roomId = json.getJSONObject("data").getJSONObject("room_info").getInteger("room_id") + "";
|
||||
String name = json.getJSONObject("data").getJSONObject("anchor_info").getJSONObject("base_info").getString("uname");
|
||||
System.out.println(roomId);
|
||||
System.out.println(name);
|
||||
upData.setRoomid(Integer.parseInt(roomId));
|
||||
upData.setName(name);
|
||||
upData.setUrl(url);
|
||||
return upData;
|
||||
}
|
||||
}
|
||||
64
src/main/java/com/yutou/bilibili/BiliBili/Tools/LiveT.java
Normal file
64
src/main/java/com/yutou/bilibili/BiliBili/Tools/LiveT.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package com.yutou.bilibili.BiliBili.Tools;
|
||||
|
||||
import com.yutou.bilibili.BiliBili.Services.IBiliBiliLiveService;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveInfo;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||
import org.java_websocket.client.WebSocketClient;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
|
||||
public class LiveT implements ApplicationContextAware {
|
||||
private static ApplicationContext applicationContext = null;
|
||||
|
||||
IBiliBiliLiveService service;
|
||||
|
||||
|
||||
public static List<LiveT> list=new ArrayList<>();
|
||||
int v;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
System.out.println("初始化2");
|
||||
}
|
||||
|
||||
public LiveT() {
|
||||
System.out.println("初始化");
|
||||
}
|
||||
|
||||
public void add(int a){
|
||||
|
||||
v=a;
|
||||
BilibiliUpInfo info=new BilibiliUpInfo();
|
||||
info.setRoomid(a);
|
||||
info.setOfflinelistening(0);
|
||||
info.setSavedanmu(0);
|
||||
info.setEnable(0);
|
||||
info.setLive(0);
|
||||
info.setSavelive(0);
|
||||
info.setName("a"+a);
|
||||
info.setUrl("#");
|
||||
service=getBean(IBiliBiliLiveService.class);
|
||||
service.addUpInfo(info);
|
||||
}
|
||||
public int get(){
|
||||
return v;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
if(LiveT.applicationContext==null){
|
||||
LiveT.applicationContext=applicationContext;
|
||||
}
|
||||
}
|
||||
public static <T> T getBean(Class<T> clazz){
|
||||
return applicationContext.getBean(clazz);
|
||||
}
|
||||
}
|
||||
171
src/main/java/com/yutou/bilibili/BiliBili/Tools/SaveLive.java
Normal file
171
src/main/java/com/yutou/bilibili/BiliBili/Tools/SaveLive.java
Normal file
@@ -0,0 +1,171 @@
|
||||
package com.yutou.bilibili.BiliBili.Tools;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.BiliBili.Live;
|
||||
import com.yutou.bilibili.BiliBili.LiveUtils;
|
||||
import com.yutou.bilibili.Tools.AppTools;
|
||||
import com.yutou.bilibili.Tools.HttpTools;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
public class SaveLive {
|
||||
private static SaveLive live;
|
||||
private List<String> saveList = new ArrayList<>();
|
||||
private Map<Integer,DownloadThread> downloads = new HashMap<>();
|
||||
private Map<Integer,Timer> heartbeats=new HashMap<>();
|
||||
|
||||
public static void main(String[] args) {
|
||||
SaveLive.getInstance().addLive(3715397);
|
||||
}
|
||||
|
||||
private SaveLive() {
|
||||
}
|
||||
|
||||
public static SaveLive getInstance() {
|
||||
if (live == null) {
|
||||
live = new SaveLive();
|
||||
}
|
||||
return live;
|
||||
}
|
||||
|
||||
public void addLive(Live live) {
|
||||
addLive(live.geData().getRoomid());
|
||||
}
|
||||
|
||||
public void addLive(int roomId) {
|
||||
if (saveList.contains(roomId + "")) {
|
||||
return;
|
||||
}
|
||||
if (!LiveUtils.isLivePlayer(roomId)) {
|
||||
return;
|
||||
}
|
||||
saveList.add(roomId + "");
|
||||
start(roomId);
|
||||
}
|
||||
|
||||
public boolean checkLive(int roomId) {
|
||||
return saveList.contains(roomId + "");
|
||||
}
|
||||
|
||||
private long timer = 0;
|
||||
|
||||
public void stop(int roomId) {
|
||||
System.out.println("t停止录播:" + roomId + " time=" + (System.currentTimeMillis() - timer));
|
||||
saveList.remove(roomId + "");
|
||||
|
||||
if(downloads.containsKey(roomId)){
|
||||
downloads.get(roomId).isSave=false;
|
||||
downloads.remove(roomId);
|
||||
}
|
||||
|
||||
if(heartbeats.containsKey(roomId)){
|
||||
heartbeats.get(roomId).cancel();
|
||||
heartbeats.remove(roomId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void start(int roomId) {
|
||||
timer = System.currentTimeMillis();
|
||||
DownloadThread thread = new DownloadThread(roomId);
|
||||
downloads.put(roomId,thread);
|
||||
|
||||
}
|
||||
|
||||
public List<String> getLiveList() {
|
||||
return saveList;
|
||||
}
|
||||
|
||||
private class DownloadThread extends Thread {
|
||||
int roomId = 0;
|
||||
boolean isSave = true;
|
||||
Timer heartbeat;
|
||||
|
||||
public DownloadThread(int roomId) {
|
||||
this.roomId = roomId;
|
||||
isSave = true;
|
||||
|
||||
start();
|
||||
|
||||
}
|
||||
|
||||
private String getLiveUrl(int roomId) {
|
||||
JSONObject json = LiveUtils.http_get(String.format("https://api.live.bilibili.com/xlive/web-room/v1/playUrl/playUrl?cid=%d&platform=web", roomId));
|
||||
if (json.getInteger("code") == 0) {
|
||||
return json.getJSONObject("data").getJSONArray("durl").getJSONObject(0).getString("url");
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
String url = getLiveUrl(roomId);
|
||||
try {
|
||||
System.out.println("开始录制:" + roomId);
|
||||
HttpURLConnection connection = LiveUtils.getBiliHttpGet(url, LiveUtils.getCookie());
|
||||
heartbeat = new Timer();
|
||||
//Heartbeat beat = new Heartbeat();
|
||||
heartbeat.schedule(new Heartbeat(), 0, 30000);
|
||||
heartbeats.put(roomId,heartbeat);
|
||||
//heartbeats.add(beat);
|
||||
InputStream inputStream = connection.getInputStream();
|
||||
File file = new File(String.format("live%s%s%s[%s]%d.mp4",
|
||||
File.separator,
|
||||
AppTools.getToDayTime(),
|
||||
File.separator,
|
||||
AppTools.getToDayNowTimeToString().replace(":", ""),
|
||||
roomId));
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
file.delete();
|
||||
}
|
||||
FileOutputStream outputStream = new FileOutputStream(file);
|
||||
int len;
|
||||
byte[] bytes = new byte[1024];
|
||||
while ((len = inputStream.read(bytes)) != -1 && isSave) {
|
||||
outputStream.write(bytes, 0, len);
|
||||
outputStream.flush();
|
||||
}
|
||||
outputStream.close();
|
||||
inputStream.close();
|
||||
System.out.println("录制完成:" + roomId + " save = " + isSave + " len = " + len);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
SaveLive.this.stop(roomId);
|
||||
}
|
||||
|
||||
}
|
||||
private class Heartbeat extends TimerTask {
|
||||
int nextInterval=1;
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
JSONObject hearBeat;
|
||||
JSONObject userHear = new JSONObject();
|
||||
JSONObject cookie = JSONObject.parseObject(LiveUtils.getFile("cookies.json"));
|
||||
hearBeat = LiveUtils.http_get("https://api.live.bilibili.com/relation/v1/Feed/heartBeat");
|
||||
System.out.printf(hearBeat+" \t");
|
||||
hearBeat = LiveUtils.http_get(String.format("https://live-trace.bilibili.com/xlive/rdata-interface/v1/heartbeat/webHeartBeat?hb=%s&pf=web", URLEncoder.encode(new String(Base64.getEncoder().encode(String.format("%d|%d|1|0",nextInterval, roomId).getBytes(StandardCharsets.UTF_8))), "UTF-8")));
|
||||
System.out.printf(hearBeat+"\t");
|
||||
nextInterval=hearBeat.getJSONObject("data").getInteger("next_interval");
|
||||
System.out.println("next = "+nextInterval);
|
||||
userHear.put("csrf_token",cookie.getString("bili_jct"));
|
||||
userHear.put("csrf",cookie.getString("bili_jct"));
|
||||
userHear.put("visit_id","");
|
||||
hearBeat=LiveUtils.http_post("https://api.live.bilibili.com/User/userOnlineHeart", HttpTools.toUrlParams(userHear));
|
||||
System.out.println("["+AppTools.getToDayNowTimeToString()+"]"+hearBeat);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
19
src/main/java/com/yutou/bilibili/BilibiliApplication.java
Normal file
19
src/main/java/com/yutou/bilibili/BilibiliApplication.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.yutou.bilibili;
|
||||
|
||||
import com.yutou.bilibili.BiliBili.Live;
|
||||
import com.yutou.bilibili.BiliBili.Tools.LiveT;
|
||||
import com.yutou.bilibili.Tools.ExcelUtils;
|
||||
import com.yutou.bilibili.Tools.ServiceTools;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@Import({Live.class,ServiceTools.class, ExcelUtils.class})
|
||||
@SpringBootApplication
|
||||
public class BilibiliApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(BilibiliApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.yutou.bilibili.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.Services.ISystemConfigService;
|
||||
import com.yutou.bilibili.Tools.Config;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Controller
|
||||
public class SystemConfigController {
|
||||
@Resource
|
||||
ISystemConfigService configService;
|
||||
|
||||
@RequestMapping("/system/get/config.do")
|
||||
@ResponseBody
|
||||
public JSONObject getRegUser() {
|
||||
JSONObject json = new JSONObject();
|
||||
JSONObject data=new JSONObject();
|
||||
String reg = configService.getConfig(Config.USER_REG);
|
||||
String bLive = configService.getConfig(Config.BILI_LIVE_FLAG);
|
||||
if (reg == null) {
|
||||
reg = "0";
|
||||
}
|
||||
if (bLive == null) {
|
||||
bLive = "0";
|
||||
}
|
||||
data.put(Config.USER_REG, reg);
|
||||
data.put(Config.BILI_LIVE_FLAG,bLive);
|
||||
json.put("code",0);
|
||||
json.put("data",data);
|
||||
return json;
|
||||
}
|
||||
|
||||
@RequestMapping("/system/set/config.do")
|
||||
@ResponseBody
|
||||
public JSONObject setConfig(String key,String value){
|
||||
configService.setConfig(key, value);
|
||||
JSONObject json=new JSONObject();
|
||||
json.put("code",0);
|
||||
json.put("msg","ok");
|
||||
return json;
|
||||
}
|
||||
@RequestMapping("/system/public/reg.do")
|
||||
@ResponseBody
|
||||
public JSONObject getRegModel(){
|
||||
JSONObject json = new JSONObject();
|
||||
JSONObject data=new JSONObject();
|
||||
String reg = configService.getConfig(Config.USER_REG);
|
||||
boolean model=false;
|
||||
if (reg == null) {
|
||||
reg = "0";
|
||||
}
|
||||
if(reg.equals("1")){
|
||||
model=true;
|
||||
}
|
||||
data.put(Config.USER_REG, model);
|
||||
json.put("code",0);
|
||||
json.put("data",data);
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
||||
220
src/main/java/com/yutou/bilibili/Controllers/UserController.java
Normal file
220
src/main/java/com/yutou/bilibili/Controllers/UserController.java
Normal file
@@ -0,0 +1,220 @@
|
||||
package com.yutou.bilibili.Controllers;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.BiliBili.Services.IBiliBiliLiveService;
|
||||
import com.yutou.bilibili.Services.ISystemConfigService;
|
||||
import com.yutou.bilibili.BiliBili.Tools.BiliTools;
|
||||
import com.yutou.bilibili.Services.IUserService;
|
||||
import com.yutou.bilibili.Tools.AppTools;
|
||||
import com.yutou.bilibili.Tools.Config;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||
import com.yutou.bilibili.mybatis.model.UBiliUp;
|
||||
import com.yutou.bilibili.mybatis.model.UUser;
|
||||
import org.apache.tomcat.util.security.MD5Encoder;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
@Controller
|
||||
public class UserController {
|
||||
@Resource
|
||||
IUserService service;
|
||||
@Resource
|
||||
IBiliBiliLiveService biliService;
|
||||
@Resource
|
||||
ISystemConfigService configService;
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/user/reg.do")
|
||||
public JSONObject reg(UUser user, HttpServletResponse response) {
|
||||
JSONObject json = new JSONObject();
|
||||
String isReg = configService.getConfig(Config.USER_REG);
|
||||
if (isReg != null) {
|
||||
if (isReg.equals("0")) {
|
||||
json.put("code", -2);
|
||||
json.put("msg", "当前系统禁止注册");
|
||||
return json;
|
||||
}
|
||||
}
|
||||
user.setPower("[1,2,3,5,6,7]");
|
||||
user.setSubtime(new Date());
|
||||
user.setLogintoken(UUID.randomUUID().toString());
|
||||
AppTools.setCookie(response, "login", user.getLogintoken(), -1);
|
||||
boolean flag = service.reg(user);
|
||||
if (flag) {
|
||||
json.put("code", 0);
|
||||
json.put("msg", "注册成功");
|
||||
} else {
|
||||
json.put("code", -1);
|
||||
json.put("msg", "该用户已存在或无法注册");
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/user/login.do")
|
||||
public JSONObject login(UUser user, HttpServletResponse response) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", 0);
|
||||
if (service.login(user.getUser(), user.getPassword())) {
|
||||
user = service.getUser(user.getUser());
|
||||
user.setLogintoken(UUID.randomUUID().toString());
|
||||
service.update(user);
|
||||
AppTools.setCookie(response, "login", user.getLogintoken(), -1);
|
||||
json.put("msg", "登陆成功");
|
||||
json.put("power", user.getPower());
|
||||
} else {
|
||||
json.put("code", -1);
|
||||
json.put("msg", "登陆失败");
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/user/logout.do")
|
||||
public JSONObject logout(HttpServletRequest request, HttpServletResponse response) {
|
||||
JSONObject json = new JSONObject();
|
||||
String token = AppTools.getLoginToken(request);
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
json.put("code", -1);
|
||||
json.put("msg", "注销失败");
|
||||
} else {
|
||||
UUser user = service.getUserToToken(token);
|
||||
if (user != null) {
|
||||
user.setLogintoken("");
|
||||
service.update(user);
|
||||
AppTools.deleteCookie(request, response, "login");
|
||||
json.put("code", 0);
|
||||
json.put("msg", "注销成功");
|
||||
} else {
|
||||
json.put("code", -2);
|
||||
json.put("msg", "注销失败");
|
||||
}
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/user/set/update.do")
|
||||
public JSONObject update(UUser user, HttpServletRequest request) {
|
||||
JSONObject json = new JSONObject();
|
||||
String token = AppTools.getLoginToken(request);
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
json.put("code", -1);
|
||||
json.put("msg", "未登录");
|
||||
} else {
|
||||
UUser loginUser = service.getUserToToken(token);
|
||||
if (loginUser != null) {
|
||||
user.setLogintoken("");
|
||||
user.setId(loginUser.getId());
|
||||
user.setPower(loginUser.getPower());
|
||||
user.setBiliCookie(loginUser.getBiliCookie());
|
||||
user.setSubtime(loginUser.getSubtime());
|
||||
user.setPassword(AppTools.getMD5 (user.getPassword()));
|
||||
service.update(user);
|
||||
json.put("code", 0);
|
||||
json.put("msg", "修改成功");
|
||||
} else {
|
||||
json.put("code", -2);
|
||||
json.put("msg", "修改失败");
|
||||
}
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/user/up/list.do")
|
||||
public JSONObject uplist(HttpServletRequest request) {
|
||||
JSONObject json = new JSONObject();
|
||||
String token = AppTools.getLoginToken(request);
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
json.put("code", "-1");
|
||||
json.put("msg", "未登录");
|
||||
} else {
|
||||
json.put("code", 0);
|
||||
json.put("msg", "ok");
|
||||
UUser user = service.getUserToToken(token);
|
||||
json.put("data", service.getUserUp(user.getId()));
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/user/up/set/add.do")
|
||||
public JSONObject addUp(HttpServletRequest request, BilibiliUpInfo info) {
|
||||
JSONObject json = new JSONObject();
|
||||
String token = AppTools.getLoginToken(request);
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
json.put("code", "-1");
|
||||
json.put("msg", "未登录");
|
||||
} else {
|
||||
UUser user = service.getUserToToken(token);
|
||||
int roomid = 0;
|
||||
if (!info.getUrl().startsWith("http")) {
|
||||
info.setUrl("https://live.bilibili.com/" + info.getUrl());
|
||||
}
|
||||
BilibiliUpInfo tmp = biliService.queryUpToUrl(info.getUrl());
|
||||
if (tmp == null) {
|
||||
info = BiliTools.checkout(info);
|
||||
if (info != null) {
|
||||
roomid = info.getRoomid();
|
||||
info.setEnable(0);
|
||||
biliService.addUpInfo(info);
|
||||
}
|
||||
} else {
|
||||
roomid = tmp.getRoomid();
|
||||
}
|
||||
if (roomid == 0) {
|
||||
json.put("code", -1);
|
||||
json.put("msg", "添加失败");
|
||||
return json;
|
||||
}
|
||||
UBiliUp up = new UBiliUp();
|
||||
up.setUid(user.getId());
|
||||
up.setRoomid(roomid);
|
||||
json.put("code", 0);
|
||||
json.put("msg", service.addUp(up) ? "添加成功" : "添加失败");
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/user/get/test.do")
|
||||
public JSONObject testUser(HttpServletRequest request) {
|
||||
JSONObject json = new JSONObject();
|
||||
String token = AppTools.getLoginToken(request);
|
||||
if (StringUtils.isEmpty(token)) {
|
||||
json.put("code", -1);
|
||||
json.put("msg", "未登录");
|
||||
} else {
|
||||
UUser user = service.getUserToToken(token);
|
||||
if (user == null) {
|
||||
json.put("code", -2);
|
||||
json.put("msg", "未登录");
|
||||
return json;
|
||||
}
|
||||
JSONArray powers = JSONArray.parseArray(user.getPower());
|
||||
JSONObject ujson = (JSONObject) JSON.toJSON(user);
|
||||
ujson.remove("logintoken");
|
||||
ujson.remove("biliCookie");
|
||||
ujson.remove("password");
|
||||
ujson.remove("subtime");
|
||||
ujson.put("power", powers);
|
||||
json.put("code", 0);
|
||||
json.put("data", ujson);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.yutou.bilibili.Services;
|
||||
|
||||
public interface ISystemConfigService {
|
||||
String getConfig(String key);
|
||||
void setConfig(String key,String value);
|
||||
}
|
||||
17
src/main/java/com/yutou/bilibili/Services/IUserService.java
Normal file
17
src/main/java/com/yutou/bilibili/Services/IUserService.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.yutou.bilibili.Services;
|
||||
|
||||
import com.yutou.bilibili.mybatis.model.UBiliUp;
|
||||
import com.yutou.bilibili.mybatis.model.UUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IUserService {
|
||||
boolean login(String uname,String password);
|
||||
boolean reg(UUser user);
|
||||
boolean addUp(UBiliUp up);
|
||||
boolean removeUp(UUser user,UBiliUp up);
|
||||
boolean update(UUser user);
|
||||
UUser getUser(String uname);
|
||||
UUser getUserToToken(String token);
|
||||
List<UBiliUp> getUserUp(int uid);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.yutou.bilibili.Services.impl;
|
||||
|
||||
import com.yutou.bilibili.Services.ISystemConfigService;
|
||||
import com.yutou.bilibili.mybatis.dao.SConfigDao;
|
||||
import com.yutou.bilibili.mybatis.model.SConfig;
|
||||
import com.yutou.bilibili.mybatis.model.SConfigExample;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service("SystemConfigService")
|
||||
public class SystemConfigImpl implements ISystemConfigService {
|
||||
@Resource
|
||||
SConfigDao configDao;
|
||||
@Override
|
||||
public String getConfig(String key) {
|
||||
SConfigExample example=new SConfigExample();
|
||||
example.createCriteria().andConfigkeyEqualTo(key);
|
||||
List<SConfig> list=configDao.selectByExample(example);
|
||||
if(list.isEmpty()) {
|
||||
return null;
|
||||
}else{
|
||||
return list.get(0).getConfigvalue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfig(String key, String value) {
|
||||
SConfig config=new SConfig();
|
||||
if(getConfig(key)!=null){
|
||||
SConfigExample example=new SConfigExample();
|
||||
example.createCriteria().andConfigkeyEqualTo(key);
|
||||
config=configDao.selectByExample(example).get(0);
|
||||
config.setConfigvalue(value);
|
||||
configDao.updateByPrimaryKey(config);
|
||||
}else {
|
||||
config.setConfigkey(key);
|
||||
config.setConfigvalue(value);
|
||||
configDao.insert(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.yutou.bilibili.Services.impl;
|
||||
|
||||
import com.yutou.bilibili.Services.IUserService;
|
||||
import com.yutou.bilibili.Tools.AppTools;
|
||||
import com.yutou.bilibili.mybatis.dao.UBiliUpDao;
|
||||
import com.yutou.bilibili.mybatis.dao.UUserDao;
|
||||
import com.yutou.bilibili.mybatis.model.UBiliUp;
|
||||
import com.yutou.bilibili.mybatis.model.UBiliUpExample;
|
||||
import com.yutou.bilibili.mybatis.model.UUser;
|
||||
import com.yutou.bilibili.mybatis.model.UUserExample;
|
||||
import org.apache.tomcat.util.security.MD5Encoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
@Service("UserService")
|
||||
public class UserServiceImpl implements IUserService {
|
||||
@Resource
|
||||
UUserDao userDao;
|
||||
@Resource
|
||||
UBiliUpDao upDao;
|
||||
@Override
|
||||
public boolean login(String uname, String password) {
|
||||
UUserExample example=new UUserExample();
|
||||
String _password=AppTools.getMD5 (password);
|
||||
example.createCriteria().andUserEqualTo(uname).andPasswordEqualTo(_password);
|
||||
return !userDao.selectByExample(example).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reg(UUser user) {
|
||||
if(checkUser(user.getUser())){
|
||||
return false;
|
||||
}
|
||||
user.setPassword(AppTools.getMD5 (user.getPassword()));
|
||||
return userDao.insert(user)>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addUp(UBiliUp up) {
|
||||
if(checkUP(up.getUid(),up.getRoomid())){
|
||||
return false;
|
||||
}
|
||||
return upDao.insert(up)>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeUp(UUser user, UBiliUp up) {
|
||||
if(checkUP(up.getUid(),up.getRoomid())){
|
||||
return false;
|
||||
}
|
||||
return upDao.deleteByPrimaryKey(up.getId())>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(UUser user) {
|
||||
return userDao.updateByPrimaryKey(user)>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUser getUser(String uname) {
|
||||
UUserExample example=new UUserExample();
|
||||
example.createCriteria().andUserEqualTo(uname);
|
||||
List<UUser> list=userDao.selectByExample(example);
|
||||
if(list.isEmpty()){
|
||||
return null;
|
||||
}else{
|
||||
return list.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UBiliUp> getUserUp(int uid) {
|
||||
UBiliUpExample example=new UBiliUpExample();
|
||||
example.createCriteria().andUidEqualTo(uid);
|
||||
return upDao.selectByExample(example);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUser getUserToToken(String token) {
|
||||
if(StringUtils.isEmpty(token)){
|
||||
return null;
|
||||
}
|
||||
UUserExample example=new UUserExample();
|
||||
example.createCriteria().andLogintokenEqualTo(token);
|
||||
List<UUser> list=userDao.selectByExample(example);
|
||||
if(list.isEmpty()){
|
||||
return null;
|
||||
}else{
|
||||
return list.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkUser(String uname){
|
||||
UUserExample example=new UUserExample();
|
||||
example.createCriteria().andUserEqualTo(uname);
|
||||
return !userDao.selectByExample(example).isEmpty();
|
||||
}
|
||||
public boolean checkUP(int uid,int roomId){
|
||||
UBiliUpExample example=new UBiliUpExample();
|
||||
example.createCriteria().andUidEqualTo(uid).andRoomidEqualTo(roomId);
|
||||
return !upDao.selectByExample(example).isEmpty();
|
||||
}
|
||||
}
|
||||
38
src/main/java/com/yutou/bilibili/Test/TestController.java
Normal file
38
src/main/java/com/yutou/bilibili/Test/TestController.java
Normal file
@@ -0,0 +1,38 @@
|
||||
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.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) {
|
||||
JSONObject item=new JSONObject();
|
||||
item.put("info", JSON.toJSON(live.getInfo()));
|
||||
item.put("data",JSON.toJSON(live.geData()));
|
||||
array.add(item);
|
||||
}
|
||||
json.put("array",array);
|
||||
json.put("saveVideo",JSONArray.toJSON(SaveLive.getInstance().getLiveList()));
|
||||
return json;
|
||||
}
|
||||
}
|
||||
80
src/main/java/com/yutou/bilibili/Tools/APIFilter.java
Normal file
80
src/main/java/com/yutou/bilibili/Tools/APIFilter.java
Normal file
@@ -0,0 +1,80 @@
|
||||
package com.yutou.bilibili.Tools;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.yutou.bilibili.Services.IUserService;
|
||||
import com.yutou.bilibili.mybatis.dao.PermissionDao;
|
||||
import com.yutou.bilibili.mybatis.model.Permission;
|
||||
import com.yutou.bilibili.mybatis.model.PermissionExample;
|
||||
import com.yutou.bilibili.mybatis.model.UUser;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.annotation.WebFilter;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@WebFilter
|
||||
public class APIFilter implements Filter {
|
||||
@Resource
|
||||
IUserService service;
|
||||
@Resource
|
||||
PermissionDao permissionDao;
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
String token = request.getParameter("token");
|
||||
if(StringUtils.isEmpty(token)){
|
||||
Cookie cookie=AppTools.getCookie(request,"login");
|
||||
if(cookie!=null){
|
||||
token=cookie.getValue();
|
||||
}
|
||||
}
|
||||
String tmp = request.getRequestURI();
|
||||
if(tmp.contains("/user/login.do")
|
||||
||tmp.contains("/user/reg.do")
|
||||
||tmp.contains("/user/logout.do")
|
||||
||tmp.contains("/user/get/test.do")
|
||||
||tmp.contains("/system/public/reg.do")
|
||||
||tmp.contains("/favicon.ico")
|
||||
){
|
||||
filterChain.doFilter(servletRequest,servletResponse);
|
||||
}else {
|
||||
UUser user= service.getUserToToken(token);
|
||||
if(user==null){
|
||||
response.sendRedirect("/");
|
||||
}else{
|
||||
String url=null;
|
||||
try {
|
||||
url = tmp.split(tmp.split("/")[tmp.split("/").length - 1])[0];
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("无权限请求:"+tmp);
|
||||
return;
|
||||
}
|
||||
JSONArray powers = JSONArray.parseArray(user.getPower());
|
||||
if(powers.toJavaList(Integer.class).contains(-1)){
|
||||
filterChain.doFilter(servletRequest,servletResponse);
|
||||
}else {
|
||||
PermissionExample pExample = new PermissionExample();
|
||||
pExample.createCriteria().andUrlEqualTo(url);
|
||||
List<Permission> permissions = permissionDao.selectByExample(pExample);
|
||||
if (permissions != null && permissions.size() > 0) {
|
||||
if (powers.toJavaList(Integer.class).contains(permissions.get(0).getId())) {
|
||||
filterChain.doFilter(servletRequest,servletResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
251
src/main/java/com/yutou/bilibili/Tools/AppTools.java
Normal file
251
src/main/java/com/yutou/bilibili/Tools/AppTools.java
Normal file
@@ -0,0 +1,251 @@
|
||||
package com.yutou.bilibili.Tools;
|
||||
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.MessageDigest;
|
||||
import java.text.ParsePosition;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class AppTools {
|
||||
public static boolean saveFile(File file, String data){
|
||||
try {
|
||||
FileWriter writer=new FileWriter(file);
|
||||
writer.write(data);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static String readFile(File file){
|
||||
try {
|
||||
BufferedReader reader=new BufferedReader(new FileReader(file));
|
||||
String tmp;
|
||||
StringBuilder str= new StringBuilder();
|
||||
while ((tmp=reader.readLine())!=null){
|
||||
str.append(tmp);
|
||||
}
|
||||
reader.close();
|
||||
return str.toString();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 获取项目路径
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static String getPath(HttpServletRequest request) {
|
||||
return request.getServletContext().getRealPath("/") + "/";
|
||||
}
|
||||
public static String getToDayTime() {
|
||||
return new SimpleDateFormat("yyyy-MM-dd").format(new Date());
|
||||
}
|
||||
public static Date getToDayStartTime(){
|
||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(AppTools.getToDayTime() + " " + "00:00",new ParsePosition(0));
|
||||
}
|
||||
public static Date getToDayNowTime(){
|
||||
return new Date();
|
||||
}
|
||||
public static String getToDayNowTimeToString(){
|
||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
}
|
||||
public static String getToDayTimeToString(Date date){
|
||||
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
|
||||
}
|
||||
|
||||
|
||||
public static Map<String,String> getUrlParams(String url){
|
||||
Map<String,String> map=new HashMap<>();
|
||||
if(url.contains("?")){
|
||||
String param=url.split("\\?")[1];
|
||||
String[] params=param.split("&");
|
||||
for (String par : params) {
|
||||
map.put(par.split("=")[0],par.split("=")[1]);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* N以内的不重复随机数
|
||||
*
|
||||
* @param min 最小值
|
||||
* @param max 最大值
|
||||
* @param n
|
||||
* @return
|
||||
*/
|
||||
public static int[] randomCommon(int min, int max, int n) {
|
||||
int len = max - min + 1;
|
||||
if (max < min || n > len) {
|
||||
return new int[0];
|
||||
}
|
||||
// 初始化给定范围的待选数组
|
||||
int[] source = new int[len];
|
||||
for (int i = min; i < min + len; i++) {
|
||||
source[i - min] = i;
|
||||
}
|
||||
int[] result = new int[n];
|
||||
Random rd = new Random();
|
||||
int index = 0;
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
// 待选数组0到(len-2)随机一个下标
|
||||
index = Math.abs(rd.nextInt() % len--);
|
||||
// 将随机到的数放入结果集
|
||||
result[i] = source[index];
|
||||
// 将待选数组中被随机到的数,用待选数组(len-1)下标对应的数替换
|
||||
source[index] = source[len];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 设置Cookie
|
||||
*
|
||||
* @param response
|
||||
* @param key
|
||||
* @param value
|
||||
* @param time
|
||||
*/
|
||||
public static void setCookie(HttpServletResponse response, String key, String value, int time) {
|
||||
Cookie cookie = new Cookie(key, value);
|
||||
if (time != -1) {
|
||||
cookie.setMaxAge(time);
|
||||
}
|
||||
cookie.setPath("/");
|
||||
response.addCookie(cookie);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Cookie
|
||||
*
|
||||
* @param request
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static Cookie getCookie(HttpServletRequest request, String key) {
|
||||
Cookie[] cookies = request.getCookies();
|
||||
try {
|
||||
for (Cookie cookie : cookies) {
|
||||
if (key != null && cookie.getName().equals(key)) {
|
||||
return cookie;
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除Cookie
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public static String deleteCookie(HttpServletRequest request, HttpServletResponse response, String key) {
|
||||
for (Cookie cookie : request.getCookies()) {
|
||||
if (cookie.getName().equals(key)) {
|
||||
System.out.println("删除key=" + key);
|
||||
cookie.setMaxAge(0);
|
||||
cookie.setPath("/");
|
||||
cookie.setValue(null);
|
||||
response.addCookie(cookie);
|
||||
}
|
||||
}
|
||||
return "ok";
|
||||
}
|
||||
public static String alphabetsInUpperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
public static String alphabetsInLowerCase = "abcdefghijklmnopqrstuvwxyz";
|
||||
public static String numbers = "0123456789";
|
||||
public static String randomString(int length) {
|
||||
return randomString(length,new String[]{alphabetsInLowerCase,alphabetsInUpperCase,numbers});
|
||||
}
|
||||
public static String randomString(int length,String[] strs){
|
||||
String allCharacters="";
|
||||
for (String str : strs) {
|
||||
allCharacters+=str;
|
||||
}
|
||||
// create a super set of all characters
|
||||
// initialize a string to hold result
|
||||
StringBuffer randomString = new StringBuffer();
|
||||
// loop for 10 times
|
||||
for (int i = 0; i < length; i++) {
|
||||
// generate a random number between 0 and length of all characters
|
||||
int randomIndex = (int)(Math.random() * allCharacters.length());
|
||||
// retrieve character at index and add it to result
|
||||
randomString.append(allCharacters.charAt(randomIndex));
|
||||
}
|
||||
return randomString.toString();
|
||||
}
|
||||
public static String getLoginToken(HttpServletRequest request){
|
||||
String token = request.getParameter("token");
|
||||
if(StringUtils.isEmpty(token)){
|
||||
Cookie cookie=AppTools.getCookie(request,"login");
|
||||
if(cookie!=null){
|
||||
token=cookie.getValue();
|
||||
}
|
||||
}
|
||||
return token;
|
||||
}
|
||||
public static List<File> scanFilePath(String path){
|
||||
List<File> files=new ArrayList<>();
|
||||
File file=new File(path);
|
||||
for (File listFile : Objects.requireNonNull(file.listFiles())) {
|
||||
if(listFile.isDirectory()){
|
||||
files.addAll(scanFilePath(listFile.getAbsolutePath()));
|
||||
}else{
|
||||
files.add(listFile);
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
/**
|
||||
* 构造给前端的文件
|
||||
*
|
||||
* @param file 文件路径
|
||||
* @return 前端获取的文件
|
||||
*/
|
||||
public static ResponseEntity<FileSystemResource> getFile(File file) {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
try {
|
||||
headers.add("Content-Disposition", "attachment; filename=" + URLEncoder.encode(file.getName(), "UTF-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
headers.add("Content-Disposition", "attachment; filename=" + file.getName());
|
||||
}
|
||||
headers.add("Pragma", "no-cache");
|
||||
headers.add("Expires", "0");
|
||||
headers.add("Last-Modified", new Date().toString());
|
||||
headers.add("ETag", String.valueOf(System.currentTimeMillis()));
|
||||
return ResponseEntity.ok().headers(headers).contentLength(file.length()).contentType(MediaType.parseMediaType("application/octet-stream")).body(new FileSystemResource(file));
|
||||
}
|
||||
|
||||
public static String getMD5(String data) {
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("MD5");
|
||||
digest.update(data.getBytes());
|
||||
return DatatypeConverter.printHexBinary(digest.digest());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
154
src/main/java/com/yutou/bilibili/Tools/ApplicationInit.java
Normal file
154
src/main/java/com/yutou/bilibili/Tools/ApplicationInit.java
Normal file
@@ -0,0 +1,154 @@
|
||||
package com.yutou.bilibili.Tools;
|
||||
|
||||
import com.yutou.bilibili.BiliBili.Datas.LiveData;
|
||||
import com.yutou.bilibili.BiliBili.Live;
|
||||
import com.yutou.bilibili.BiliBili.LiveUtils;
|
||||
import com.yutou.bilibili.BiliBili.Services.IBiliBiliLiveService;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveInfo;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.text.ParsePosition;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* 服务启动后执行
|
||||
*/
|
||||
@Component
|
||||
public class ApplicationInit implements ApplicationRunner {
|
||||
@Resource
|
||||
IBiliBiliLiveService service;
|
||||
private Timer timer;
|
||||
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
LiveUtils.LiveGiftConfig.getInstance();
|
||||
List<BilibiliUpInfo> list = service.getUpInfo();
|
||||
for (BilibiliUpInfo data : list) {
|
||||
if (data.getEnable() == 1) {
|
||||
try {
|
||||
Live live = new Live();
|
||||
live.add(data.getRoomid(), !StringUtils.isEmpty(AppTools.readFile(new File("cookies.json"))));
|
||||
live.start();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
startTimer();
|
||||
}
|
||||
|
||||
private void startTimer() {
|
||||
if (timer == null) {
|
||||
timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
String oldTime = "";
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Date date = new Date();
|
||||
String time = new SimpleDateFormat("HH:mm").format(date);
|
||||
checkLive();
|
||||
if (time.equals(oldTime)) {
|
||||
return;
|
||||
}
|
||||
oldTime = time;
|
||||
switch (time) {
|
||||
case "00:00":
|
||||
for (Live live : Live.lives) {
|
||||
live.clearInfo();
|
||||
}
|
||||
break;
|
||||
case "01:00":
|
||||
case "02:00":
|
||||
case "03:00":
|
||||
case "04:00":
|
||||
case "05:00":
|
||||
case "06:00":
|
||||
case "07:00":
|
||||
case "08:00":
|
||||
case "09:00":
|
||||
case "10:00":
|
||||
case "11:00":
|
||||
case "12:00":
|
||||
case "13:00":
|
||||
case "14:00":
|
||||
case "15:00":
|
||||
case "16:00":
|
||||
case "17:00":
|
||||
case "18:00":
|
||||
case "19:00":
|
||||
case "20:00":
|
||||
case "21:00":
|
||||
case "22:00":
|
||||
case "23:00":
|
||||
case "23:59":
|
||||
saveData(time);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void checkLive() {
|
||||
for (BilibiliUpInfo info : service.getUpInfo()) {
|
||||
if (info.getOfflinelistening() == 1) {
|
||||
if (info.getLive() == 1) {
|
||||
Live live = LiveUtils.liveContains(info);
|
||||
if (live == null) {
|
||||
try {
|
||||
live = new Live();
|
||||
live.add(info.getRoomid(), !StringUtils.isEmpty(AppTools.readFile(new File("cookies.json"))));
|
||||
live.start();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 0, 60 * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveData(String time) {
|
||||
Date date = new Date();
|
||||
String toDay = AppTools.getToDayTime() + " 00:00:00";
|
||||
String nowTime = AppTools.getToDayTime() + " " + time + ":00";
|
||||
for (BilibiliUpInfo info : service.getUpInfo()) {
|
||||
Date startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(toDay, new ParsePosition(0));
|
||||
Date endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(nowTime, new ParsePosition(0));
|
||||
int userCount = service.queryLiveData(info.getRoomid(), startTime, endTime, new String[]{LiveData.INTERACT_WORD}).size();
|
||||
int vipCount = service.queryLiveData(info.getRoomid(), startTime, endTime, new String[]{LiveData.ENTRY_EFFECT}).size();
|
||||
int giftCount = service.queryLiveData(info.getRoomid(), startTime, endTime, new String[]{
|
||||
LiveData.SEND_GIFT,
|
||||
LiveData.COMBO_SEND,
|
||||
LiveData.GUARD_BUY,
|
||||
LiveData.SUPER_CHAT_MESSAGE}).size();
|
||||
Live live = LiveUtils.liveContains(info);
|
||||
int popularCount = 0;
|
||||
if (live != null) {
|
||||
popularCount = live.getInfo().getPopular();
|
||||
}
|
||||
BilibiliLiveInfo liveInfo = new BilibiliLiveInfo();
|
||||
liveInfo.setRoomid(info.getRoomid());
|
||||
liveInfo.setGiftuser(giftCount);
|
||||
liveInfo.setUserindex(userCount);
|
||||
liveInfo.setVipuserindex(vipCount);
|
||||
liveInfo.setPopular(popularCount);
|
||||
liveInfo.setSubtime(date);
|
||||
service.addLiveInfo(liveInfo);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
6
src/main/java/com/yutou/bilibili/Tools/Config.java
Normal file
6
src/main/java/com/yutou/bilibili/Tools/Config.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package com.yutou.bilibili.Tools;
|
||||
|
||||
public class Config {
|
||||
public static final String USER_REG="userReg";
|
||||
public static final String BILI_LIVE_FLAG="biliLive";
|
||||
}
|
||||
153
src/main/java/com/yutou/bilibili/Tools/ExcelUtils.java
Normal file
153
src/main/java/com/yutou/bilibili/Tools/ExcelUtils.java
Normal file
@@ -0,0 +1,153 @@
|
||||
package com.yutou.bilibili.Tools;
|
||||
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.dao.BilibiliLiveDataDao;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.dao.BilibiliLiveInfoDao;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveData;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveInfo;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static com.yutou.bilibili.BiliBili.Datas.LiveData.*;
|
||||
|
||||
public class ExcelUtils implements ApplicationContextAware {
|
||||
|
||||
@Resource
|
||||
BilibiliLiveDataDao dataDao;
|
||||
@Resource
|
||||
BilibiliLiveInfoDao infoDao;
|
||||
|
||||
public static File getInstance(int roomId, Date startTime, Date endTime,String fileName) {
|
||||
ExcelUtils utils = new ExcelUtils();
|
||||
long timer=System.currentTimeMillis();
|
||||
System.out.println("开始注入bean");
|
||||
utils.dataDao = getBean(BilibiliLiveDataDao.class);
|
||||
utils.infoDao = getBean(BilibiliLiveInfoDao.class);
|
||||
System.out.println("注入完毕:"+(System.currentTimeMillis()-timer));
|
||||
return utils.initTable(roomId, startTime, endTime,fileName);
|
||||
}
|
||||
|
||||
public ExcelUtils() {
|
||||
|
||||
}
|
||||
|
||||
private File initTable(int roomId, Date startTime, Date endTime,String fileName) {
|
||||
long timer=System.currentTimeMillis();
|
||||
System.out.println("进入统计:"+timer);
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
Sheet liveData = workbook.createSheet("直播数据");
|
||||
Sheet liveInfo = workbook.createSheet("小时统计");
|
||||
Row dataRow = liveData.createRow(0);
|
||||
Row infoRow = liveInfo.createRow(0);
|
||||
createCell(dataRow.createCell(0), "id");
|
||||
createCell(dataRow.createCell(1), "uid");
|
||||
createCell(dataRow.createCell(2), "roomId");
|
||||
createCell(dataRow.createCell(3), "类型");
|
||||
createCell(dataRow.createCell(4), "内容");
|
||||
createCell(dataRow.createCell(5), "礼物id");
|
||||
createCell(dataRow.createCell(6), "礼物名称");
|
||||
createCell(dataRow.createCell(7), "礼物数量");
|
||||
createCell(dataRow.createCell(8), "金瓜子");
|
||||
createCell(dataRow.createCell(9), "时间");
|
||||
|
||||
createCell(infoRow.createCell(0), "id");
|
||||
createCell(infoRow.createCell(1), "房间号");
|
||||
createCell(infoRow.createCell(2), "人气");
|
||||
createCell(infoRow.createCell(3), "普通用户入场数量");
|
||||
createCell(infoRow.createCell(4), "舰长入场数量");
|
||||
createCell(infoRow.createCell(5), "送礼人数");
|
||||
createCell(infoRow.createCell(6), "记录时间");
|
||||
|
||||
System.out.println("表头插入完毕:"+(System.currentTimeMillis()-timer));
|
||||
List<BilibiliLiveData> dataList = dataDao.queryLiveData(roomId, startTime, endTime, new String[]{
|
||||
INTERACT_WORD,
|
||||
ENTRY_EFFECT,
|
||||
DANMU_MSG,
|
||||
SEND_GIFT,
|
||||
COMBO_SEND,
|
||||
SUPER_CHAT_MESSAGE,
|
||||
NOTICE_MSG,
|
||||
GUARD_BUY,
|
||||
UNKNOWN_MESSAGE
|
||||
});
|
||||
List<BilibiliLiveInfo> infoList = infoDao.queryTimeOfRoomid(roomId, startTime, endTime);
|
||||
int index = 1;
|
||||
for (BilibiliLiveData data : dataList) {
|
||||
dataRow = liveData.createRow(index++);
|
||||
createCell(dataRow.createCell(0), data.getId());
|
||||
createCell(dataRow.createCell(1), data.getUid());
|
||||
createCell(dataRow.createCell(2), data.getRoomid());
|
||||
createCell(dataRow.createCell(3), data.getType());
|
||||
createCell(dataRow.createCell(4), data.getMsg());
|
||||
createCell(dataRow.createCell(5), data.getGiftid());
|
||||
createCell(dataRow.createCell(6), data.getGiftname());
|
||||
createCell(dataRow.createCell(7), data.getGiftindex());
|
||||
createCell(dataRow.createCell(8), data.getPrice());
|
||||
createCell(dataRow.createCell(9), AppTools.getToDayTimeToString(data.getSubtime()));
|
||||
}
|
||||
index = 1;
|
||||
for (BilibiliLiveInfo info : infoList) {
|
||||
infoRow = liveInfo.createRow(index++);
|
||||
createCell(infoRow.createCell(0), info.getId());
|
||||
createCell(infoRow.createCell(1), info.getRoomid());
|
||||
createCell(infoRow.createCell(2), info.getPopular());
|
||||
createCell(infoRow.createCell(3), info.getUserindex());
|
||||
createCell(infoRow.createCell(4), info.getVipuserindex());
|
||||
createCell(infoRow.createCell(5), info.getGiftuser());
|
||||
createCell(infoRow.createCell(6), AppTools.getToDayTimeToString(info.getSubtime()));
|
||||
}
|
||||
System.out.println("数据填充完毕:"+(System.currentTimeMillis()-timer));
|
||||
try {
|
||||
if(!new File("excel").exists()){
|
||||
new File("excel").mkdirs();
|
||||
}
|
||||
File file = new File("excel"+File.separator+fileName+".tmp");
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(file);
|
||||
workbook.write(fileOutputStream);
|
||||
workbook.close();
|
||||
System.out.println("文件写入完毕:"+(System.currentTimeMillis()-timer));
|
||||
file.renameTo(new File("excel"+File.separator+fileName));
|
||||
return file;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void createCell(Cell cell, Object data) {
|
||||
if (data == null)
|
||||
data = 0;
|
||||
if (data instanceof String) {
|
||||
cell.setCellType(CellType.STRING);
|
||||
cell.setCellValue((String) data);
|
||||
} else {
|
||||
cell.setCellType(CellType.NUMERIC);
|
||||
|
||||
cell.setCellValue((int) data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
if (ExcelUtils.applicationContext == null) {
|
||||
ExcelUtils.applicationContext = applicationContext;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T getBean(Class<T> clazz) {
|
||||
return applicationContext.getBean(clazz);
|
||||
}
|
||||
}
|
||||
136
src/main/java/com/yutou/bilibili/Tools/HttpTools.java
Normal file
136
src/main/java/com/yutou/bilibili/Tools/HttpTools.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package com.yutou.bilibili.Tools;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.interfaces.NetworkInterface;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Set;
|
||||
|
||||
public class HttpTools {
|
||||
public static String get(String url) {
|
||||
try {
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.setRequestProperty("User-Agent", getKuKuUA());
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
StringBuilder str = new StringBuilder();
|
||||
String tmp;
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
str.append(tmp);
|
||||
}
|
||||
reader.close();
|
||||
connection.disconnect();
|
||||
return str.toString();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized static void post(final String url, final byte[] body, final NetworkInterface networkInterface) {
|
||||
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String tmp;
|
||||
StringBuilder str = new StringBuilder();
|
||||
try {
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setDoOutput(true);
|
||||
connection.setDoInput(true);
|
||||
connection.setConnectTimeout(5 * 1000);
|
||||
connection.setReadTimeout(10 * 1000);
|
||||
connection.addRequestProperty("Connection", "keep-alive");
|
||||
connection.addRequestProperty("Accept", "*/*");
|
||||
connection.addRequestProperty("User-Agent", getExtUa());
|
||||
//connection.addRequestProperty("content-type", "application/json");
|
||||
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
connection.addRequestProperty("charset", "UTF-8");
|
||||
OutputStream outputStream = connection.getOutputStream();
|
||||
|
||||
outputStream.write(body);
|
||||
outputStream.write("\n".getBytes(StandardCharsets.UTF_8));
|
||||
outputStream.flush();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
str.append(tmp);
|
||||
}
|
||||
|
||||
// System.out.println( "[" + url + "?" + new String(body,StandardCharsets.UTF_8) + "]body:" + str + " (" + connection.getResponseCode() + ")");
|
||||
if (networkInterface != null) {
|
||||
try {
|
||||
networkInterface.httpGetData(str.toString(), connection.getResponseCode());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
networkInterface.onCookie(connection.getHeaderField("Set-Cookie"));
|
||||
}
|
||||
connection.disconnect();
|
||||
outputStream.close();
|
||||
reader.close();
|
||||
} catch (Exception e) {
|
||||
networkInterface.httpError(e);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private static String getExtUa() {
|
||||
return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36";
|
||||
}
|
||||
|
||||
private static String getKuKuUA() {
|
||||
return "/KUKU_APP(Android/#/cn.kuku.sdk/ttsdk17228/29401/A-2.9.4.01.KUSDK/868139039134314/fcddf839c8c135fa/F4:60:E2:AB:25:1A/460019406520644/+8618569400341/#/9/Redmi 6 Pro/xiaomi/1736/76fda4d6-cd6b-485f-987b-8d347b007f24/#/KUKU/Native/92972ea9651fbd2e)";
|
||||
}
|
||||
|
||||
public static String toUrlParams(JSONObject json) {
|
||||
StringBuilder string = new StringBuilder();
|
||||
Set<String> keys = json.keySet();
|
||||
for (String key : keys) {
|
||||
try {
|
||||
string.append("&").append(key).append("=").append(URLEncoder.encode(json.getString(key), "UTF-8"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
string.append("&").append(URLEncoder.encode(key, "UTF-8")).append("=");
|
||||
// string += "&" + key + "=";
|
||||
} catch (Exception e1) {
|
||||
string.append("&").append(key).append("=");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string = new StringBuilder(string.substring(1, string.length()).replaceAll(" ", ""));
|
||||
return string.toString();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("pid", "102");
|
||||
json.put("gid", "100584");
|
||||
json.put("gameKey", "0gha58u1c9FjZkeAsEmYIzTvp");
|
||||
json.put("access_token", "659c-S1gV0DwMXdYjPDlSrSLNYOvA8qUoCSvmdFEHvZugKgNX4Z2BCwF18A7W2gRdG7WiWfKsbZgF6YssZHhaozksI9RBn2QQFTXzmAHtbMd4ginEEtwdKmPCM4JbJGg1ollqoNE0PcGENpa4F3e7EdSOa_JFyE6XyUQN1iurJU3F8MZfLlTIcTR9USYoHX15vsAkCht_0mrapZblkeY1_8HFrmK8rlenbZLxccy7PrMz5eZ9uPPDJL5OYiEahyrtLENB8SVmlGofJfQw8wUjN8_XVZSfLMujdwz24");
|
||||
String url = "http://192.168.1.156:9020/Faxing/reg?" +
|
||||
"&tpyeCode=dimai" +
|
||||
"®ParamJson=" + json.toJSONString();
|
||||
/* ExecutorService service= Executors.newCachedThreadPool();
|
||||
for (int i = 0; i < 3000; i++) {
|
||||
service.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
get(url);
|
||||
}
|
||||
});
|
||||
}*/
|
||||
System.out.println(url);
|
||||
//String str=get(url);
|
||||
}
|
||||
}
|
||||
69
src/main/java/com/yutou/bilibili/Tools/ServiceTools.java
Normal file
69
src/main/java/com/yutou/bilibili/Tools/ServiceTools.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package com.yutou.bilibili.Tools;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.yutou.bilibili.Services.IUserService;
|
||||
import com.yutou.bilibili.mybatis.dao.PermissionDao;
|
||||
import com.yutou.bilibili.mybatis.model.Permission;
|
||||
import com.yutou.bilibili.mybatis.model.PermissionExample;
|
||||
import com.yutou.bilibili.mybatis.model.UUser;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
public class ServiceTools implements ApplicationContextAware {
|
||||
private static ApplicationContext applicationContext = null;
|
||||
@Resource
|
||||
IUserService userService;
|
||||
@Resource
|
||||
PermissionDao permissionDao;
|
||||
|
||||
public static ServiceTools getInstance() {
|
||||
ServiceTools tools=new ServiceTools();
|
||||
tools.userService=getBean(IUserService.class);
|
||||
tools.permissionDao=getBean(PermissionDao.class);
|
||||
return tools;
|
||||
}
|
||||
|
||||
|
||||
public boolean auth(HttpServletRequest request, String uname, String path) {
|
||||
UUser user = userService.getUser(uname);
|
||||
String tmp = request.getRequestURI();
|
||||
String url = null;
|
||||
try {
|
||||
url = tmp.split(tmp.split("/")[tmp.split("/").length - 1])[0];
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("无权限请求:" + tmp);
|
||||
return false;
|
||||
}
|
||||
JSONArray powers = JSONArray.parseArray(user.getPower());
|
||||
if (powers.toJavaList(Integer.class).contains(-1)) {
|
||||
return true;
|
||||
} else {
|
||||
PermissionExample pExample = new PermissionExample();
|
||||
pExample.createCriteria().andUrlEqualTo(url);
|
||||
List<Permission> permissions = permissionDao.selectByExample(pExample);
|
||||
if (permissions != null && permissions.size() > 0) {
|
||||
if (powers.toJavaList(Integer.class).contains(permissions.get(0).getId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
if (ServiceTools.applicationContext == null) {
|
||||
ServiceTools.applicationContext = applicationContext;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T getBean(Class<T> clazz) {
|
||||
return applicationContext.getBean(clazz);
|
||||
}
|
||||
}
|
||||
63
src/main/java/com/yutou/bilibili/Tools/TestMain.java
Normal file
63
src/main/java/com/yutou/bilibili/Tools/TestMain.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.yutou.bilibili.Tools;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.BiliBili.LiveUtils;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.CookieHandler;
|
||||
import java.net.CookieManager;
|
||||
import java.net.HttpCookie;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
public class TestMain {
|
||||
public static void main(String[] args) {
|
||||
new TestMain();
|
||||
}
|
||||
|
||||
public TestMain() {
|
||||
try {
|
||||
JSONObject cookie = JSONObject.parseObject(LiveUtils.getFile("cookies.json"));
|
||||
JSONObject userHear = new JSONObject();
|
||||
userHear.put("csrf_token",cookie.getString("bili_jct"));
|
||||
userHear.put("csrf",cookie.getString("bili_jct"));
|
||||
userHear.put("visit_id","");
|
||||
HttpURLConnection connection=LiveUtils.getBiliHttpPost("https://api.live.bilibili.com/User/userOnlineHeart",LiveUtils.getCookie());
|
||||
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
OutputStream connectionOutputStream = null;
|
||||
connectionOutputStream = connection.getOutputStream();
|
||||
connectionOutputStream.write(HttpTools.toUrlParams(userHear).getBytes(StandardCharsets.UTF_8));
|
||||
connectionOutputStream.flush();
|
||||
JSONObject hearBeat;
|
||||
hearBeat=LiveUtils.http_post("https://api.live.bilibili.com/User/userOnlineHeart", HttpTools.toUrlParams(userHear));
|
||||
/* BufferedInputStream stream = new BufferedInputStream(connection.getInputStream());
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
byte[] bytes = new byte[1024];
|
||||
int len = 0, size;
|
||||
while ((len = stream.read(bytes)) != -1) {
|
||||
outputStream.write(bytes, 0, len);
|
||||
outputStream.flush();
|
||||
}
|
||||
String str = new String(outputStream.toByteArray(), StandardCharsets.UTF_8);*/
|
||||
|
||||
System.out.println("["+AppTools.getToDayNowTimeToString()+"]"+hearBeat);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public static int byteArrayToInt(byte[] bytes) {
|
||||
int value=0;
|
||||
for(int i = 0; i < 4; i++) {
|
||||
int shift= (3-i) * 8;
|
||||
value +=(bytes[i] & 0xFF) << shift;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.yutou.bilibili.interfaces;
|
||||
|
||||
public abstract class DownloadInterface {
|
||||
public void onDownload(String file){};
|
||||
public void onError(Exception e){};
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.yutou.bilibili.interfaces;
|
||||
|
||||
public interface NetworkInterface {
|
||||
/**
|
||||
* 请求成功
|
||||
* @param data 请求参数
|
||||
* @param state http状态
|
||||
*/
|
||||
void httpGetData(Object data, int state);
|
||||
|
||||
/**
|
||||
* 请求异常
|
||||
* @param e 异常
|
||||
*/
|
||||
void httpError(Exception e);
|
||||
|
||||
void onCookie(String cookie);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.yutou.bilibili.mybatis.Bili.mybatis.dao;
|
||||
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveData;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveDataExample;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface BilibiliLiveDataDao {
|
||||
long countByExample(BilibiliLiveDataExample example);
|
||||
|
||||
int deleteByExample(BilibiliLiveDataExample example);
|
||||
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(BilibiliLiveData record);
|
||||
|
||||
int insertSelective(BilibiliLiveData record);
|
||||
|
||||
List<BilibiliLiveData> selectByExample(BilibiliLiveDataExample example);
|
||||
|
||||
BilibiliLiveData selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") BilibiliLiveData record, @Param("example") BilibiliLiveDataExample example);
|
||||
|
||||
int updateByExample(@Param("record") BilibiliLiveData record, @Param("example") BilibiliLiveDataExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(BilibiliLiveData record);
|
||||
|
||||
int updateByPrimaryKey(BilibiliLiveData record);
|
||||
|
||||
List<BilibiliLiveData> queryLiveData(@Param("roomid") int roomId, @Param("startTime")Date startTime, @Param("endTime")Date endTime, @Param("type")String[] type);
|
||||
|
||||
List<BilibiliLiveData> queryTimeOfRoomid(@Param("roomid") int roomId,@Param("giftId")int giftId, @Param("startTime")Date startTime, @Param("endTime")Date endTime);
|
||||
|
||||
int queryGiftUserToDistinct(@Param("roomid") int roomId,@Param("giftId")int giftId, @Param("startTime")Date startTime, @Param("endTime")Date endTime, @Param("type")String[] type);
|
||||
|
||||
List<Map<String, BigDecimal>> queryPriceTimeGroup(@Param("roomid") int roomId, @Param("startTime")Date startTime, @Param("endTime")Date endTime);
|
||||
|
||||
List<Map<String, BigDecimal>> queryGiftTimeGroup(@Param("roomid") int roomId, @Param("startTime")Date startTime, @Param("endTime")Date endTime);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.yutou.bilibili.mybatis.Bili.mybatis.dao;
|
||||
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveInfo;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveInfoExample;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface BilibiliLiveInfoDao {
|
||||
long countByExample(BilibiliLiveInfoExample example);
|
||||
|
||||
int deleteByExample(BilibiliLiveInfoExample example);
|
||||
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(BilibiliLiveInfo record);
|
||||
|
||||
int insertSelective(BilibiliLiveInfo record);
|
||||
|
||||
List<BilibiliLiveInfo> selectByExample(BilibiliLiveInfoExample example);
|
||||
|
||||
BilibiliLiveInfo selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") BilibiliLiveInfo record, @Param("example") BilibiliLiveInfoExample example);
|
||||
|
||||
int updateByExample(@Param("record") BilibiliLiveInfo record, @Param("example") BilibiliLiveInfoExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(BilibiliLiveInfo record);
|
||||
|
||||
int updateByPrimaryKey(BilibiliLiveInfo record);
|
||||
|
||||
List<BilibiliLiveInfo> queryTimeOfRoomid(@Param("roomid")int roomid, @Param("startTime") Date startTime, @Param("endTime")Date endTime);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.yutou.bilibili.mybatis.Bili.mybatis.dao;
|
||||
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfoExample;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface BilibiliUpInfoDao {
|
||||
long countByExample(BilibiliUpInfoExample example);
|
||||
|
||||
int deleteByExample(BilibiliUpInfoExample example);
|
||||
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(BilibiliUpInfo record);
|
||||
|
||||
int insertSelective(BilibiliUpInfo record);
|
||||
|
||||
List<BilibiliUpInfo> selectByExample(BilibiliUpInfoExample example);
|
||||
|
||||
BilibiliUpInfo selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") BilibiliUpInfo record, @Param("example") BilibiliUpInfoExample example);
|
||||
|
||||
int updateByExample(@Param("record") BilibiliUpInfo record, @Param("example") BilibiliUpInfoExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(BilibiliUpInfo record);
|
||||
|
||||
int updateByPrimaryKey(BilibiliUpInfo record);
|
||||
|
||||
List<BilibiliUpInfo> queryToRoomIds(@Param("roomid")int[] roomid);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.yutou.bilibili.mybatis.Bili.mybatis.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* bilibili_live_data
|
||||
* @author
|
||||
*/
|
||||
@Data
|
||||
public class BilibiliLiveData implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private Integer uid;
|
||||
|
||||
private Integer roomid;
|
||||
|
||||
private String type;
|
||||
|
||||
private String msg;
|
||||
|
||||
private Integer giftid;
|
||||
|
||||
private String giftname;
|
||||
|
||||
private Integer giftindex;
|
||||
|
||||
private Integer price;
|
||||
|
||||
private Integer priceofcommission;
|
||||
|
||||
private Date subtime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,892 @@
|
||||
package com.yutou.bilibili.mybatis.Bili.mybatis.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class BilibiliLiveDataExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public BilibiliLiveDataExample() {
|
||||
oredCriteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(Integer value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Integer value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Integer value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Integer value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Integer> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Integer> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidIsNull() {
|
||||
addCriterion("`uid` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidIsNotNull() {
|
||||
addCriterion("`uid` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidEqualTo(Integer value) {
|
||||
addCriterion("`uid` =", value, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidNotEqualTo(Integer value) {
|
||||
addCriterion("`uid` <>", value, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidGreaterThan(Integer value) {
|
||||
addCriterion("`uid` >", value, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("`uid` >=", value, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidLessThan(Integer value) {
|
||||
addCriterion("`uid` <", value, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("`uid` <=", value, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidIn(List<Integer> values) {
|
||||
addCriterion("`uid` in", values, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidNotIn(List<Integer> values) {
|
||||
addCriterion("`uid` not in", values, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidBetween(Integer value1, Integer value2) {
|
||||
addCriterion("`uid` between", value1, value2, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("`uid` not between", value1, value2, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidIsNull() {
|
||||
addCriterion("roomid is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidIsNotNull() {
|
||||
addCriterion("roomid is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidEqualTo(Integer value) {
|
||||
addCriterion("roomid =", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidNotEqualTo(Integer value) {
|
||||
addCriterion("roomid <>", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidGreaterThan(Integer value) {
|
||||
addCriterion("roomid >", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("roomid >=", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidLessThan(Integer value) {
|
||||
addCriterion("roomid <", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("roomid <=", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidIn(List<Integer> values) {
|
||||
addCriterion("roomid in", values, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidNotIn(List<Integer> values) {
|
||||
addCriterion("roomid not in", values, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidBetween(Integer value1, Integer value2) {
|
||||
addCriterion("roomid between", value1, value2, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("roomid not between", value1, value2, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNull() {
|
||||
addCriterion("`type` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNotNull() {
|
||||
addCriterion("`type` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeEqualTo(String value) {
|
||||
addCriterion("`type` =", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotEqualTo(String value) {
|
||||
addCriterion("`type` <>", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThan(String value) {
|
||||
addCriterion("`type` >", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`type` >=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThan(String value) {
|
||||
addCriterion("`type` <", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("`type` <=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLike(String value) {
|
||||
addCriterion("`type` like", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotLike(String value) {
|
||||
addCriterion("`type` not like", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIn(List<String> values) {
|
||||
addCriterion("`type` in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotIn(List<String> values) {
|
||||
addCriterion("`type` not in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeBetween(String value1, String value2) {
|
||||
addCriterion("`type` between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("`type` not between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgIsNull() {
|
||||
addCriterion("msg is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgIsNotNull() {
|
||||
addCriterion("msg is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgEqualTo(String value) {
|
||||
addCriterion("msg =", value, "msg");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgNotEqualTo(String value) {
|
||||
addCriterion("msg <>", value, "msg");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgGreaterThan(String value) {
|
||||
addCriterion("msg >", value, "msg");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("msg >=", value, "msg");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgLessThan(String value) {
|
||||
addCriterion("msg <", value, "msg");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgLessThanOrEqualTo(String value) {
|
||||
addCriterion("msg <=", value, "msg");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgLike(String value) {
|
||||
addCriterion("msg like", value, "msg");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgNotLike(String value) {
|
||||
addCriterion("msg not like", value, "msg");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgIn(List<String> values) {
|
||||
addCriterion("msg in", values, "msg");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgNotIn(List<String> values) {
|
||||
addCriterion("msg not in", values, "msg");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgBetween(String value1, String value2) {
|
||||
addCriterion("msg between", value1, value2, "msg");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andMsgNotBetween(String value1, String value2) {
|
||||
addCriterion("msg not between", value1, value2, "msg");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftidIsNull() {
|
||||
addCriterion("giftId is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftidIsNotNull() {
|
||||
addCriterion("giftId is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftidEqualTo(Integer value) {
|
||||
addCriterion("giftId =", value, "giftid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftidNotEqualTo(Integer value) {
|
||||
addCriterion("giftId <>", value, "giftid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftidGreaterThan(Integer value) {
|
||||
addCriterion("giftId >", value, "giftid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftidGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("giftId >=", value, "giftid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftidLessThan(Integer value) {
|
||||
addCriterion("giftId <", value, "giftid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftidLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("giftId <=", value, "giftid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftidIn(List<Integer> values) {
|
||||
addCriterion("giftId in", values, "giftid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftidNotIn(List<Integer> values) {
|
||||
addCriterion("giftId not in", values, "giftid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftidBetween(Integer value1, Integer value2) {
|
||||
addCriterion("giftId between", value1, value2, "giftid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftidNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("giftId not between", value1, value2, "giftid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameIsNull() {
|
||||
addCriterion("giftName is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameIsNotNull() {
|
||||
addCriterion("giftName is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameEqualTo(String value) {
|
||||
addCriterion("giftName =", value, "giftname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameNotEqualTo(String value) {
|
||||
addCriterion("giftName <>", value, "giftname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameGreaterThan(String value) {
|
||||
addCriterion("giftName >", value, "giftname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("giftName >=", value, "giftname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameLessThan(String value) {
|
||||
addCriterion("giftName <", value, "giftname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameLessThanOrEqualTo(String value) {
|
||||
addCriterion("giftName <=", value, "giftname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameLike(String value) {
|
||||
addCriterion("giftName like", value, "giftname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameNotLike(String value) {
|
||||
addCriterion("giftName not like", value, "giftname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameIn(List<String> values) {
|
||||
addCriterion("giftName in", values, "giftname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameNotIn(List<String> values) {
|
||||
addCriterion("giftName not in", values, "giftname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameBetween(String value1, String value2) {
|
||||
addCriterion("giftName between", value1, value2, "giftname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftnameNotBetween(String value1, String value2) {
|
||||
addCriterion("giftName not between", value1, value2, "giftname");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftindexIsNull() {
|
||||
addCriterion("giftIndex is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftindexIsNotNull() {
|
||||
addCriterion("giftIndex is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftindexEqualTo(Integer value) {
|
||||
addCriterion("giftIndex =", value, "giftindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftindexNotEqualTo(Integer value) {
|
||||
addCriterion("giftIndex <>", value, "giftindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftindexGreaterThan(Integer value) {
|
||||
addCriterion("giftIndex >", value, "giftindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftindexGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("giftIndex >=", value, "giftindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftindexLessThan(Integer value) {
|
||||
addCriterion("giftIndex <", value, "giftindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftindexLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("giftIndex <=", value, "giftindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftindexIn(List<Integer> values) {
|
||||
addCriterion("giftIndex in", values, "giftindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftindexNotIn(List<Integer> values) {
|
||||
addCriterion("giftIndex not in", values, "giftindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftindexBetween(Integer value1, Integer value2) {
|
||||
addCriterion("giftIndex between", value1, value2, "giftindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftindexNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("giftIndex not between", value1, value2, "giftindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceIsNull() {
|
||||
addCriterion("price is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceIsNotNull() {
|
||||
addCriterion("price is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceEqualTo(Integer value) {
|
||||
addCriterion("price =", value, "price");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceNotEqualTo(Integer value) {
|
||||
addCriterion("price <>", value, "price");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceGreaterThan(Integer value) {
|
||||
addCriterion("price >", value, "price");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("price >=", value, "price");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceLessThan(Integer value) {
|
||||
addCriterion("price <", value, "price");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("price <=", value, "price");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceIn(List<Integer> values) {
|
||||
addCriterion("price in", values, "price");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceNotIn(List<Integer> values) {
|
||||
addCriterion("price not in", values, "price");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceBetween(Integer value1, Integer value2) {
|
||||
addCriterion("price between", value1, value2, "price");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("price not between", value1, value2, "price");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceofcommissionIsNull() {
|
||||
addCriterion("priceOfcommission is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceofcommissionIsNotNull() {
|
||||
addCriterion("priceOfcommission is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceofcommissionEqualTo(Integer value) {
|
||||
addCriterion("priceOfcommission =", value, "priceofcommission");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceofcommissionNotEqualTo(Integer value) {
|
||||
addCriterion("priceOfcommission <>", value, "priceofcommission");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceofcommissionGreaterThan(Integer value) {
|
||||
addCriterion("priceOfcommission >", value, "priceofcommission");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceofcommissionGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("priceOfcommission >=", value, "priceofcommission");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceofcommissionLessThan(Integer value) {
|
||||
addCriterion("priceOfcommission <", value, "priceofcommission");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceofcommissionLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("priceOfcommission <=", value, "priceofcommission");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceofcommissionIn(List<Integer> values) {
|
||||
addCriterion("priceOfcommission in", values, "priceofcommission");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceofcommissionNotIn(List<Integer> values) {
|
||||
addCriterion("priceOfcommission not in", values, "priceofcommission");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceofcommissionBetween(Integer value1, Integer value2) {
|
||||
addCriterion("priceOfcommission between", value1, value2, "priceofcommission");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPriceofcommissionNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("priceOfcommission not between", value1, value2, "priceofcommission");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeIsNull() {
|
||||
addCriterion("subtime is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeIsNotNull() {
|
||||
addCriterion("subtime is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeEqualTo(Date value) {
|
||||
addCriterion("subtime =", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeNotEqualTo(Date value) {
|
||||
addCriterion("subtime <>", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeGreaterThan(Date value) {
|
||||
addCriterion("subtime >", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeGreaterThanOrEqualTo(Date value) {
|
||||
addCriterion("subtime >=", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeLessThan(Date value) {
|
||||
addCriterion("subtime <", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeLessThanOrEqualTo(Date value) {
|
||||
addCriterion("subtime <=", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeIn(List<Date> values) {
|
||||
addCriterion("subtime in", values, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeNotIn(List<Date> values) {
|
||||
addCriterion("subtime not in", values, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeBetween(Date value1, Date value2) {
|
||||
addCriterion("subtime between", value1, value2, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeNotBetween(Date value1, Date value2) {
|
||||
addCriterion("subtime not between", value1, value2, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.yutou.bilibili.mybatis.Bili.mybatis.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* bilibili_live_info
|
||||
* @author
|
||||
*/
|
||||
@Data
|
||||
public class BilibiliLiveInfo implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private Integer roomid;
|
||||
|
||||
private Integer popular;
|
||||
|
||||
private Integer userindex;
|
||||
|
||||
private Integer vipuserindex;
|
||||
|
||||
private Integer giftuser;
|
||||
|
||||
private Date subtime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Integer getRoomid() {
|
||||
if(roomid==null)
|
||||
roomid=0;
|
||||
return roomid;
|
||||
}
|
||||
|
||||
public Integer getPopular() {
|
||||
if(popular==null)
|
||||
popular=0;
|
||||
return popular;
|
||||
}
|
||||
|
||||
public Integer getUserindex() {
|
||||
if(userindex==null)
|
||||
userindex=0;
|
||||
return userindex;
|
||||
}
|
||||
|
||||
public Integer getVipuserindex() {
|
||||
if(vipuserindex==null)
|
||||
vipuserindex=0;
|
||||
return vipuserindex;
|
||||
}
|
||||
|
||||
public Integer getGiftuser() {
|
||||
if(giftuser==null)
|
||||
giftuser=0;
|
||||
return giftuser;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,622 @@
|
||||
package com.yutou.bilibili.mybatis.Bili.mybatis.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class BilibiliLiveInfoExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public BilibiliLiveInfoExample() {
|
||||
oredCriteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(Integer value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Integer value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Integer value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Integer value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Integer> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Integer> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidIsNull() {
|
||||
addCriterion("roomid is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidIsNotNull() {
|
||||
addCriterion("roomid is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidEqualTo(Integer value) {
|
||||
addCriterion("roomid =", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidNotEqualTo(Integer value) {
|
||||
addCriterion("roomid <>", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidGreaterThan(Integer value) {
|
||||
addCriterion("roomid >", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("roomid >=", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidLessThan(Integer value) {
|
||||
addCriterion("roomid <", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("roomid <=", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidIn(List<Integer> values) {
|
||||
addCriterion("roomid in", values, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidNotIn(List<Integer> values) {
|
||||
addCriterion("roomid not in", values, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidBetween(Integer value1, Integer value2) {
|
||||
addCriterion("roomid between", value1, value2, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("roomid not between", value1, value2, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPopularIsNull() {
|
||||
addCriterion("popular is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPopularIsNotNull() {
|
||||
addCriterion("popular is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPopularEqualTo(Integer value) {
|
||||
addCriterion("popular =", value, "popular");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPopularNotEqualTo(Integer value) {
|
||||
addCriterion("popular <>", value, "popular");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPopularGreaterThan(Integer value) {
|
||||
addCriterion("popular >", value, "popular");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPopularGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("popular >=", value, "popular");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPopularLessThan(Integer value) {
|
||||
addCriterion("popular <", value, "popular");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPopularLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("popular <=", value, "popular");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPopularIn(List<Integer> values) {
|
||||
addCriterion("popular in", values, "popular");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPopularNotIn(List<Integer> values) {
|
||||
addCriterion("popular not in", values, "popular");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPopularBetween(Integer value1, Integer value2) {
|
||||
addCriterion("popular between", value1, value2, "popular");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPopularNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("popular not between", value1, value2, "popular");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserindexIsNull() {
|
||||
addCriterion("userIndex is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserindexIsNotNull() {
|
||||
addCriterion("userIndex is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserindexEqualTo(Integer value) {
|
||||
addCriterion("userIndex =", value, "userindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserindexNotEqualTo(Integer value) {
|
||||
addCriterion("userIndex <>", value, "userindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserindexGreaterThan(Integer value) {
|
||||
addCriterion("userIndex >", value, "userindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserindexGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("userIndex >=", value, "userindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserindexLessThan(Integer value) {
|
||||
addCriterion("userIndex <", value, "userindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserindexLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("userIndex <=", value, "userindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserindexIn(List<Integer> values) {
|
||||
addCriterion("userIndex in", values, "userindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserindexNotIn(List<Integer> values) {
|
||||
addCriterion("userIndex not in", values, "userindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserindexBetween(Integer value1, Integer value2) {
|
||||
addCriterion("userIndex between", value1, value2, "userindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserindexNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("userIndex not between", value1, value2, "userindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVipuserindexIsNull() {
|
||||
addCriterion("vipUserIndex is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVipuserindexIsNotNull() {
|
||||
addCriterion("vipUserIndex is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVipuserindexEqualTo(Integer value) {
|
||||
addCriterion("vipUserIndex =", value, "vipuserindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVipuserindexNotEqualTo(Integer value) {
|
||||
addCriterion("vipUserIndex <>", value, "vipuserindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVipuserindexGreaterThan(Integer value) {
|
||||
addCriterion("vipUserIndex >", value, "vipuserindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVipuserindexGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("vipUserIndex >=", value, "vipuserindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVipuserindexLessThan(Integer value) {
|
||||
addCriterion("vipUserIndex <", value, "vipuserindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVipuserindexLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("vipUserIndex <=", value, "vipuserindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVipuserindexIn(List<Integer> values) {
|
||||
addCriterion("vipUserIndex in", values, "vipuserindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVipuserindexNotIn(List<Integer> values) {
|
||||
addCriterion("vipUserIndex not in", values, "vipuserindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVipuserindexBetween(Integer value1, Integer value2) {
|
||||
addCriterion("vipUserIndex between", value1, value2, "vipuserindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andVipuserindexNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("vipUserIndex not between", value1, value2, "vipuserindex");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftuserIsNull() {
|
||||
addCriterion("giftUser is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftuserIsNotNull() {
|
||||
addCriterion("giftUser is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftuserEqualTo(Integer value) {
|
||||
addCriterion("giftUser =", value, "giftuser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftuserNotEqualTo(Integer value) {
|
||||
addCriterion("giftUser <>", value, "giftuser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftuserGreaterThan(Integer value) {
|
||||
addCriterion("giftUser >", value, "giftuser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftuserGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("giftUser >=", value, "giftuser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftuserLessThan(Integer value) {
|
||||
addCriterion("giftUser <", value, "giftuser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftuserLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("giftUser <=", value, "giftuser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftuserIn(List<Integer> values) {
|
||||
addCriterion("giftUser in", values, "giftuser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftuserNotIn(List<Integer> values) {
|
||||
addCriterion("giftUser not in", values, "giftuser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftuserBetween(Integer value1, Integer value2) {
|
||||
addCriterion("giftUser between", value1, value2, "giftuser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andGiftuserNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("giftUser not between", value1, value2, "giftuser");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeIsNull() {
|
||||
addCriterion("subtime is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeIsNotNull() {
|
||||
addCriterion("subtime is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeEqualTo(Date value) {
|
||||
addCriterion("subtime =", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeNotEqualTo(Date value) {
|
||||
addCriterion("subtime <>", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeGreaterThan(Date value) {
|
||||
addCriterion("subtime >", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeGreaterThanOrEqualTo(Date value) {
|
||||
addCriterion("subtime >=", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeLessThan(Date value) {
|
||||
addCriterion("subtime <", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeLessThanOrEqualTo(Date value) {
|
||||
addCriterion("subtime <=", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeIn(List<Date> values) {
|
||||
addCriterion("subtime in", values, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeNotIn(List<Date> values) {
|
||||
addCriterion("subtime not in", values, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeBetween(Date value1, Date value2) {
|
||||
addCriterion("subtime between", value1, value2, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeNotBetween(Date value1, Date value2) {
|
||||
addCriterion("subtime not between", value1, value2, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.yutou.bilibili.mybatis.Bili.mybatis.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* bilibili_up_info
|
||||
* @author
|
||||
*/
|
||||
@Data
|
||||
public class BilibiliUpInfo implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* UP名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 直播间
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 房间号
|
||||
*/
|
||||
private Integer roomid;
|
||||
|
||||
/**
|
||||
* 是否24小时监视
|
||||
*/
|
||||
private Integer offlinelistening=0;
|
||||
|
||||
private Integer savedanmu=0;
|
||||
|
||||
private Integer enable=0;
|
||||
|
||||
private Integer live=0;
|
||||
|
||||
private Integer savelive=0;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,761 @@
|
||||
package com.yutou.bilibili.mybatis.Bili.mybatis.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BilibiliUpInfoExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public BilibiliUpInfoExample() {
|
||||
oredCriteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(Integer value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Integer value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Integer value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Integer value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Integer> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Integer> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIsNull() {
|
||||
addCriterion("`name` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIsNotNull() {
|
||||
addCriterion("`name` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameEqualTo(String value) {
|
||||
addCriterion("`name` =", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotEqualTo(String value) {
|
||||
addCriterion("`name` <>", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThan(String value) {
|
||||
addCriterion("`name` >", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`name` >=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThan(String value) {
|
||||
addCriterion("`name` <", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThanOrEqualTo(String value) {
|
||||
addCriterion("`name` <=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLike(String value) {
|
||||
addCriterion("`name` like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotLike(String value) {
|
||||
addCriterion("`name` not like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIn(List<String> values) {
|
||||
addCriterion("`name` in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotIn(List<String> values) {
|
||||
addCriterion("`name` not in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameBetween(String value1, String value2) {
|
||||
addCriterion("`name` between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotBetween(String value1, String value2) {
|
||||
addCriterion("`name` not between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlIsNull() {
|
||||
addCriterion("url is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlIsNotNull() {
|
||||
addCriterion("url is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlEqualTo(String value) {
|
||||
addCriterion("url =", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlNotEqualTo(String value) {
|
||||
addCriterion("url <>", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlGreaterThan(String value) {
|
||||
addCriterion("url >", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("url >=", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlLessThan(String value) {
|
||||
addCriterion("url <", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlLessThanOrEqualTo(String value) {
|
||||
addCriterion("url <=", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlLike(String value) {
|
||||
addCriterion("url like", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlNotLike(String value) {
|
||||
addCriterion("url not like", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlIn(List<String> values) {
|
||||
addCriterion("url in", values, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlNotIn(List<String> values) {
|
||||
addCriterion("url not in", values, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlBetween(String value1, String value2) {
|
||||
addCriterion("url between", value1, value2, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlNotBetween(String value1, String value2) {
|
||||
addCriterion("url not between", value1, value2, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidIsNull() {
|
||||
addCriterion("roomid is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidIsNotNull() {
|
||||
addCriterion("roomid is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidEqualTo(Integer value) {
|
||||
addCriterion("roomid =", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidNotEqualTo(Integer value) {
|
||||
addCriterion("roomid <>", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidGreaterThan(Integer value) {
|
||||
addCriterion("roomid >", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("roomid >=", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidLessThan(Integer value) {
|
||||
addCriterion("roomid <", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("roomid <=", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidIn(List<Integer> values) {
|
||||
addCriterion("roomid in", values, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidNotIn(List<Integer> values) {
|
||||
addCriterion("roomid not in", values, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidBetween(Integer value1, Integer value2) {
|
||||
addCriterion("roomid between", value1, value2, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("roomid not between", value1, value2, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOfflinelisteningIsNull() {
|
||||
addCriterion("offlineListening is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOfflinelisteningIsNotNull() {
|
||||
addCriterion("offlineListening is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOfflinelisteningEqualTo(Integer value) {
|
||||
addCriterion("offlineListening =", value, "offlinelistening");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOfflinelisteningNotEqualTo(Integer value) {
|
||||
addCriterion("offlineListening <>", value, "offlinelistening");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOfflinelisteningGreaterThan(Integer value) {
|
||||
addCriterion("offlineListening >", value, "offlinelistening");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOfflinelisteningGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("offlineListening >=", value, "offlinelistening");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOfflinelisteningLessThan(Integer value) {
|
||||
addCriterion("offlineListening <", value, "offlinelistening");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOfflinelisteningLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("offlineListening <=", value, "offlinelistening");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOfflinelisteningIn(List<Integer> values) {
|
||||
addCriterion("offlineListening in", values, "offlinelistening");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOfflinelisteningNotIn(List<Integer> values) {
|
||||
addCriterion("offlineListening not in", values, "offlinelistening");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOfflinelisteningBetween(Integer value1, Integer value2) {
|
||||
addCriterion("offlineListening between", value1, value2, "offlinelistening");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOfflinelisteningNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("offlineListening not between", value1, value2, "offlinelistening");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSavedanmuIsNull() {
|
||||
addCriterion("saveDanmu is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSavedanmuIsNotNull() {
|
||||
addCriterion("saveDanmu is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSavedanmuEqualTo(Integer value) {
|
||||
addCriterion("saveDanmu =", value, "savedanmu");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSavedanmuNotEqualTo(Integer value) {
|
||||
addCriterion("saveDanmu <>", value, "savedanmu");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSavedanmuGreaterThan(Integer value) {
|
||||
addCriterion("saveDanmu >", value, "savedanmu");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSavedanmuGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("saveDanmu >=", value, "savedanmu");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSavedanmuLessThan(Integer value) {
|
||||
addCriterion("saveDanmu <", value, "savedanmu");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSavedanmuLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("saveDanmu <=", value, "savedanmu");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSavedanmuIn(List<Integer> values) {
|
||||
addCriterion("saveDanmu in", values, "savedanmu");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSavedanmuNotIn(List<Integer> values) {
|
||||
addCriterion("saveDanmu not in", values, "savedanmu");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSavedanmuBetween(Integer value1, Integer value2) {
|
||||
addCriterion("saveDanmu between", value1, value2, "savedanmu");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSavedanmuNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("saveDanmu not between", value1, value2, "savedanmu");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableIsNull() {
|
||||
addCriterion("`enable` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableIsNotNull() {
|
||||
addCriterion("`enable` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableEqualTo(Integer value) {
|
||||
addCriterion("`enable` =", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableNotEqualTo(Integer value) {
|
||||
addCriterion("`enable` <>", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableGreaterThan(Integer value) {
|
||||
addCriterion("`enable` >", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("`enable` >=", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableLessThan(Integer value) {
|
||||
addCriterion("`enable` <", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("`enable` <=", value, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableIn(List<Integer> values) {
|
||||
addCriterion("`enable` in", values, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableNotIn(List<Integer> values) {
|
||||
addCriterion("`enable` not in", values, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableBetween(Integer value1, Integer value2) {
|
||||
addCriterion("`enable` between", value1, value2, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andEnableNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("`enable` not between", value1, value2, "enable");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLiveIsNull() {
|
||||
addCriterion("live is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLiveIsNotNull() {
|
||||
addCriterion("live is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLiveEqualTo(Integer value) {
|
||||
addCriterion("live =", value, "live");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLiveNotEqualTo(Integer value) {
|
||||
addCriterion("live <>", value, "live");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLiveGreaterThan(Integer value) {
|
||||
addCriterion("live >", value, "live");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLiveGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("live >=", value, "live");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLiveLessThan(Integer value) {
|
||||
addCriterion("live <", value, "live");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLiveLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("live <=", value, "live");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLiveIn(List<Integer> values) {
|
||||
addCriterion("live in", values, "live");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLiveNotIn(List<Integer> values) {
|
||||
addCriterion("live not in", values, "live");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLiveBetween(Integer value1, Integer value2) {
|
||||
addCriterion("live between", value1, value2, "live");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLiveNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("live not between", value1, value2, "live");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSaveliveIsNull() {
|
||||
addCriterion("saveLive is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSaveliveIsNotNull() {
|
||||
addCriterion("saveLive is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSaveliveEqualTo(Integer value) {
|
||||
addCriterion("saveLive =", value, "savelive");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSaveliveNotEqualTo(Integer value) {
|
||||
addCriterion("saveLive <>", value, "savelive");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSaveliveGreaterThan(Integer value) {
|
||||
addCriterion("saveLive >", value, "savelive");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSaveliveGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("saveLive >=", value, "savelive");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSaveliveLessThan(Integer value) {
|
||||
addCriterion("saveLive <", value, "savelive");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSaveliveLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("saveLive <=", value, "savelive");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSaveliveIn(List<Integer> values) {
|
||||
addCriterion("saveLive in", values, "savelive");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSaveliveNotIn(List<Integer> values) {
|
||||
addCriterion("saveLive not in", values, "savelive");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSaveliveBetween(Integer value1, Integer value2) {
|
||||
addCriterion("saveLive between", value1, value2, "savelive");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSaveliveNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("saveLive not between", value1, value2, "savelive");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.yutou.bilibili.mybatis.dao;
|
||||
|
||||
import com.yutou.bilibili.mybatis.model.Permission;
|
||||
import com.yutou.bilibili.mybatis.model.PermissionExample;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface PermissionDao {
|
||||
long countByExample(PermissionExample example);
|
||||
|
||||
int deleteByExample(PermissionExample example);
|
||||
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(Permission record);
|
||||
|
||||
int insertSelective(Permission record);
|
||||
|
||||
List<Permission> selectByExample(PermissionExample example);
|
||||
|
||||
Permission selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") Permission record, @Param("example") PermissionExample example);
|
||||
|
||||
int updateByExample(@Param("record") Permission record, @Param("example") PermissionExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(Permission record);
|
||||
|
||||
int updateByPrimaryKey(Permission record);
|
||||
}
|
||||
32
src/main/java/com/yutou/bilibili/mybatis/dao/SConfigDao.java
Normal file
32
src/main/java/com/yutou/bilibili/mybatis/dao/SConfigDao.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.yutou.bilibili.mybatis.dao;
|
||||
|
||||
import com.yutou.bilibili.mybatis.model.SConfig;
|
||||
import com.yutou.bilibili.mybatis.model.SConfigExample;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface SConfigDao {
|
||||
long countByExample(SConfigExample example);
|
||||
|
||||
int deleteByExample(SConfigExample example);
|
||||
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(SConfig record);
|
||||
|
||||
int insertSelective(SConfig record);
|
||||
|
||||
List<SConfig> selectByExample(SConfigExample example);
|
||||
|
||||
SConfig selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") SConfig record, @Param("example") SConfigExample example);
|
||||
|
||||
int updateByExample(@Param("record") SConfig record, @Param("example") SConfigExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(SConfig record);
|
||||
|
||||
int updateByPrimaryKey(SConfig record);
|
||||
}
|
||||
32
src/main/java/com/yutou/bilibili/mybatis/dao/UBiliUpDao.java
Normal file
32
src/main/java/com/yutou/bilibili/mybatis/dao/UBiliUpDao.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.yutou.bilibili.mybatis.dao;
|
||||
|
||||
import com.yutou.bilibili.mybatis.model.UBiliUp;
|
||||
import com.yutou.bilibili.mybatis.model.UBiliUpExample;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface UBiliUpDao {
|
||||
long countByExample(UBiliUpExample example);
|
||||
|
||||
int deleteByExample(UBiliUpExample example);
|
||||
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(UBiliUp record);
|
||||
|
||||
int insertSelective(UBiliUp record);
|
||||
|
||||
List<UBiliUp> selectByExample(UBiliUpExample example);
|
||||
|
||||
UBiliUp selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") UBiliUp record, @Param("example") UBiliUpExample example);
|
||||
|
||||
int updateByExample(@Param("record") UBiliUp record, @Param("example") UBiliUpExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(UBiliUp record);
|
||||
|
||||
int updateByPrimaryKey(UBiliUp record);
|
||||
}
|
||||
32
src/main/java/com/yutou/bilibili/mybatis/dao/UUserDao.java
Normal file
32
src/main/java/com/yutou/bilibili/mybatis/dao/UUserDao.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package com.yutou.bilibili.mybatis.dao;
|
||||
|
||||
import com.yutou.bilibili.mybatis.model.UUser;
|
||||
import com.yutou.bilibili.mybatis.model.UUserExample;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface UUserDao {
|
||||
long countByExample(UUserExample example);
|
||||
|
||||
int deleteByExample(UUserExample example);
|
||||
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(UUser record);
|
||||
|
||||
int insertSelective(UUser record);
|
||||
|
||||
List<UUser> selectByExample(UUserExample example);
|
||||
|
||||
UUser selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") UUser record, @Param("example") UUserExample example);
|
||||
|
||||
int updateByExample(@Param("record") UUser record, @Param("example") UUserExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(UUser record);
|
||||
|
||||
int updateByPrimaryKey(UUser record);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.yutou.bilibili.mybatis.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* permission
|
||||
* @author
|
||||
*/
|
||||
@Data
|
||||
public class Permission implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 权限说明
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 允许访问的连接
|
||||
*/
|
||||
private String url;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,401 @@
|
||||
package com.yutou.bilibili.mybatis.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PermissionExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public PermissionExample() {
|
||||
oredCriteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(Integer value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Integer value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Integer value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Integer value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Integer> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Integer> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleIsNull() {
|
||||
addCriterion("title is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleIsNotNull() {
|
||||
addCriterion("title is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleEqualTo(String value) {
|
||||
addCriterion("title =", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleNotEqualTo(String value) {
|
||||
addCriterion("title <>", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleGreaterThan(String value) {
|
||||
addCriterion("title >", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("title >=", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleLessThan(String value) {
|
||||
addCriterion("title <", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleLessThanOrEqualTo(String value) {
|
||||
addCriterion("title <=", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleLike(String value) {
|
||||
addCriterion("title like", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleNotLike(String value) {
|
||||
addCriterion("title not like", value, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleIn(List<String> values) {
|
||||
addCriterion("title in", values, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleNotIn(List<String> values) {
|
||||
addCriterion("title not in", values, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleBetween(String value1, String value2) {
|
||||
addCriterion("title between", value1, value2, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTitleNotBetween(String value1, String value2) {
|
||||
addCriterion("title not between", value1, value2, "title");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlIsNull() {
|
||||
addCriterion("url is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlIsNotNull() {
|
||||
addCriterion("url is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlEqualTo(String value) {
|
||||
addCriterion("url =", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlNotEqualTo(String value) {
|
||||
addCriterion("url <>", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlGreaterThan(String value) {
|
||||
addCriterion("url >", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("url >=", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlLessThan(String value) {
|
||||
addCriterion("url <", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlLessThanOrEqualTo(String value) {
|
||||
addCriterion("url <=", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlLike(String value) {
|
||||
addCriterion("url like", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlNotLike(String value) {
|
||||
addCriterion("url not like", value, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlIn(List<String> values) {
|
||||
addCriterion("url in", values, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlNotIn(List<String> values) {
|
||||
addCriterion("url not in", values, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlBetween(String value1, String value2) {
|
||||
addCriterion("url between", value1, value2, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUrlNotBetween(String value1, String value2) {
|
||||
addCriterion("url not between", value1, value2, "url");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
src/main/java/com/yutou/bilibili/mybatis/model/SConfig.java
Normal file
19
src/main/java/com/yutou/bilibili/mybatis/model/SConfig.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.yutou.bilibili.mybatis.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* s_config
|
||||
* @author
|
||||
*/
|
||||
@Data
|
||||
public class SConfig implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private String configkey;
|
||||
|
||||
private String configvalue;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,401 @@
|
||||
package com.yutou.bilibili.mybatis.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SConfigExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public SConfigExample() {
|
||||
oredCriteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(Integer value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Integer value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Integer value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Integer value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Integer> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Integer> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyIsNull() {
|
||||
addCriterion("configKey is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyIsNotNull() {
|
||||
addCriterion("configKey is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyEqualTo(String value) {
|
||||
addCriterion("configKey =", value, "configkey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyNotEqualTo(String value) {
|
||||
addCriterion("configKey <>", value, "configkey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyGreaterThan(String value) {
|
||||
addCriterion("configKey >", value, "configkey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("configKey >=", value, "configkey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyLessThan(String value) {
|
||||
addCriterion("configKey <", value, "configkey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyLessThanOrEqualTo(String value) {
|
||||
addCriterion("configKey <=", value, "configkey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyLike(String value) {
|
||||
addCriterion("configKey like", value, "configkey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyNotLike(String value) {
|
||||
addCriterion("configKey not like", value, "configkey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyIn(List<String> values) {
|
||||
addCriterion("configKey in", values, "configkey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyNotIn(List<String> values) {
|
||||
addCriterion("configKey not in", values, "configkey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyBetween(String value1, String value2) {
|
||||
addCriterion("configKey between", value1, value2, "configkey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigkeyNotBetween(String value1, String value2) {
|
||||
addCriterion("configKey not between", value1, value2, "configkey");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueIsNull() {
|
||||
addCriterion("configValue is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueIsNotNull() {
|
||||
addCriterion("configValue is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueEqualTo(String value) {
|
||||
addCriterion("configValue =", value, "configvalue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueNotEqualTo(String value) {
|
||||
addCriterion("configValue <>", value, "configvalue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueGreaterThan(String value) {
|
||||
addCriterion("configValue >", value, "configvalue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("configValue >=", value, "configvalue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueLessThan(String value) {
|
||||
addCriterion("configValue <", value, "configvalue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueLessThanOrEqualTo(String value) {
|
||||
addCriterion("configValue <=", value, "configvalue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueLike(String value) {
|
||||
addCriterion("configValue like", value, "configvalue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueNotLike(String value) {
|
||||
addCriterion("configValue not like", value, "configvalue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueIn(List<String> values) {
|
||||
addCriterion("configValue in", values, "configvalue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueNotIn(List<String> values) {
|
||||
addCriterion("configValue not in", values, "configvalue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueBetween(String value1, String value2) {
|
||||
addCriterion("configValue between", value1, value2, "configvalue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andConfigvalueNotBetween(String value1, String value2) {
|
||||
addCriterion("configValue not between", value1, value2, "configvalue");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
src/main/java/com/yutou/bilibili/mybatis/model/UBiliUp.java
Normal file
19
src/main/java/com/yutou/bilibili/mybatis/model/UBiliUp.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.yutou.bilibili.mybatis.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* u_bili_up
|
||||
* @author
|
||||
*/
|
||||
@Data
|
||||
public class UBiliUp implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private Integer uid;
|
||||
|
||||
private Integer roomid;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,381 @@
|
||||
package com.yutou.bilibili.mybatis.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UBiliUpExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public UBiliUpExample() {
|
||||
oredCriteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(Integer value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Integer value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Integer value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Integer value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Integer> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Integer> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidIsNull() {
|
||||
addCriterion("`uid` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidIsNotNull() {
|
||||
addCriterion("`uid` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidEqualTo(Integer value) {
|
||||
addCriterion("`uid` =", value, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidNotEqualTo(Integer value) {
|
||||
addCriterion("`uid` <>", value, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidGreaterThan(Integer value) {
|
||||
addCriterion("`uid` >", value, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("`uid` >=", value, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidLessThan(Integer value) {
|
||||
addCriterion("`uid` <", value, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("`uid` <=", value, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidIn(List<Integer> values) {
|
||||
addCriterion("`uid` in", values, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidNotIn(List<Integer> values) {
|
||||
addCriterion("`uid` not in", values, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidBetween(Integer value1, Integer value2) {
|
||||
addCriterion("`uid` between", value1, value2, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUidNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("`uid` not between", value1, value2, "uid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidIsNull() {
|
||||
addCriterion("roomid is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidIsNotNull() {
|
||||
addCriterion("roomid is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidEqualTo(Integer value) {
|
||||
addCriterion("roomid =", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidNotEqualTo(Integer value) {
|
||||
addCriterion("roomid <>", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidGreaterThan(Integer value) {
|
||||
addCriterion("roomid >", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("roomid >=", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidLessThan(Integer value) {
|
||||
addCriterion("roomid <", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("roomid <=", value, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidIn(List<Integer> values) {
|
||||
addCriterion("roomid in", values, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidNotIn(List<Integer> values) {
|
||||
addCriterion("roomid not in", values, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidBetween(Integer value1, Integer value2) {
|
||||
addCriterion("roomid between", value1, value2, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoomidNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("roomid not between", value1, value2, "roomid");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/main/java/com/yutou/bilibili/mybatis/model/UUser.java
Normal file
34
src/main/java/com/yutou/bilibili/mybatis/model/UUser.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package com.yutou.bilibili.mybatis.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* u_user
|
||||
* @author
|
||||
*/
|
||||
@Data
|
||||
public class UUser implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 登陆key
|
||||
*/
|
||||
private String user;
|
||||
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 权限功能
|
||||
*/
|
||||
private String power;
|
||||
|
||||
private String biliCookie;
|
||||
|
||||
private String logintoken;
|
||||
|
||||
private Date subtime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
672
src/main/java/com/yutou/bilibili/mybatis/model/UUserExample.java
Normal file
672
src/main/java/com/yutou/bilibili/mybatis/model/UUserExample.java
Normal file
@@ -0,0 +1,672 @@
|
||||
package com.yutou.bilibili.mybatis.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class UUserExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public UUserExample() {
|
||||
oredCriteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(Integer value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Integer value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Integer value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Integer value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Integer> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Integer> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIsNull() {
|
||||
addCriterion("`user` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIsNotNull() {
|
||||
addCriterion("`user` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserEqualTo(String value) {
|
||||
addCriterion("`user` =", value, "user");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserNotEqualTo(String value) {
|
||||
addCriterion("`user` <>", value, "user");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserGreaterThan(String value) {
|
||||
addCriterion("`user` >", value, "user");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`user` >=", value, "user");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserLessThan(String value) {
|
||||
addCriterion("`user` <", value, "user");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserLessThanOrEqualTo(String value) {
|
||||
addCriterion("`user` <=", value, "user");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserLike(String value) {
|
||||
addCriterion("`user` like", value, "user");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserNotLike(String value) {
|
||||
addCriterion("`user` not like", value, "user");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserIn(List<String> values) {
|
||||
addCriterion("`user` in", values, "user");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserNotIn(List<String> values) {
|
||||
addCriterion("`user` not in", values, "user");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserBetween(String value1, String value2) {
|
||||
addCriterion("`user` between", value1, value2, "user");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUserNotBetween(String value1, String value2) {
|
||||
addCriterion("`user` not between", value1, value2, "user");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordIsNull() {
|
||||
addCriterion("`password` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordIsNotNull() {
|
||||
addCriterion("`password` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordEqualTo(String value) {
|
||||
addCriterion("`password` =", value, "password");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordNotEqualTo(String value) {
|
||||
addCriterion("`password` <>", value, "password");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordGreaterThan(String value) {
|
||||
addCriterion("`password` >", value, "password");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`password` >=", value, "password");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordLessThan(String value) {
|
||||
addCriterion("`password` <", value, "password");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordLessThanOrEqualTo(String value) {
|
||||
addCriterion("`password` <=", value, "password");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordLike(String value) {
|
||||
addCriterion("`password` like", value, "password");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordNotLike(String value) {
|
||||
addCriterion("`password` not like", value, "password");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordIn(List<String> values) {
|
||||
addCriterion("`password` in", values, "password");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordNotIn(List<String> values) {
|
||||
addCriterion("`password` not in", values, "password");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordBetween(String value1, String value2) {
|
||||
addCriterion("`password` between", value1, value2, "password");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPasswordNotBetween(String value1, String value2) {
|
||||
addCriterion("`password` not between", value1, value2, "password");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerIsNull() {
|
||||
addCriterion("`power` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerIsNotNull() {
|
||||
addCriterion("`power` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerEqualTo(String value) {
|
||||
addCriterion("`power` =", value, "power");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerNotEqualTo(String value) {
|
||||
addCriterion("`power` <>", value, "power");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerGreaterThan(String value) {
|
||||
addCriterion("`power` >", value, "power");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`power` >=", value, "power");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerLessThan(String value) {
|
||||
addCriterion("`power` <", value, "power");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerLessThanOrEqualTo(String value) {
|
||||
addCriterion("`power` <=", value, "power");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerLike(String value) {
|
||||
addCriterion("`power` like", value, "power");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerNotLike(String value) {
|
||||
addCriterion("`power` not like", value, "power");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerIn(List<String> values) {
|
||||
addCriterion("`power` in", values, "power");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerNotIn(List<String> values) {
|
||||
addCriterion("`power` not in", values, "power");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerBetween(String value1, String value2) {
|
||||
addCriterion("`power` between", value1, value2, "power");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andPowerNotBetween(String value1, String value2) {
|
||||
addCriterion("`power` not between", value1, value2, "power");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieIsNull() {
|
||||
addCriterion("bili_cookie is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieIsNotNull() {
|
||||
addCriterion("bili_cookie is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieEqualTo(String value) {
|
||||
addCriterion("bili_cookie =", value, "biliCookie");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieNotEqualTo(String value) {
|
||||
addCriterion("bili_cookie <>", value, "biliCookie");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieGreaterThan(String value) {
|
||||
addCriterion("bili_cookie >", value, "biliCookie");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("bili_cookie >=", value, "biliCookie");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieLessThan(String value) {
|
||||
addCriterion("bili_cookie <", value, "biliCookie");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieLessThanOrEqualTo(String value) {
|
||||
addCriterion("bili_cookie <=", value, "biliCookie");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieLike(String value) {
|
||||
addCriterion("bili_cookie like", value, "biliCookie");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieNotLike(String value) {
|
||||
addCriterion("bili_cookie not like", value, "biliCookie");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieIn(List<String> values) {
|
||||
addCriterion("bili_cookie in", values, "biliCookie");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieNotIn(List<String> values) {
|
||||
addCriterion("bili_cookie not in", values, "biliCookie");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieBetween(String value1, String value2) {
|
||||
addCriterion("bili_cookie between", value1, value2, "biliCookie");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andBiliCookieNotBetween(String value1, String value2) {
|
||||
addCriterion("bili_cookie not between", value1, value2, "biliCookie");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenIsNull() {
|
||||
addCriterion("loginToken is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenIsNotNull() {
|
||||
addCriterion("loginToken is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenEqualTo(String value) {
|
||||
addCriterion("loginToken =", value, "logintoken");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenNotEqualTo(String value) {
|
||||
addCriterion("loginToken <>", value, "logintoken");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenGreaterThan(String value) {
|
||||
addCriterion("loginToken >", value, "logintoken");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("loginToken >=", value, "logintoken");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenLessThan(String value) {
|
||||
addCriterion("loginToken <", value, "logintoken");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenLessThanOrEqualTo(String value) {
|
||||
addCriterion("loginToken <=", value, "logintoken");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenLike(String value) {
|
||||
addCriterion("loginToken like", value, "logintoken");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenNotLike(String value) {
|
||||
addCriterion("loginToken not like", value, "logintoken");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenIn(List<String> values) {
|
||||
addCriterion("loginToken in", values, "logintoken");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenNotIn(List<String> values) {
|
||||
addCriterion("loginToken not in", values, "logintoken");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenBetween(String value1, String value2) {
|
||||
addCriterion("loginToken between", value1, value2, "logintoken");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLogintokenNotBetween(String value1, String value2) {
|
||||
addCriterion("loginToken not between", value1, value2, "logintoken");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeIsNull() {
|
||||
addCriterion("subtime is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeIsNotNull() {
|
||||
addCriterion("subtime is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeEqualTo(Date value) {
|
||||
addCriterion("subtime =", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeNotEqualTo(Date value) {
|
||||
addCriterion("subtime <>", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeGreaterThan(Date value) {
|
||||
addCriterion("subtime >", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeGreaterThanOrEqualTo(Date value) {
|
||||
addCriterion("subtime >=", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeLessThan(Date value) {
|
||||
addCriterion("subtime <", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeLessThanOrEqualTo(Date value) {
|
||||
addCriterion("subtime <=", value, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeIn(List<Date> values) {
|
||||
addCriterion("subtime in", values, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeNotIn(List<Date> values) {
|
||||
addCriterion("subtime not in", values, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeBetween(Date value1, Date value2) {
|
||||
addCriterion("subtime between", value1, value2, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSubtimeNotBetween(Date value1, Date value2) {
|
||||
addCriterion("subtime not between", value1, value2, "subtime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,536 @@
|
||||
package com.yutou.bilibili.sqlite;
|
||||
|
||||
import com.yutou.bilibili.BiliBili.Datas.BiliBiliUpData;
|
||||
import com.yutou.bilibili.BiliBili.Datas.LiveData;
|
||||
import com.yutou.bilibili.BiliBili.Datas.LiveInfo;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yutou.bilibili.BiliBili.LiveUtils;
|
||||
import com.yutou.bilibili.Tools.AppTools;
|
||||
import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveData;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class BiliBiliLiveDatabasesManager extends SQLiteManager {
|
||||
private static BiliBiliLiveDatabasesManager manager;
|
||||
private Statement statement;
|
||||
|
||||
public static BiliBiliLiveDatabasesManager getInstance() {
|
||||
if (manager == null) {
|
||||
manager = new BiliBiliLiveDatabasesManager();
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
private BiliBiliLiveDatabasesManager() {
|
||||
super();
|
||||
|
||||
}
|
||||
public void init(String fileName){
|
||||
JSONObject json = JSONObject.parseObject("{\"file\":\"bilibili.db\",\"table\":[{\"name\":\"up_info\",\"item\":[{\"name\":\"id\",\"type\":\"int\",\"isNull\":false,\"isKey\":true},{\"name\":\"name\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"url\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"roomid\",\"type\":\"int\",\"isNull\":false,\"isKey\":false},{\"name\":\"offlineListening\",\"type\":\"int\",\"isNull\":false,\"isKey\":false},{\"name\":\"saveDanmu\",\"type\":\"int\",\"isNull\":false,\"isKey\":false},{\"name\":\"enable\",\"type\":\"int\",\"isNull\":false,\"isKey\":false}]},{\"name\":\"live_data\",\"item\":[{\"name\":\"id\",\"type\":\"int\",\"isNull\":false,\"isKey\":true},{\"name\":\"uid\",\"type\":\"int\",\"isNull\":false,\"isKey\":false},{\"name\":\"roomid\",\"type\":\"int\",\"isNull\":false,\"isKey\":false},{\"name\":\"type\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"msg\",\"type\":\"String\",\"isNull\":true,\"isKey\":false},{\"name\":\"giftId\",\"type\":\"int\",\"isNull\":true,\"isKey\":false},{\"name\":\"giftName\",\"type\":\"String\",\"isNull\":true,\"isKey\":false},{\"name\":\"giftIndex\",\"type\":\"int\",\"isNull\":true,\"isKey\":false},{\"name\":\"price\",\"type\":\"int\",\"isNull\":true,\"isKey\":false},{\"name\":\"priceOfcommission\",\"type\":\"int\",\"isNull\":true,\"isKey\":false},{\"name\":\"subtime\",\"type\":\"TIME\",\"isNull\":true,\"isKey\":false}]},{\"name\":\"live_info\",\"item\":[{\"name\":\"id\",\"type\":\"int\",\"isNull\":false,\"isKey\":true},{\"name\":\"roomid\",\"type\":\"int\",\"isNull\":false,\"isKey\":false},{\"name\":\"popular\",\"type\":\"int\",\"isNull\":true,\"isKey\":false},{\"name\":\"userIndex\",\"type\":\"int\",\"isNull\":true,\"isKey\":false},{\"name\":\"vipUserIndex\",\"type\":\"int\",\"isNull\":true,\"isKey\":false},{\"name\":\"giftUser\",\"type\":\"int\",\"isNull\":true,\"isKey\":false},{\"name\":\"subtime\",\"type\":\"TIME\",\"isNull\":false,\"isKey\":false}]}]}");
|
||||
json.put("file",fileName+".db");
|
||||
build(json);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有up信息
|
||||
* @return up列表
|
||||
*/
|
||||
public List<BiliBiliUpData> getUpInfo() {
|
||||
return getUpInfo("select * from `up_info`;");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据RoomId查询UP信息
|
||||
* @param data roomId
|
||||
* @return UP信息
|
||||
*/
|
||||
public BiliBiliUpData queryUp(BiliBiliUpData data) {
|
||||
String sql = "select * from `up_info` where `roomid`=" + data.getRoomId() + ";";
|
||||
List<BiliBiliUpData> list = getUpInfo(sql);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return list.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询UP信息
|
||||
* @param sql sql
|
||||
* @return 列表
|
||||
*/
|
||||
private List<BiliBiliUpData> getUpInfo(String sql) {
|
||||
List<BiliBiliUpData> list = new ArrayList<>();
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
ResultSet set = statement.executeQuery(sql);
|
||||
while (set.next()) {
|
||||
BiliBiliUpData upData = new BiliBiliUpData();
|
||||
upData.setId(set.getInt("id"));
|
||||
upData.setName(set.getString("name"));
|
||||
upData.setUrl(set.getString("url"));
|
||||
upData.setRoomId(set.getInt("roomid"));
|
||||
upData.setOfflineListening(set.getInt("offlineListening"));
|
||||
upData.setEnable(set.getInt("enable"));
|
||||
upData.setSaveDanmu(set.getInt("saveDanmu"));
|
||||
list.add(upData);
|
||||
}
|
||||
statement.closeOnCompletion();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有直播数据
|
||||
* @return 直播数据列表
|
||||
*/
|
||||
public List<LiveData> getLiveData() {
|
||||
return getLiveData("select * from `live_data`;");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播数据
|
||||
* @param sql sql
|
||||
* @return 直播数据
|
||||
*/
|
||||
private List<LiveData> getLiveData(String sql) {
|
||||
List<LiveData> list = new ArrayList<>();
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
ResultSet set = statement.executeQuery(sql);
|
||||
while (set.next()) {
|
||||
LiveData data = new LiveData();
|
||||
data.setId(set.getInt("id"));
|
||||
data.setRoomId(set.getInt("roomid"));
|
||||
data.setUid(set.getInt("uid"));
|
||||
data.setType(set.getString("type"));
|
||||
data.setMsg(set.getString("msg"));
|
||||
data.setGiftName(set.getString("giftName"));
|
||||
data.setGiftIndex(set.getInt("giftIndex"));
|
||||
data.setPrice(set.getInt("price"));
|
||||
data.setPriceOfCommission(set.getInt("priceOfcommission"));
|
||||
data.setSubTime(new Date(Long.parseLong(set.getString("subtime"))));
|
||||
data.setGiftId(set.getInt("giftId"));
|
||||
list.add(data);
|
||||
}
|
||||
statement.closeOnCompletion();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有直播统计
|
||||
* @return 直播统计列表
|
||||
*/
|
||||
public List<LiveInfo> getLiveInfo() {
|
||||
return getLiveInfo("select * from `live_info`;");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播统计
|
||||
* @param sql sql
|
||||
* @return 直播统计列表
|
||||
*/
|
||||
private List<LiveInfo> getLiveInfo(String sql) {
|
||||
List<LiveInfo> list = new ArrayList<>();
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
ResultSet set = statement.executeQuery(sql);
|
||||
while (set.next()) {
|
||||
LiveInfo data = new LiveInfo();
|
||||
data.setId(set.getInt("id"));
|
||||
data.setRoomId(set.getInt("roomid"));
|
||||
data.setPopular(set.getInt("popular"));
|
||||
data.setUserIndex(set.getInt("userIndex"));
|
||||
data.setVipUserIndex(set.getInt("vipUserIndex"));
|
||||
data.setSubTime(new Date(Long.parseLong(set.getString("subtime"))));
|
||||
list.add(data);
|
||||
}
|
||||
statement.closeOnCompletion();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加up信息
|
||||
* @param upData up信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
public boolean addUpInfo(BiliBiliUpData upData) {
|
||||
if (queryUp(upData) != null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
String sql = "insert into `up_info` (`name`,`url`,`roomid`,`offlineListening`,`enable`,`saveDanmu`)" +
|
||||
" values ('"
|
||||
+ upData.getName()
|
||||
+ "','" + upData.getUrl()
|
||||
+ "'," + upData.getRoomId()
|
||||
+ " ," + (upData.isOfflineListening() ? 1 : 0)
|
||||
+ ", " + (upData.isEnable() ? 1 : 0)
|
||||
+ ", " + (upData.isSaveDanmu() ? 1 : 0) +
|
||||
");";
|
||||
System.out.println(sql);
|
||||
statement.execute(sql);
|
||||
statement.closeOnCompletion();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新UP信息
|
||||
* @param upData up信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
public boolean updateUpInfo(BiliBiliUpData upData) {
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
String sql = "update `up_info` set `name`='" + upData.getName() + "'" +
|
||||
",`url`='" + upData.getUrl() + "'" +
|
||||
", `roomid` = " + upData.getRoomId() + "" +
|
||||
",`offlineListening` = " + (upData.isOfflineListening() ? 1 : 0) + "" +
|
||||
", `enable` = " + (upData.isEnable() ? 1 : 0)
|
||||
+ " where `id` = " + upData.getId();
|
||||
statement.execute(sql);
|
||||
statement.closeOnCompletion();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定up信息
|
||||
* @param upData roomId
|
||||
* @return 是否成功
|
||||
*/
|
||||
public boolean deleteUp(BiliBiliUpData upData) {
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
String sql = "DELETE from `up_info` where `roomid`=" + upData.getRoomId();
|
||||
statement.execute(sql);
|
||||
statement.closeOnCompletion();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增直播数据
|
||||
* @param data 直播数据
|
||||
* @return 是否成功
|
||||
*/
|
||||
public boolean addLiveData(BilibiliLiveData data) {
|
||||
String sql = "insert into `live_data` (`type`,`msg`,`giftName`,`giftIndex`,`price`,`priceOfcommission`,`subtime`,`giftId`,`roomid`,`uid`) values (" +
|
||||
"'" + data.getType() + "'" +
|
||||
",'" + data.getMsg() + "'" +
|
||||
",'" + data.getGiftname() + "'" +
|
||||
"," + data.getGiftindex() + "" +
|
||||
"," + data.getPrice() + "" +
|
||||
"," + data.getPriceofcommission() + "" +
|
||||
"," + data.getSubtime().getTime() + "" +
|
||||
"," + data.getGiftid() +
|
||||
"," + data.getRoomid() +
|
||||
"," + data.getUid() +
|
||||
")";
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
statement.execute(sql);
|
||||
statement.closeOnCompletion();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println(sql);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加直播统计
|
||||
* @param data 直播统计
|
||||
* @return 是否成功
|
||||
*/
|
||||
public boolean addLiveInfo(LiveInfo data) {
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
String sql = "insert into `live_info` (`popular`,`userIndex`,`vipUserIndex`,`subtime`,`roomid`) values (" +
|
||||
"" + data.getPopular() + "" +
|
||||
"," + data.getUserIndex() + "" +
|
||||
"," + data.getVipUserIndex() + "" +
|
||||
"," + data.getSubTime().getTime() +
|
||||
"," + data.getRoomId() +
|
||||
")";
|
||||
statement.execute(sql);
|
||||
statement.closeOnCompletion();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定时段直播数据
|
||||
* @param roomId roomId
|
||||
* @param startTime 开始时间,为空表示为当天00:00:00
|
||||
* @param endTime 结束时间,为空表示为当时
|
||||
* @param type 类型
|
||||
* @return 列表
|
||||
*/
|
||||
public List<LiveData> queryLiveData(int roomId, Date startTime, Date endTime, String[] type) {
|
||||
String typeSql = "";
|
||||
for (String t : type) {
|
||||
typeSql += "or `type` ='" + t + "' ";
|
||||
}
|
||||
typeSql = typeSql.substring(2);
|
||||
String sql = String.format("select * from `live_data` where `subtime`>=%d and `subtime`<=%d and `roomid`=%d and (" + typeSql + ")"
|
||||
, startTime.getTime(), endTime.getTime(), roomId);
|
||||
return getLiveData(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定时段直播某个礼物总数
|
||||
* @param roomId roomId
|
||||
* @param giftId 礼物id,-1则为全部
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 数量
|
||||
*/
|
||||
public int queryGiftSize(int roomId, int giftId, Date startTime, Date endTime) {
|
||||
try {
|
||||
if (startTime == null || endTime == null) {
|
||||
startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(AppTools.getToDayTime() + " " + "00:00");
|
||||
endTime = new Date();
|
||||
}
|
||||
String sql;
|
||||
if(giftId!=-1) {
|
||||
sql = String.format("select sum(data.giftIndex) as size from `live_data` as data where data.giftId =%d and data.roomid=%d and data.subtime >=%d and data.subtime <%d;"
|
||||
, giftId, roomId, startTime.getTime(), endTime.getTime());
|
||||
}else{
|
||||
sql = String.format("select sum(data.giftIndex) as size from `live_data` as data where data.roomid=%d and data.subtime >=%d and data.subtime <%d;"
|
||||
, roomId, startTime.getTime(), endTime.getTime());
|
||||
}
|
||||
Statement statement = conn.createStatement();
|
||||
ResultSet set = statement.executeQuery(sql);
|
||||
if (set.next()) {
|
||||
statement.closeOnCompletion();
|
||||
return set.getInt("size");
|
||||
}
|
||||
statement.closeOnCompletion();
|
||||
return 0;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回指定时段各个礼物总数
|
||||
* @param roomId roomId
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return {giftName:size}
|
||||
*/
|
||||
public Map<String, Integer> queryGiftSize(int roomId, Date startTime, Date endTime) {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
try {
|
||||
if (startTime == null || endTime == null) {
|
||||
startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(AppTools.getToDayTime() + " " + "00:00");
|
||||
endTime = new Date();
|
||||
}
|
||||
String sql = String.format("select giftName,sum(giftIndex) as size from `live_data` where subtime >=%d and subtime <=%d and roomid=%d group by giftName;"
|
||||
, startTime.getTime(), endTime.getTime(), roomId);
|
||||
Statement statement = conn.createStatement();
|
||||
ResultSet set = statement.executeQuery(sql);
|
||||
while (set.next()) {
|
||||
map.put(set.getString("giftName"), set.getInt("size"));
|
||||
}
|
||||
statement.closeOnCompletion();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定时段收益情况
|
||||
* @param roomId roomId
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 未扣除收成比例的金瓜子数量
|
||||
*/
|
||||
public int queryPriceSize(int roomId, Date startTime, Date endTime) {
|
||||
try {
|
||||
if (startTime == null || endTime == null) {
|
||||
startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(AppTools.getToDayTime() + " " + "00:00");
|
||||
endTime = new Date();
|
||||
}
|
||||
String sql = String.format("select sum(data.price) as size from `live_data` as data where data.subtime >=%d and data.subtime <=%d and data.roomid=%d;"
|
||||
, startTime.getTime(), endTime.getTime(), roomId);
|
||||
Statement statement = conn.createStatement();
|
||||
ResultSet set = statement.executeQuery(sql);
|
||||
if (set.next()) {
|
||||
statement.closeOnCompletion();
|
||||
return set.getInt("size");
|
||||
}
|
||||
statement.closeOnCompletion();
|
||||
return 0;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据礼物id查询礼物信息,该方法主要用于阿B接口未收录的礼物信息
|
||||
* @param giftId 礼物id
|
||||
* @return 直播信息
|
||||
*/
|
||||
public LiveData queryGiftOfId(int giftId) {
|
||||
String sql = String.format("select * from `live_data` where `giftId` = %d;", giftId);
|
||||
List<LiveData> list = getLiveData(sql);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定时段去重送礼人数
|
||||
*
|
||||
* @param upData up信息
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param type 礼物类型
|
||||
* @return 人数
|
||||
*/
|
||||
public int queryGiftUserToDistinct(BiliBiliUpData upData, Date startTime, Date endTime, String[] type) {
|
||||
try {
|
||||
if (startTime == null || endTime == null) {
|
||||
startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(AppTools.getToDayTime() + " " + "00:00");
|
||||
endTime = new Date();
|
||||
}
|
||||
String typeSql = "";
|
||||
for (String t : type) {
|
||||
typeSql += "or `type` ='" + t + "' ";
|
||||
}
|
||||
typeSql = typeSql.substring(2);
|
||||
String sql = String.format("select count(distinct uid) as size from `live_data` where subtime>=%d and subtime <%d and roomid=%d and(%s);"
|
||||
, startTime.getTime(), endTime.getTime(), upData.getRoomId(), typeSql);
|
||||
return queryGiftCount(sql);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询礼物数量
|
||||
* @param sql sql
|
||||
* @return 礼物数量
|
||||
*/
|
||||
private int queryGiftCount(String sql) {
|
||||
int count = 0;
|
||||
try {
|
||||
|
||||
Statement statement = conn.createStatement();
|
||||
ResultSet set = statement.executeQuery(sql);
|
||||
if (set.next()) {
|
||||
count = set.getInt("size");
|
||||
}
|
||||
statement.closeOnCompletion();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询时段内人气数量
|
||||
* @param upData up信息
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 人气
|
||||
*/
|
||||
public int queryPopularCount(BiliBiliUpData upData,Date startTime, Date endTime){
|
||||
int count = 0;
|
||||
try{
|
||||
if (startTime == null || endTime == null) {
|
||||
startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(AppTools.getToDayTime() + " " + "00:00");
|
||||
endTime = new Date();
|
||||
}
|
||||
String sql=String.format("select sum(data.popular) as size from `live_info` as data where data.subtime >=%d and data.subtime <%d and data.roomid=%d;"
|
||||
,startTime.getTime(),endTime.getTime(),upData.getRoomId());
|
||||
Statement statement = conn.createStatement();
|
||||
ResultSet set = statement.executeQuery(sql);
|
||||
if (set.next()) {
|
||||
count = set.getInt("size");
|
||||
}
|
||||
statement.closeOnCompletion();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询时段内进场人数
|
||||
* @param upData up信息
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 人数
|
||||
*/
|
||||
public int queryUserCount(BiliBiliUpData upData,Date startTime, Date endTime){
|
||||
int count=0;
|
||||
try{
|
||||
if (startTime == null || endTime == null) {
|
||||
startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(AppTools.getToDayTime() + " " + "00:00");
|
||||
endTime = new Date();
|
||||
}
|
||||
String sql=String.format("select sum(userIndex+vipUserIndex) as size from `live_info` where `subtime`>=%d and `subtime`<=%d and `roomid`=%d;"
|
||||
,startTime.getTime(),endTime.getTime(),upData.getRoomId());
|
||||
Statement statement = conn.createStatement();
|
||||
ResultSet set = statement.executeQuery(sql);
|
||||
if (set.next()) {
|
||||
count = set.getInt("size");
|
||||
}
|
||||
statement.closeOnCompletion();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return count;
|
||||
}
|
||||
public Map<String, Integer> queryUserGiftCount(BiliBiliUpData upData,Date startTime,Date endTime){
|
||||
Map<String,Integer> map=new HashMap<>();
|
||||
try{
|
||||
if (startTime == null || endTime == null) {
|
||||
startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(AppTools.getToDayTime() + " " + "00:00");
|
||||
endTime = new Date();
|
||||
}
|
||||
String sql=String.format("select * from `live_info` where subtime >=%d and subtime <%d and roomid=%d;"
|
||||
,startTime.getTime()
|
||||
,endTime.getTime()
|
||||
,upData.getRoomId());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return map;
|
||||
}
|
||||
}
|
||||
136
src/main/java/com/yutou/bilibili/sqlite/SQLiteManager.java
Normal file
136
src/main/java/com/yutou/bilibili/sqlite/SQLiteManager.java
Normal file
@@ -0,0 +1,136 @@
|
||||
package com.yutou.bilibili.sqlite;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
public class SQLiteManager {
|
||||
protected Connection conn;
|
||||
private String url = "jdbc:sqlite:";
|
||||
private File sql;
|
||||
|
||||
|
||||
public void startBatch() {
|
||||
try {
|
||||
conn.setAutoCommit(false);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void closeBatch() {
|
||||
try {
|
||||
conn.setAutoCommit(true);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void commit() {
|
||||
try {
|
||||
conn.commit();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected SQLiteManager() {
|
||||
|
||||
}
|
||||
private void createSql(JSONObject json){
|
||||
try {
|
||||
sql.mkdirs();
|
||||
sql.delete();
|
||||
conn = DriverManager.getConnection(url + sql.getAbsolutePath());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
startBatch();
|
||||
JSONArray array=json.getJSONArray("table");
|
||||
for (Object o : array) {
|
||||
System.out.println("创建表:"+((JSONObject)o).getString("name"));
|
||||
createSqlOfTable((JSONObject) o);
|
||||
}
|
||||
closeBatch();
|
||||
}
|
||||
private void createSqlOfTable(JSONObject table) {
|
||||
String tableName = table.getString("name");
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
JSONArray items = table.getJSONArray("item");
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("CREATE TABLE `")
|
||||
.append(tableName)
|
||||
.append("` (");
|
||||
for (Object item : items) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
JSONObject it = (JSONObject) item;
|
||||
String type;
|
||||
switch (it.getString("type")) {
|
||||
case "int":
|
||||
type = " INTEGER ";
|
||||
break;
|
||||
case "TIME":
|
||||
type = " NUMERIC ";
|
||||
break;
|
||||
default:
|
||||
type = " TEXT ";
|
||||
break;
|
||||
}
|
||||
builder.append("`")
|
||||
.append(it.getString("name"))
|
||||
.append("`")
|
||||
.append(type)
|
||||
.append(it.getBoolean("isNull") ? "" : " NOT NULL ")
|
||||
.append(it.getBoolean("isKey") ? " PRIMARY KEY AUTOINCREMENT " : "")
|
||||
.append(",");
|
||||
sql.append(builder.toString());
|
||||
}
|
||||
sql.append(");");
|
||||
statement.execute(sql.toString().replace(",);", ");"));
|
||||
statement.closeOnCompletion();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void build(JSONObject json) {
|
||||
try {
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
sql = new File("databases" + File.separator + json.getString("file"));
|
||||
if (!sql.exists()) {
|
||||
createSql(json);
|
||||
} else {
|
||||
conn = DriverManager.getConnection(url + sql.getAbsolutePath());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setDB(String fileName) {
|
||||
try {
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
sql = new File("db" + File.separator + fileName);
|
||||
if (sql.exists()) {
|
||||
if (conn != null && !conn.isClosed()) {
|
||||
conn.close();
|
||||
}
|
||||
conn = DriverManager.getConnection(url + sql.getAbsolutePath());
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.yutou.bilibili.sqlite;
|
||||
|
||||
public class YouTubeLiveDatabasesManager extends SQLiteManager{
|
||||
private static YouTubeLiveDatabasesManager manager;
|
||||
public static YouTubeLiveDatabasesManager getInstance(){
|
||||
if(manager==null){
|
||||
manager=new YouTubeLiveDatabasesManager();
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
public YouTubeLiveDatabasesManager() {
|
||||
super();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user