diff --git a/biliapi/pom.xml b/biliapi/pom.xml deleted file mode 100644 index f2bc687..0000000 --- a/biliapi/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - 4.0.0 - - com.yutou - bilibili - 0.0.1-SNAPSHOT - - - biliapi - - - 21 - 21 - UTF-8 - - - - io.reactivex.rxjava3 - rxjava - 3.1.8 - - - com.aayushatharva.brotli4j - brotli4j - 1.16.0 - - - - \ No newline at end of file diff --git a/biliapi/src/main/java/com/yutou/Main.java b/biliapi/src/main/java/com/yutou/Main.java deleted file mode 100644 index 21328bd..0000000 --- a/biliapi/src/main/java/com/yutou/Main.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.yutou; - -import com.alibaba.fastjson2.JSONObject; -import com.yutou.bili.api.LiveApi; -import com.yutou.bili.api.UserApi; -import com.yutou.bili.bean.live.LiveRoomConfig; -import com.yutou.bili.bean.live.LiveRoomInfo; -import com.yutou.bili.bean.live.LiveRoomPlayInfo; -import com.yutou.bili.bean.live.SpiBean; -import com.yutou.bili.bean.login.LoginCookieDatabaseBean; -import com.yutou.bili.bean.login.UserInfoBean; -import com.yutou.bili.enums.LiveProtocol; -import com.yutou.bili.enums.LiveVideoCodec; -import com.yutou.bili.enums.LiveVideoDefinition; -import com.yutou.bili.enums.LiveVideoFormat; -import com.yutou.bili.net.BiliLiveNetApiManager; -import com.yutou.bili.net.BiliLoginNetApiManager; -import com.yutou.bili.databases.BiliBiliLoginDatabase; -import com.yutou.bili.net.BiliUserNetApiManager; -import com.yutou.bili.net.WebSocketManager; -import com.yutou.inter.IHttpApiCheckCallback; -import com.yutou.okhttp.HttpCallback; -import com.yutou.okhttp.HttpLoggingInterceptor; -import com.yutou.utils.Log; -import jakarta.xml.bind.DatatypeConverter; -import okhttp3.Headers; - -import java.io.ByteArrayOutputStream; -import java.nio.charset.StandardCharsets; - -public class Main { - public static void main(String[] args) { - HttpLoggingInterceptor.setLog(false); - HttpLoggingInterceptor.setLog(true); - // getPlayUrl(); - /* LiveRoomConfig config=new LiveRoomConfig(); - LoginCookieDatabaseBean cookie = BiliBiliLoginDatabase.getInstance().get(); - config.setLogin(true); - config.setUid(cookie.getDedeUserID()); - config.setRoomId(String.valueOf(855204)); - config.setRoomId(String.valueOf(22642754)); - config.setRoomId(String.valueOf(81004)); - config.setRoomId(String.valueOf(115)); - WebSocketManager.getInstance().addRoom(config);*/ - - BiliLiveNetApiManager - .getInstance() - .getApi(new IHttpApiCheckCallback() { - @Override - public void onSuccess(LiveApi api) { - api.getRoomInfo("33989") - .enqueue(new HttpCallback() { - @Override - public void onResponse(Headers headers, int code, String status, LiveRoomInfo response, String rawResponse) { - LiveRoomConfig config=new LiveRoomConfig(); - LoginCookieDatabaseBean cookie = BiliBiliLoginDatabase.getInstance().get(); - config.setLogin(true); - config.setUid(cookie.getDedeUserID()); - config.setRoomId(String.valueOf(response.getRoomId())); - config.setRoomInfo(response); - WebSocketManager.getInstance().addRoom(config); - } - - @Override - public void onFailure(Throwable throwable) { - - } - }); - } - - @Override - public void onError(int code, String error) { - - } - }); - - } - - - public static void testSocket(SpiBean spi) { - try { - JSONObject json = new JSONObject(); - // json.put("roomid", "32805602"); - json.put("roomid", "855204"); - json.put("protover", "3"); - json.put("platform", "web"); - json.put("type", 2); - json.put("buvid",spi.getB_3()); - json.put("key", "aaaabbb"); - Log.i(json); - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - // outputStream.write(toLH(json.toString().length() + 16)); - outputStream.write(new byte[]{0, 0, 1, 68, 0, 16, 0, 1, 0, 0, 0, 7, 0, 0, 0, 1}); - outputStream.write(json.toJSONString().getBytes(StandardCharsets.UTF_8)); - outputStream.flush(); - System.out.println("\n\n\n"); - String str = DatatypeConverter.printHexBinary(outputStream.toByteArray()); - 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.println("\n\n\n"); - - } catch (Exception e) { - e.printStackTrace(); - } - } - - public static void getPlayUrl() { - BiliLiveNetApiManager - .getInstance() - .getApi(new IHttpApiCheckCallback() { - @Override - public void onSuccess(LiveApi api) { - String roomId = "32805602"; - String mid = "68057278"; - - // roomId="42062"; - - api.getLiveRoomPlayInfo( - roomId, - LiveProtocol.getAll(), - LiveVideoFormat.getAll(), - LiveVideoCodec.getAll(), - LiveVideoDefinition.ORIGINAL.getValue() - ).enqueue(new HttpCallback<>() { - @Override - public void onResponse(Headers headers, int code, String status, LiveRoomPlayInfo response, String rawResponse) { - LiveRoomPlayInfo.Codec codec = response.getPlayurlInfo().getPlayurl().getStream().get(0).getFormat().get(0).getCodec().get(0); - - LiveRoomConfig config = new LiveRoomConfig(); - config.setUid("0"); - config.setRoomId(roomId); - config.setMid(mid); - config.setLogin(false); - WebSocketManager.getInstance().addRoom(config); - - /*String url = codec.getUrlInfo().get(0).getHost() + codec.getBaseUrl() + codec.getUrlInfo().get(0).getExtra(); - System.out.println("下载url = " + url); - api.downloadLive(url).enqueue(new FileCallback<>(response) { - @Override - public void onStart(LiveRoomPlayInfo bean) { - System.out.println("开始下载"); - } - - @Override - public boolean onDownload(Headers headers, LiveRoomPlayInfo bean, long len, long total) { - System.out.println("下载中:"+len+"|"+total); - return true; - } - - @Override - public void onFinish(LiveRoomPlayInfo bean) { - System.out.println("下载结束"); - } - - @Override - public void onFailure(LiveRoomPlayInfo bean, Throwable throwable) { - System.out.println("下载失败"); - } - });*/ - - } - - @Override - public void onFailure(Throwable throwable) { - - } - }); - } - - @Override - public void onError(int code, String error) { - - } - }); - } - - public static void login(String username, String password) { - BiliLoginNetApiManager.getInstance().login(new HttpCallback() { - @Override - public void onResponse(Headers headers, int code, String status, LoginCookieDatabaseBean response, String rawResponse) { - System.out.println("headers = " + headers + ", code = " + code + ", status = " + status + ", response = " + response + ", rawResponse = " + rawResponse); - if (code == BiliLoginNetApiManager.LOGIN_SUCCESS) { - BiliBiliLoginDatabase.getInstance().initData(response).close(); - } - } - - @Override - public void onFailure(Throwable throwable) { - - } - }); - } - - public static void getUserInfo() { - BiliUserNetApiManager.getInstance().getUserApi(new IHttpApiCheckCallback() { - @Override - public void onSuccess(UserApi api) { - api.getUserInfo().enqueue(new HttpCallback() { - @Override - public void onResponse(Headers headers, int code, String status, UserInfoBean response, String rawResponse) { - System.out.println("response = " + rawResponse); - System.out.println(response); - } - - @Override - public void onFailure(Throwable throwable) { - - } - }); - } - - @Override - public void onError(int code, String error) { - System.out.println("code = " + code + ", error = " + error); - } - }); - } -} \ No newline at end of file diff --git a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveGiftDatabaseBean.java b/biliapi/src/main/java/com/yutou/bili/bean/live/LiveGiftDatabaseBean.java deleted file mode 100644 index ce1032a..0000000 --- a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveGiftDatabaseBean.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.yutou.bili.bean.live; - -import com.yutou.bili.bean.websocket.live.WSSendGift; -import com.yutou.databases.AbsDatabasesBean; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@EqualsAndHashCode(callSuper = true) -@Data -public class LiveGiftDatabaseBean extends AbsDatabasesBean { - public LiveGiftDatabaseBean() { - super("gift"); - } - - public LiveGiftDatabaseBean(WSSendGift tableName) { - super("gift"); - } -} diff --git a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveRoomConfig.java b/biliapi/src/main/java/com/yutou/bili/bean/live/LiveRoomConfig.java deleted file mode 100644 index e756076..0000000 --- a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveRoomConfig.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.yutou.bili.bean.live; - -import lombok.Data; - -@Data -public class LiveRoomConfig { - String uid; - String roomId; - String mid;//真实房间id - boolean isLogin; - LiveDanmuInfo liveInfo; - LiveRoomInfo roomInfo; - -} diff --git a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveSourceDatabaseBean.java b/biliapi/src/main/java/com/yutou/bili/bean/live/LiveSourceDatabaseBean.java deleted file mode 100644 index fc2f709..0000000 --- a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveSourceDatabaseBean.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.yutou.bili.bean.live; - -import com.yutou.bili.bean.websocket.live.WSData; -import com.yutou.databases.AbsDatabasesBean; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@EqualsAndHashCode(callSuper = true) -@Data -public class LiveSourceDatabaseBean extends AbsDatabasesBean { - private String json; - private long timer; - - public LiveSourceDatabaseBean() { - super("source"); - } - - public LiveSourceDatabaseBean(WSData bean) { - super("source"); - this.json = bean.getJson(); - timer = bean.getWs_timer(); - } -} diff --git a/biliapi/src/main/java/com/yutou/bili/databases/BiliBiliLoginDatabase.java b/biliapi/src/main/java/com/yutou/bili/databases/BiliBiliLoginDatabase.java deleted file mode 100644 index 959b7a9..0000000 --- a/biliapi/src/main/java/com/yutou/bili/databases/BiliBiliLoginDatabase.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.yutou.bili.databases; - -import com.yutou.bili.bean.login.LoginCookieDatabaseBean; -import com.yutou.databases.AbsDatabasesBean; -import com.yutou.databases.SQLiteManager; - -import java.util.List; - -public class BiliBiliLoginDatabase extends SQLiteManager { - LoginCookieDatabaseBean cookie; - private static BiliBiliLoginDatabase instance; - - private BiliBiliLoginDatabase(Class tClass) { - try { - cookie = new LoginCookieDatabaseBean(); - } catch (Exception e) { - throw new RuntimeException(e); - } - init(); - } - - public static BiliBiliLoginDatabase getInstance() { - if (instance == null) { - instance = new BiliBiliLoginDatabase(LoginCookieDatabaseBean.class); - } - return instance; - } - - - public BiliBiliLoginDatabase initData(LoginCookieDatabaseBean cookie) { - this.cookie = cookie; - for (BuildSqlTable table : build.getTable()) { - cookie.setTableName(table.getName()); - add(cookie); - } - return this; - } - - public LoginCookieDatabaseBean get() { - List list = super.get(cookie.getTableName(), LoginCookieDatabaseBean.class); - if (!list.isEmpty()) { - return list.getFirst(); - } - return null; - } - - @Override - public String getFileName() { - return "bilibili_login.db"; - } - - @Override - protected List getDataBean() { - return List.of(new LoginCookieDatabaseBean()); - } -} -/** - * - */ \ No newline at end of file diff --git a/biliapi/src/main/java/com/yutou/bili/databases/BiliLiveDatabase.java b/biliapi/src/main/java/com/yutou/bili/databases/BiliLiveDatabase.java deleted file mode 100644 index dce45e2..0000000 --- a/biliapi/src/main/java/com/yutou/bili/databases/BiliLiveDatabase.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.yutou.bili.databases; - -import com.yutou.bili.bean.live.*; -import com.yutou.bili.bean.websocket.live.WSDanmuData; -import com.yutou.bili.bean.websocket.live.WSData; -import com.yutou.bili.bean.websocket.live.WSInteractWord; -import com.yutou.bili.bean.websocket.live.WSSendGift; -import com.yutou.databases.AbsDatabasesBean; -import com.yutou.databases.SQLiteManager; - -import java.util.List; - -public class BiliLiveDatabase extends SQLiteManager { - private static BiliLiveDatabase instance; - LiveInfoDatabaseBean bean; - - public static BiliLiveDatabase getInstance() { - if (instance == null) { - instance = new BiliLiveDatabase(); - } - return instance; - } - - private BiliLiveDatabase() { - init(); - } - - @Override - public String getFileName() { - return "live.db"; - } - - @Override - protected List getDataBean() { - return List.of( - new LiveInfoDatabaseBean(), - new LiveDanmuDatabaseBean(), - new LiveGiftDatabaseBean(), - new LiveInteractWordDatabaseBean(), - new LiveSourceDatabaseBean() - ); - } - - public void addLiveInfo(LiveRoomInfo info) { - this.bean = new LiveInfoDatabaseBean(info); - - List infos = get(bean.getTableName(), LiveInfoDatabaseBean.class); - if (infos.isEmpty()) { - createInfo(bean); - } - } - - private void addData(WSData bean) { - if (bean instanceof WSDanmuData) { - add(new LiveDanmuDatabaseBean((WSDanmuData) bean)); - } else if (bean instanceof WSInteractWord) { - add(new LiveInteractWordDatabaseBean((WSInteractWord) bean)); - }else if(bean instanceof WSSendGift){ - add(new LiveGiftDatabaseBean((WSSendGift) bean)); - } - } - - public void addSource(WSData bean) { - add(new LiveSourceDatabaseBean(bean)); - addData(bean); - } - - private void createInfo(LiveInfoDatabaseBean bean) { - add(bean); - } -} diff --git a/biliapi/src/main/java/com/yutou/bili/net/BiliLiveNetApiManager.java b/biliapi/src/main/java/com/yutou/bili/net/BiliLiveNetApiManager.java deleted file mode 100644 index 9378e39..0000000 --- a/biliapi/src/main/java/com/yutou/bili/net/BiliLiveNetApiManager.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.yutou.bili.net; - -import com.alibaba.fastjson2.JSONObject; -import com.yutou.bili.api.LiveApi; -import com.yutou.bili.bean.login.LoginCookieDatabaseBean; -import com.yutou.bili.databases.BiliBiliLoginDatabase; -import com.yutou.inter.IHttpApiCheckCallback; -import com.yutou.okhttp.api.BaseApi; - -import java.util.HashMap; - -public class BiliLiveNetApiManager extends BaseApi { - private static BiliLiveNetApiManager instance; - - public static BiliLiveNetApiManager getInstance() { - if (instance == null) { - instance = new BiliLiveNetApiManager("https://api.live.bilibili.com"); - } - return instance; - } - - private BiliLiveNetApiManager(String URL) { - super(URL); - } - - public void getApi(IHttpApiCheckCallback callback) { - LoginCookieDatabaseBean cookie = BiliBiliLoginDatabase.getInstance().get(); - if (cookie != null) { - useCookie(JSONObject.parseObject(JSONObject.toJSONString(cookie))); - } - HashMap header=new HashMap<>(); - header.put("Accept-Language", "zh-CN,zh;q=0.8"); - header.put("Referer", "https://live.bilibili.com"); - header.put("Connection", "keep-alive"); - header.put("Upgrade-Insecure-Requests", "1"); - addHeader(header); - callback.onSuccess(createApi(LiveApi.class)); - } -} diff --git a/biliapi/src/main/java/com/yutou/bili/utils/BiliUserUtils.java b/biliapi/src/main/java/com/yutou/bili/utils/BiliUserUtils.java deleted file mode 100644 index 4e63b2c..0000000 --- a/biliapi/src/main/java/com/yutou/bili/utils/BiliUserUtils.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.yutou.bili.utils; - -import com.yutou.bili.api.UserApi; -import com.yutou.bili.bean.live.SpiBean; -import com.yutou.bili.net.BiliUserNetApiManager; -import com.yutou.inter.IHttpApiCheckCallback; -import com.yutou.okhttp.HttpCallback; -import com.yutou.utils.RedisTools; -import okhttp3.Headers; - -public class BiliUserUtils { - public static void getBuvid(IHttpApiCheckCallback callback) { - String buvid= RedisTools.get(RedisTools.BILI_USER_BUVID); - if(buvid!=null){ - callback.onSuccess(buvid); - return; - } - BiliUserNetApiManager.getInstance().getUserApi(new IHttpApiCheckCallback() { - @Override - public void onSuccess(UserApi api) { - api.getFingerSpi().enqueue(new HttpCallback() { - @Override - public void onResponse(Headers headers, int code, String status, SpiBean response, String rawResponse) { - RedisTools.set(RedisTools.BILI_USER_BUVID,response.getB_3()); - callback.onSuccess(response.getB_3()); - } - - @Override - public void onFailure(Throwable throwable) { - - } - }); - } - - @Override - public void onError(int code, String error) { - - } - }); - } -} diff --git a/common/pom.xml b/common/pom.xml deleted file mode 100644 index 6b8bcf9..0000000 --- a/common/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - 4.0.0 - - com.yutou - bilibili - 0.0.1-SNAPSHOT - - - common - - - 21 - 21 - UTF-8 - - - - - com.squareup.okhttp3 - okhttp - 4.12.0 - - - - - com.squareup.retrofit2 - retrofit - 2.11.0 - - - \ No newline at end of file diff --git a/common/src/main/java/com/yutou/databases/AbsDatabasesBean.java b/common/src/main/java/com/yutou/databases/AbsDatabasesBean.java deleted file mode 100644 index 7e58064..0000000 --- a/common/src/main/java/com/yutou/databases/AbsDatabasesBean.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.yutou.databases; - -import com.alibaba.fastjson2.JSONObject; -import com.alibaba.fastjson2.JSONWriter; -import com.alibaba.fastjson2.annotation.JSONField; -import lombok.Data; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -@Data -public class AbsDatabasesBean { - String tableName; - - private AbsDatabasesBean() { - } - - public AbsDatabasesBean(String tableName) { - this.tableName = tableName; - } - - public JSONObject toJson() { - JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(this, JSONWriter.Feature.WriteMapNullValue)); - json.remove("tableName"); - json.put("id","0"); - System.out.println("创建"+tableName+"表 json:"+json); - return json; - } -} diff --git a/pom.xml b/pom.xml index f30b6c2..095a3ed 100644 --- a/pom.xml +++ b/pom.xml @@ -14,14 +14,9 @@ pom bilibili Demo project for Spring Boot - - biliapi - qqbot - common - 21 - 1.6.10 + 1.7.22 @@ -32,11 +27,6 @@ org.springframework.boot spring-boot-starter-web-services - - com.mysql - mysql-connector-j - runtime - org.springframework.boot spring-boot-starter-test @@ -77,11 +67,6 @@ Java-WebSocket 1.5.2 - - org.mybatis.spring.boot - mybatis-spring-boot-starter - 2.2.2 - org.apache.poi @@ -110,22 +95,36 @@ jedis 4.2.0 + - com.yutou - common - 0.0.1-SNAPSHOT - compile + io.reactivex.rxjava3 + rxjava + 3.1.8 - com.yutou - qqbot - 0.0.1-SNAPSHOT - compile + com.aayushatharva.brotli4j + brotli4j + 1.16.0 + + + + com.squareup.okhttp3 + okhttp + 4.12.0 + + + com.squareup.retrofit2 + retrofit + 2.11.0 + + ${project.basedir}/src/main/java + ${project.basedir}/src/test/java + ${project.basedir}/target/classes org.apache.maven.plugins @@ -146,27 +145,6 @@ - - org.jetbrains.kotlin - kotlin-maven-plugin - ${kotlin.version} - - - - compile - - compile - - - - - test-compile - - test-compile - - - - org.springframework.boot spring-boot-maven-plugin @@ -174,7 +152,7 @@ ZIP - com.yutou.bilibili.BilibiliApplication + com.yutou.BilibiliApplication @@ -193,8 +171,8 @@ org.apache.maven.plugins maven-compiler-plugin - 7 - 7 + 21 + 21 diff --git a/qqbot/pom.xml b/qqbot/pom.xml deleted file mode 100644 index 4c474c1..0000000 --- a/qqbot/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - 4.0.0 - - com.yutou - bilibili - 0.0.1-SNAPSHOT - - - qqbot - - - 21 - 21 - UTF-8 - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/yutou/BilibiliApplication.java b/src/main/java/com/yutou/BilibiliApplication.java new file mode 100644 index 0000000..c1b718b --- /dev/null +++ b/src/main/java/com/yutou/BilibiliApplication.java @@ -0,0 +1,17 @@ +package com.yutou; + +import com.yutou.common.okhttp.HttpLoggingInterceptor; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication() +public class BilibiliApplication { + + public static String version = "0.8.4"; + + public static void main(String[] args) { + HttpLoggingInterceptor.setLog(false); + SpringApplication.run(BilibiliApplication.class, args); + } + +} diff --git a/src/main/java/com/yutou/biliapi/Main.java b/src/main/java/com/yutou/biliapi/Main.java new file mode 100644 index 0000000..b08ed4f --- /dev/null +++ b/src/main/java/com/yutou/biliapi/Main.java @@ -0,0 +1,167 @@ +package com.yutou.biliapi; + +import com.alibaba.fastjson2.JSONObject; +import com.yutou.biliapi.api.UserApi; +import com.yutou.biliapi.bean.live.SpiBean; +import com.yutou.biliapi.bean.login.LoginCookieDatabaseBean; +import com.yutou.biliapi.bean.login.LoginUserDatabaseBean; +import com.yutou.biliapi.bean.login.UserInfoBean; +import com.yutou.biliapi.net.BiliLoginNetApiManager; +import com.yutou.biliapi.databases.BiliBiliLoginDatabase; +import com.yutou.biliapi.net.BiliUserNetApiManager; +import com.yutou.common.inter.IHttpApiCheckCallback; +import com.yutou.common.okhttp.HttpBody; +import com.yutou.common.okhttp.HttpCallback; +import com.yutou.common.okhttp.HttpLoggingInterceptor; +import com.yutou.common.utils.Log; +import jakarta.xml.bind.DatatypeConverter; +import okhttp3.Headers; +import retrofit2.Response; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; + +public class Main { + public static void main(String[] args) { + // HttpLoggingInterceptor.setLog(false); + // HttpLoggingInterceptor.setLog(true); + // login(); + } + + + public static void testSocket(SpiBean spi) { + try { + JSONObject json = new JSONObject(); + // json.put("roomid", "32805602"); + json.put("roomid", "855204"); + json.put("protover", "3"); + json.put("platform", "web"); + json.put("type", 2); + json.put("buvid", spi.getB_3()); + json.put("key", "aaaabbb"); + Log.i(json); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + // outputStream.write(toLH(json.toString().length() + 16)); + outputStream.write(new byte[]{0, 0, 1, 68, 0, 16, 0, 1, 0, 0, 0, 7, 0, 0, 0, 1}); + outputStream.write(json.toJSONString().getBytes(StandardCharsets.UTF_8)); + outputStream.flush(); + System.out.println("\n\n\n"); + String str = DatatypeConverter.printHexBinary(outputStream.toByteArray()); + 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.println("\n\n\n"); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void getPlayUrl() { +// BiliLiveNetApiManager +// .getInstance() +// .getApi(new IHttpApiCheckCallback() { +// @Override +// public void onSuccess(LiveApi api) { +// String roomId = "32805602"; +// String mid = "68057278"; +// +// // roomId="42062"; +// +// api.getLiveRoomPlayInfo( +// roomId, +// LiveProtocol.getAll(), +// LiveVideoFormat.getAll(), +// LiveVideoCodec.getAll(), +// LiveVideoDefinition.ORIGINAL.getValue() +// ).enqueue(new HttpCallback<>() { +// @Override +// public void onResponse(Headers headers, int code, String status, LiveRoomPlayInfo response, String rawResponse) { +// LiveRoomPlayInfo.Codec codec = response.getPlayurlInfo().getPlayurl().getStream().get(0).getFormat().get(0).getCodec().get(0); +// +// LiveRoomConfig config = new LiveRoomConfig(); +// config.setUid("0"); +// config.setRoomId(roomId); +// config.setMid(mid); +// config.setLogin(false); +// WebSocketManager.getInstance().addRoom(config); +// +// /*String url = codec.getUrlInfo().get(0).getHost() + codec.getBaseUrl() + codec.getUrlInfo().get(0).getExtra(); +// System.out.println("下载url = " + url); +// api.downloadLive(url).enqueue(new FileCallback<>(response) { +// @Override +// public void onStart(LiveRoomPlayInfo bean) { +// System.out.println("开始下载"); +// } +// +// @Override +// public boolean onDownload(Headers headers, LiveRoomPlayInfo bean, long len, long total) { +// System.out.println("下载中:"+len+"|"+total); +// return true; +// } +// +// @Override +// public void onFinish(LiveRoomPlayInfo bean) { +// System.out.println("下载结束"); +// } +// +// @Override +// public void onFailure(LiveRoomPlayInfo bean, Throwable throwable) { +// System.out.println("下载失败"); +// } +// });*/ +// +// } +// +// @Override +// public void onFailure(Throwable throwable) { +// +// } +// }); +// } +// +// @Override +// public void onError(int code, String error) { +// +// } +// }); + } + + public static void login() { + BiliLoginNetApiManager.getInstance().login(new HttpCallback() { + @Override + public void onResponse(Headers headers, int code, String status, LoginCookieDatabaseBean response, String rawResponse) { + System.out.println("二维码地址: "+rawResponse); + if (code == BiliLoginNetApiManager.LOGIN_SUCCESS) { + Response> execute = null; + try { + execute = BiliUserNetApiManager.getInstance().getUserApi(response).getUserInfo().execute(); + if (execute.isSuccessful()) { + if (execute.body() != null) { + UserInfoBean data = execute.body().getData(); + LoginUserDatabaseBean userBean=new LoginUserDatabaseBean(data); + BiliBiliLoginDatabase.getInstance().initData(response,userBean).close(); + } + } + } catch (IOException e) { + throw new RuntimeException(e); + } + + } + } + + @Override + public void onFailure(Throwable throwable) { + + } + }); + } +} \ No newline at end of file diff --git a/biliapi/src/main/java/com/yutou/bili/api/LiveApi.java b/src/main/java/com/yutou/biliapi/api/LiveApi.java similarity index 62% rename from biliapi/src/main/java/com/yutou/bili/api/LiveApi.java rename to src/main/java/com/yutou/biliapi/api/LiveApi.java index f39356b..fc292a0 100644 --- a/biliapi/src/main/java/com/yutou/bili/api/LiveApi.java +++ b/src/main/java/com/yutou/biliapi/api/LiveApi.java @@ -1,9 +1,10 @@ -package com.yutou.bili.api; +package com.yutou.biliapi.api; -import com.yutou.bili.bean.live.*; -import com.yutou.okhttp.BaseBean; -import com.yutou.okhttp.FileBody; -import com.yutou.okhttp.HttpBody; +import com.alibaba.fastjson2.JSONObject; +import com.yutou.biliapi.bean.live.*; +import com.yutou.common.okhttp.BaseBean; +import com.yutou.common.okhttp.FileBody; +import com.yutou.common.okhttp.HttpBody; import retrofit2.Call; import retrofit2.http.*; @@ -30,10 +31,10 @@ public interface LiveApi { /** * 获取直播间信息 * @param id 直播间id - * @param protocol 直播协议 {@link com.yutou.bili.enums.LiveProtocol} - * @param format 格式 {@link com.yutou.bili.enums.LiveVideoFormat} - * @param codec 编码 {@link com.yutou.bili.enums.LiveVideoCodec} - * @param qn 清晰度 {@link com.yutou.bili.enums.LiveVideoDefinition} + * @param protocol 直播协议 {@link com.yutou.biliapi.enums.LiveProtocol} + * @param format 格式 {@link com.yutou.biliapi.enums.LiveVideoFormat} + * @param codec 编码 {@link com.yutou.biliapi.enums.LiveVideoCodec} + * @param qn 清晰度 {@link com.yutou.biliapi.enums.LiveVideoDefinition} * @return */ @GET("/xlive/web-room/v2/index/getRoomPlayInfo") @@ -50,4 +51,12 @@ public interface LiveApi { @GET("/xlive/web-room/v1/index/getDanmuInfo") Call> getLiveRoomDanmuInfo(@Query("id")String id); + + @GET("/xlive/web-room/v1/giftPanel/giftConfig?platform=pc") + Call> getLiveGiftConfig(); + + @POST("/room/v1/Room/get_status_info_by_uids") + Call> getLiveRoomStatus( @Body + JSONObject uids); + } diff --git a/biliapi/src/main/java/com/yutou/bili/api/LoginApi.java b/src/main/java/com/yutou/biliapi/api/LoginApi.java similarity index 72% rename from biliapi/src/main/java/com/yutou/bili/api/LoginApi.java rename to src/main/java/com/yutou/biliapi/api/LoginApi.java index 93ed0a7..5b891f5 100644 --- a/biliapi/src/main/java/com/yutou/bili/api/LoginApi.java +++ b/src/main/java/com/yutou/biliapi/api/LoginApi.java @@ -1,9 +1,9 @@ -package com.yutou.bili.api; +package com.yutou.biliapi.api; -import com.yutou.bili.bean.login.CheckCookieBean; -import com.yutou.bili.bean.login.LoginInfoBean; -import com.yutou.bili.bean.login.QRCodeGenerateBean; -import com.yutou.okhttp.HttpBody; +import com.yutou.biliapi.bean.login.CheckCookieBean; +import com.yutou.biliapi.bean.login.LoginInfoBean; +import com.yutou.biliapi.bean.login.QRCodeGenerateBean; +import com.yutou.common.okhttp.HttpBody; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Query; diff --git a/biliapi/src/main/java/com/yutou/bili/api/UserApi.java b/src/main/java/com/yutou/biliapi/api/UserApi.java similarity index 59% rename from biliapi/src/main/java/com/yutou/bili/api/UserApi.java rename to src/main/java/com/yutou/biliapi/api/UserApi.java index 6af1ba5..8657d12 100644 --- a/biliapi/src/main/java/com/yutou/bili/api/UserApi.java +++ b/src/main/java/com/yutou/biliapi/api/UserApi.java @@ -1,8 +1,8 @@ -package com.yutou.bili.api; +package com.yutou.biliapi.api; -import com.yutou.bili.bean.live.SpiBean; -import com.yutou.bili.bean.login.UserInfoBean; -import com.yutou.okhttp.HttpBody; +import com.yutou.biliapi.bean.live.SpiBean; +import com.yutou.biliapi.bean.login.UserInfoBean; +import com.yutou.common.okhttp.HttpBody; import retrofit2.Call; import retrofit2.http.GET; diff --git a/src/main/java/com/yutou/biliapi/bean/live/LiveAnchorInfo.java b/src/main/java/com/yutou/biliapi/bean/live/LiveAnchorInfo.java new file mode 100644 index 0000000..7edd83c --- /dev/null +++ b/src/main/java/com/yutou/biliapi/bean/live/LiveAnchorInfo.java @@ -0,0 +1,82 @@ +package com.yutou.biliapi.bean.live; + +import com.alibaba.fastjson2.annotation.JSONField; +import lombok.Data; + +import java.math.BigInteger; +import java.util.Date; + +@Data +public class LiveAnchorInfo { + /** + * { + * "title": "挑战最难魂系", + * "room_id": 7688602, + * "uid": 269415357, + * "online": 43171, + * "live_time": 1729049421, + * "live_status": 1, + * "short_id": 0, + * "area": 6, + * "area_name": "生活娱乐", + * "area_v2_id": 745, + * "area_v2_name": "虚拟Gamer", + * "area_v2_parent_name": "虚拟主播", + * "area_v2_parent_id": 9, + * "uname": "花花Haya", + * "face": "https://i0.hdslb.com/bfs/face/a269de03af269453d14eaf0dc7cc23240d69da6c.jpg", + * "tag_name": "日常,学习,萌宠,厨艺,手机直播", + * "tags": "唱见,虚拟主播,虚拟up主", + * "cover_from_user": "https://i0.hdslb.com/bfs/live/new_room_cover/925b98639a8d3b62462bc699c6dbb833e27e17d5.jpg", + * "keyframe": "https://i0.hdslb.com/bfs/live-key-frame/keyframe101614360000076886025wzvg0.jpg", + * "lock_till": "0000-00-00 00:00:00", + * "hidden_till": "0000-00-00 00:00:00", + * "broadcast_type": 0 + * } + */ + @JSONField(name = "title") + private String title; + @JSONField(name = "room_id") + private BigInteger roomId; + @JSONField(name = "uid") + private BigInteger uid; + @JSONField(name = "online") + private int online; + @JSONField(name = "live_time") + private long liveTime; + @JSONField(name = "live_status") + private int liveStatus; + @JSONField(name = "short_id") + private int shortId; + @JSONField(name = "area") + private int area; + @JSONField(name = "area_name") + private String areaName; + @JSONField(name = "area_v2_id") + private int areaV2Id; + @JSONField(name = "area_v2_name") + private String areaV2Name; + @JSONField(name = "area_v2_parent_id") + private int areaV2ParentId; + @JSONField(name = "area_v2_parent_name") + private String areaV2ParentName; + @JSONField(name = "uname") + private String uname; + @JSONField(name = "face") + private String face;//头像 + @JSONField(name = "cover_from_user") + private String coverFromUser;//直播封面 + @JSONField(name = "tag_name") + private String tagName; + @JSONField(name = "tags") + private String tags; + @JSONField(name = "keyframe") + private String keyframe;//直播关键帧 + @JSONField(name = "lock_till") + private Date lockTill; + @JSONField(name = "hidden_till") + private Date hiddenTill; + @JSONField(name = "broadcast_type") + private int broadcastType; + +} diff --git a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveDanmuInfo.java b/src/main/java/com/yutou/biliapi/bean/live/LiveDanmuInfo.java similarity index 96% rename from biliapi/src/main/java/com/yutou/bili/bean/live/LiveDanmuInfo.java rename to src/main/java/com/yutou/biliapi/bean/live/LiveDanmuInfo.java index 74d50b6..6bc5796 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveDanmuInfo.java +++ b/src/main/java/com/yutou/biliapi/bean/live/LiveDanmuInfo.java @@ -1,4 +1,4 @@ -package com.yutou.bili.bean.live; +package com.yutou.biliapi.bean.live; import com.alibaba.fastjson2.annotation.JSONField; import lombok.Data; diff --git a/src/main/java/com/yutou/biliapi/bean/live/LiveRoomConfig.java b/src/main/java/com/yutou/biliapi/bean/live/LiveRoomConfig.java new file mode 100644 index 0000000..3a42d8c --- /dev/null +++ b/src/main/java/com/yutou/biliapi/bean/live/LiveRoomConfig.java @@ -0,0 +1,40 @@ +package com.yutou.biliapi.bean.live; + +import lombok.Data; + +import java.math.BigInteger; +import java.util.Objects; + +@Data +public class LiveRoomConfig { + String loginUid; + BigInteger roomId; + String anchorName; + boolean isLogin; + LiveDanmuInfo liveInfo; + LiveRoomInfo roomInfo; + + public String getLoginUid() { + if("null".equals(loginUid)){ + loginUid=null; + } + return loginUid; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LiveRoomConfig that = (LiveRoomConfig) o; + return Objects.equals(roomId, that.roomId); + } + + @Override + public int hashCode() { + return Objects.hashCode(roomId); + } +} diff --git a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveRoomInfo.java b/src/main/java/com/yutou/biliapi/bean/live/LiveRoomInfo.java similarity index 97% rename from biliapi/src/main/java/com/yutou/bili/bean/live/LiveRoomInfo.java rename to src/main/java/com/yutou/biliapi/bean/live/LiveRoomInfo.java index ca4bc3b..d25fbb5 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveRoomInfo.java +++ b/src/main/java/com/yutou/biliapi/bean/live/LiveRoomInfo.java @@ -1,17 +1,18 @@ -package com.yutou.bili.bean.live; +package com.yutou.biliapi.bean.live; import com.alibaba.fastjson2.annotation.JSONField; import lombok.Data; +import java.math.BigInteger; import java.util.List; @Data public class LiveRoomInfo { @JSONField(name = "uid") - private int uid; + private BigInteger uid; @JSONField(name = "room_id") - private int roomId; + private BigInteger roomId; @JSONField(name = "short_id") private int shortId; diff --git a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveRoomPlayInfo.java b/src/main/java/com/yutou/biliapi/bean/live/LiveRoomPlayInfo.java similarity index 96% rename from biliapi/src/main/java/com/yutou/bili/bean/live/LiveRoomPlayInfo.java rename to src/main/java/com/yutou/biliapi/bean/live/LiveRoomPlayInfo.java index 41dd3c4..344f68c 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveRoomPlayInfo.java +++ b/src/main/java/com/yutou/biliapi/bean/live/LiveRoomPlayInfo.java @@ -1,23 +1,24 @@ -package com.yutou.bili.bean.live; +package com.yutou.biliapi.bean.live; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; import lombok.EqualsAndHashCode; +import java.math.BigInteger; import java.util.List; @EqualsAndHashCode(callSuper = true) @Data public class LiveRoomPlayInfo extends BaseBean { @JSONField(name = "room_id") - private int roomId; + private BigInteger roomId; @JSONField(name = "short_id") private int shortId; @JSONField(name = "uid") - private int uid; + private BigInteger uid; @JSONField(name = "is_hidden") private boolean isHidden; diff --git a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveRoomStatus.java b/src/main/java/com/yutou/biliapi/bean/live/LiveRoomStatus.java similarity index 87% rename from biliapi/src/main/java/com/yutou/bili/bean/live/LiveRoomStatus.java rename to src/main/java/com/yutou/biliapi/bean/live/LiveRoomStatus.java index 3f84e2b..41f3d75 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveRoomStatus.java +++ b/src/main/java/com/yutou/biliapi/bean/live/LiveRoomStatus.java @@ -1,8 +1,10 @@ -package com.yutou.bili.bean.live; +package com.yutou.biliapi.bean.live; import com.alibaba.fastjson2.annotation.JSONField; import lombok.Data; +import java.math.BigInteger; + @Data public class LiveRoomStatus { @JSONField(name = "roomStatus") @@ -27,7 +29,7 @@ public class LiveRoomStatus { private int online; @JSONField(name = "roomid") - private int roomid; + private BigInteger roomid; @JSONField(name = "broadcast_type") private int broadcastType; diff --git a/biliapi/src/main/java/com/yutou/bili/bean/live/MasterInfoBean.java b/src/main/java/com/yutou/biliapi/bean/live/MasterInfoBean.java similarity index 93% rename from biliapi/src/main/java/com/yutou/bili/bean/live/MasterInfoBean.java rename to src/main/java/com/yutou/biliapi/bean/live/MasterInfoBean.java index 4cfa426..70ef99b 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/live/MasterInfoBean.java +++ b/src/main/java/com/yutou/biliapi/bean/live/MasterInfoBean.java @@ -1,10 +1,11 @@ -package com.yutou.bili.bean.live; +package com.yutou.biliapi.bean.live; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; import lombok.EqualsAndHashCode; +import java.math.BigInteger; import java.util.List; @EqualsAndHashCode(callSuper = true) @@ -40,7 +41,7 @@ public class MasterInfoBean extends BaseBean { @Data public static class Info { @JSONField(name = "uid") - private int uid; + private BigInteger uid; @JSONField(name = "uname") private String uname; diff --git a/biliapi/src/main/java/com/yutou/bili/bean/live/SpiBean.java b/src/main/java/com/yutou/biliapi/bean/live/SpiBean.java similarity index 70% rename from biliapi/src/main/java/com/yutou/bili/bean/live/SpiBean.java rename to src/main/java/com/yutou/biliapi/bean/live/SpiBean.java index 5daee56..7b23309 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/live/SpiBean.java +++ b/src/main/java/com/yutou/biliapi/bean/live/SpiBean.java @@ -1,6 +1,6 @@ -package com.yutou.bili.bean.live; +package com.yutou.biliapi.bean.live; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/src/main/java/com/yutou/biliapi/bean/live/database/LiveConfigDatabaseBean.java b/src/main/java/com/yutou/biliapi/bean/live/database/LiveConfigDatabaseBean.java new file mode 100644 index 0000000..fddce05 --- /dev/null +++ b/src/main/java/com/yutou/biliapi/bean/live/database/LiveConfigDatabaseBean.java @@ -0,0 +1,77 @@ +package com.yutou.biliapi.bean.live.database; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.yutou.common.databases.AbsDatabasesBean; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigInteger; +import java.util.Calendar; +import java.util.List; + +@EqualsAndHashCode(callSuper = true) +@Data +public class LiveConfigDatabaseBean extends AbsDatabasesBean { + @JSONField(name = "live_room_id") + private BigInteger roomId; + @JSONField(name = "anchorUid") + private BigInteger anchorUid; + @JSONField(name = "anchorName") + private String anchorName; + @JSONField(name = "anchorFace") + private String anchorFace; + @JSONField(name = "recordLive") + private boolean isRecordLive; + @JSONField(name = "recordDanmu") + private boolean isRecordDanmu; + @JSONField(name = "keyword") + private List keywordList; + @JSONField(name = "recordUid") + private String recordUid; + @JSONField(name = "recordDanmuDate") + private String recordDanmuDate="* * *";// * * * 分 时 星期 | 周日是1 + @JSONField(name = "recordLiveDate") + private String recordLiveDate="* * *";// * * * 分 时 星期 | 周日是1 + + + public LiveConfigDatabaseBean() { + super("live_config",System.currentTimeMillis()); + } + public boolean checkRecordDanmuTime(){ + return checkRecordTime(recordDanmuDate); + } + public boolean checkRecordLiveTime(){ + return checkRecordTime(recordLiveDate); + } + private boolean checkRecordTime(String recordDate){ + int _length = recordDate.length(); + boolean isFullDate=(_length-recordDate.replace("*","").length())==3; + if(isFullDate){ + return true; + } + String[] split=recordDate.split(" "); + String minute=split[0]; + String hour=split[1]; + String day=split[2]; + boolean isFullMinute= "*".equals(minute); + boolean isFullHour= "*".equals(hour); + boolean isFullDay= "*".equals(day); + Calendar today=Calendar.getInstance(); + if(!isFullDay){ + if(today.get(Calendar.DAY_OF_WEEK)!=Integer.parseInt(day)){ + return false; + } + } + if(!isFullHour) { + if (today.get(Calendar.HOUR_OF_DAY) != Integer.parseInt(hour)) { + return false; + } + } + if(!isFullMinute){ + if(today.get(Calendar.MINUTE)!=Integer.parseInt(minute)) { + return false; + } + } + return true; + } +} diff --git a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveDanmuDatabaseBean.java b/src/main/java/com/yutou/biliapi/bean/live/database/LiveDanmuDatabaseBean.java similarity index 75% rename from biliapi/src/main/java/com/yutou/bili/bean/live/LiveDanmuDatabaseBean.java rename to src/main/java/com/yutou/biliapi/bean/live/database/LiveDanmuDatabaseBean.java index dcd2e5e..2aa4f0f 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveDanmuDatabaseBean.java +++ b/src/main/java/com/yutou/biliapi/bean/live/database/LiveDanmuDatabaseBean.java @@ -1,12 +1,13 @@ -package com.yutou.bili.bean.live; +package com.yutou.biliapi.bean.live.database; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.bili.bean.websocket.live.WSDanmuData; -import com.yutou.bili.bean.websocket.live.WSData; -import com.yutou.databases.AbsDatabasesBean; +import com.yutou.biliapi.bean.websocket.live.WSDanmuData; +import com.yutou.common.databases.AbsDatabasesBean; import lombok.Data; import lombok.EqualsAndHashCode; +import java.math.BigInteger; + @EqualsAndHashCode(callSuper = true) @Data public class LiveDanmuDatabaseBean extends AbsDatabasesBean { @@ -23,20 +24,18 @@ public class LiveDanmuDatabaseBean extends AbsDatabasesBean { @JSONField(name = "time") private long time; @JSONField(name = "uid") - private long uid; + private BigInteger uid; @JSONField(name = "uname") private String uname; - @JSONField(name = "json") - private String json; + public LiveDanmuDatabaseBean() { - super("danmu"); + super("danmu",System.currentTimeMillis()); } public LiveDanmuDatabaseBean(WSDanmuData danmu) { - super("danmu"); - json = danmu.getJson(); + super("danmu",danmu.getWs_timer()); this.danmu = danmu.getDanmu(); model = danmu.getModel(); fontSize = danmu.getFontSize(); diff --git a/src/main/java/com/yutou/biliapi/bean/live/database/LiveGiftDatabaseBean.java b/src/main/java/com/yutou/biliapi/bean/live/database/LiveGiftDatabaseBean.java new file mode 100644 index 0000000..cb5f6b3 --- /dev/null +++ b/src/main/java/com/yutou/biliapi/bean/live/database/LiveGiftDatabaseBean.java @@ -0,0 +1,60 @@ +package com.yutou.biliapi.bean.live.database; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.yutou.biliapi.bean.websocket.live.WSSendGift; +import com.yutou.common.databases.AbsDatabasesBean; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class LiveGiftDatabaseBean extends AbsDatabasesBean { + @JSONField(name = "id") + int id; + @JSONField(name = "gift_id") + private int giftId; + @JSONField(name = "gift_name") + private String giftName; + @JSONField(name = "price") + private long price; + @JSONField(name = "coin_type") + private String coinType; + @JSONField(name = "icon") + private String icon; + @JSONField(name = "gift_num") + private int giftNum; + @JSONField(name = "sender_uid") + private long senderUid; + @JSONField(name = "sender_name") + private String senderName; + @JSONField(name = "sender_face") + private String senderFace; + @JSONField(name = "send_time") + private long sendTime; + @JSONField(name = "action") + private String action; + + + public LiveGiftDatabaseBean() { + super("gift",System.currentTimeMillis()); + } + + public LiveGiftDatabaseBean(WSSendGift gift) { + super("gift",gift.getWs_timer()); + giftId = gift.getData().getGiftId(); + giftName = gift.getData().getGiftName(); + price = gift.getData().getPrice(); + coinType = gift.getData().getCoinType(); + icon = gift.getData().getGiftInfo().getWebp(); + if (gift.getData().getComboSend() != null) { + giftNum = gift.getData().getComboSend().getGiftNum(); + } else { + giftNum = 1; + } + senderUid = gift.getData().getSenderUinfo().getUid(); + senderName = gift.getData().getSenderUinfo().getBase().getName(); + senderFace = gift.getData().getSenderUinfo().getBase().getFace(); + sendTime = gift.getData().getTimestamp(); + action = gift.getData().getAction(); + } +} diff --git a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveInfoDatabaseBean.java b/src/main/java/com/yutou/biliapi/bean/live/database/LiveInfoDatabaseBean.java similarity index 59% rename from biliapi/src/main/java/com/yutou/bili/bean/live/LiveInfoDatabaseBean.java rename to src/main/java/com/yutou/biliapi/bean/live/database/LiveInfoDatabaseBean.java index 7a3bbac..d162af1 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveInfoDatabaseBean.java +++ b/src/main/java/com/yutou/biliapi/bean/live/database/LiveInfoDatabaseBean.java @@ -1,12 +1,14 @@ -package com.yutou.bili.bean.live; +package com.yutou.biliapi.bean.live.database; import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.databases.AbsDatabasesBean; +import com.yutou.biliapi.bean.live.LiveRoomInfo; +import com.yutou.common.databases.AbsDatabasesBean; import lombok.Data; import lombok.EqualsAndHashCode; -import org.springframework.util.StringUtils; +import java.lang.reflect.Field; +import java.math.BigInteger; import java.util.List; @EqualsAndHashCode(callSuper = true) @@ -15,36 +17,41 @@ public class LiveInfoDatabaseBean extends AbsDatabasesBean { @JSONField(name = "id") int id; @JSONField(name = "roomId") - private String roomId; + private BigInteger roomId; @JSONField(name = "anchorUid") - private String anchorUid; - @JSONField(name = "room_mid") + private BigInteger anchorUid; + @JSONField(name = "title") private String title; @JSONField(name = "record_time_start") private long recordTimeStart; @JSONField(name = "record_time_end") private long recordTimeEnd; - @JSONField(name = "record_keyword") + @JSONField(name = "cover") private String cover; @JSONField(name = "room_info") private String roomInfo; public LiveInfoDatabaseBean(LiveRoomInfo info) { - super("info"); - roomId = String.valueOf(info.getRoomId()); + super("info", System.currentTimeMillis()); + roomId = info.getRoomId(); roomInfo = JSONObject.toJSONString(info); recordTimeStart = System.currentTimeMillis(); - anchorUid = String.valueOf(info.getUid()); + anchorUid = info.getUid(); title = info.getTitle(); cover = info.getUserCover(); } public LiveInfoDatabaseBean() { - super("info"); + super("info", System.currentTimeMillis()); } public static void main(String[] args) { - new LiveInfoDatabaseBean().toJson(); + List list = new LiveInfoDatabaseBean().getFields(); + for (Field field : list) { + System.out.println(field.getName()); + } + + } } diff --git a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveInteractWordDatabaseBean.java b/src/main/java/com/yutou/biliapi/bean/live/database/LiveInteractWordDatabaseBean.java similarity index 55% rename from biliapi/src/main/java/com/yutou/bili/bean/live/LiveInteractWordDatabaseBean.java rename to src/main/java/com/yutou/biliapi/bean/live/database/LiveInteractWordDatabaseBean.java index c382458..ee1ccd2 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/live/LiveInteractWordDatabaseBean.java +++ b/src/main/java/com/yutou/biliapi/bean/live/database/LiveInteractWordDatabaseBean.java @@ -1,27 +1,37 @@ -package com.yutou.bili.bean.live; +package com.yutou.biliapi.bean.live.database; -import com.yutou.bili.bean.websocket.live.WSInteractWord; -import com.yutou.databases.AbsDatabasesBean; +import com.alibaba.fastjson2.annotation.JSONField; +import com.yutou.biliapi.bean.websocket.live.WSInteractWord; +import com.yutou.common.databases.AbsDatabasesBean; import lombok.Data; import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) @Data public class LiveInteractWordDatabaseBean extends AbsDatabasesBean { + @JSONField(name = "id") + int id; + @JSONField(name = "uid") private long uid; + @JSONField(name = "type") private int type; //1为进场,2为关注 + @JSONField(name = "room_id") private long roomId; + @JSONField(name = "timer") private long timer; + @JSONField(name = "uname") private String uname; + @JSONField(name = "uname_color") private String uname_color; + @JSONField(name = "face") private String face; public LiveInteractWordDatabaseBean() { - super("InteractWord"); + super("InteractWord",System.currentTimeMillis()); } public LiveInteractWordDatabaseBean(WSInteractWord bean) { - super("InteractWord"); + super("InteractWord", bean.getWs_timer()); uid = bean.getUid(); type = bean.getType(); roomId = bean.getRoomId(); diff --git a/src/main/java/com/yutou/biliapi/bean/live/database/LiveSourceDatabaseBean.java b/src/main/java/com/yutou/biliapi/bean/live/database/LiveSourceDatabaseBean.java new file mode 100644 index 0000000..4544868 --- /dev/null +++ b/src/main/java/com/yutou/biliapi/bean/live/database/LiveSourceDatabaseBean.java @@ -0,0 +1,28 @@ +package com.yutou.biliapi.bean.live.database; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.yutou.biliapi.bean.websocket.live.WSData; +import com.yutou.common.databases.AbsDatabasesBean; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class LiveSourceDatabaseBean extends AbsDatabasesBean { + @JSONField(name = "id") + int id; + @JSONField(name = "type") + private String type; + @JSONField(name = "json") + private String json; + + public LiveSourceDatabaseBean() { + super("source",System.currentTimeMillis()); + } + + public LiveSourceDatabaseBean(WSData bean) { + super("source",bean.getWs_timer()); + this.json = bean.getJson(); + type = bean.getCmd(); + } +} diff --git a/src/main/java/com/yutou/biliapi/bean/live/database/LiveSuperChatDatabaseBean.java b/src/main/java/com/yutou/biliapi/bean/live/database/LiveSuperChatDatabaseBean.java new file mode 100644 index 0000000..73e8853 --- /dev/null +++ b/src/main/java/com/yutou/biliapi/bean/live/database/LiveSuperChatDatabaseBean.java @@ -0,0 +1,46 @@ +package com.yutou.biliapi.bean.live.database; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.yutou.biliapi.bean.websocket.live.WSSuperChatMessage; +import com.yutou.common.databases.AbsDatabasesBean; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class LiveSuperChatDatabaseBean extends AbsDatabasesBean { + @JSONField(name = "id") + private int id; + @JSONField(name = "price") + private long price; + @JSONField(name = "uid") + private long uid; + @JSONField(name = "start_time") + private long start_time; + @JSONField(name = "end_time") + private long end_time; + @JSONField(name = "message") + private String message; + @JSONField(name = "message_trans") + private String message_trans; + @JSONField(name = "message_font_color") + private String message_font_color; + + public LiveSuperChatDatabaseBean() { + super("superChat",System.currentTimeMillis()); + } + + public LiveSuperChatDatabaseBean(WSSuperChatMessage bean) { + super("superChat",bean.getWs_timer()); + price = bean.getPrice(); + uid = bean.getUid(); + start_time = bean.getStart_time(); + end_time = bean.getEnd_time(); + message = bean.getMessage(); + message_trans = bean.getMessage_trans(); + message_font_color = bean.getMessage_font_color(); + + } + + +} diff --git a/biliapi/src/main/java/com/yutou/bili/bean/login/CheckCookieBean.java b/src/main/java/com/yutou/biliapi/bean/login/CheckCookieBean.java similarity index 79% rename from biliapi/src/main/java/com/yutou/bili/bean/login/CheckCookieBean.java rename to src/main/java/com/yutou/biliapi/bean/login/CheckCookieBean.java index 03f6dae..e9a3759 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/login/CheckCookieBean.java +++ b/src/main/java/com/yutou/biliapi/bean/login/CheckCookieBean.java @@ -1,7 +1,7 @@ -package com.yutou.bili.bean.login; +package com.yutou.biliapi.bean.login; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/biliapi/src/main/java/com/yutou/bili/bean/login/LoginCookieDatabaseBean.java b/src/main/java/com/yutou/biliapi/bean/login/LoginCookieDatabaseBean.java similarity index 83% rename from biliapi/src/main/java/com/yutou/bili/bean/login/LoginCookieDatabaseBean.java rename to src/main/java/com/yutou/biliapi/bean/login/LoginCookieDatabaseBean.java index cf522f4..40b3e8c 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/login/LoginCookieDatabaseBean.java +++ b/src/main/java/com/yutou/biliapi/bean/login/LoginCookieDatabaseBean.java @@ -1,13 +1,14 @@ -package com.yutou.bili.bean.login; +package com.yutou.biliapi.bean.login; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.databases.AbsDatabasesBean; +import com.yutou.common.databases.AbsDatabasesBean; import lombok.Data; import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) @Data public class LoginCookieDatabaseBean extends AbsDatabasesBean { + @JSONField(name = "SESSDATA") String sessdta; @JSONField(name = "Path") @@ -28,6 +29,6 @@ public class LoginCookieDatabaseBean extends AbsDatabasesBean { String gourl; public LoginCookieDatabaseBean() { - super("login_cookie"); + super("login_cookie", System.currentTimeMillis()); } } diff --git a/biliapi/src/main/java/com/yutou/bili/bean/login/LoginInfoBean.java b/src/main/java/com/yutou/biliapi/bean/login/LoginInfoBean.java similarity index 78% rename from biliapi/src/main/java/com/yutou/bili/bean/login/LoginInfoBean.java rename to src/main/java/com/yutou/biliapi/bean/login/LoginInfoBean.java index c66de42..92d3fae 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/login/LoginInfoBean.java +++ b/src/main/java/com/yutou/biliapi/bean/login/LoginInfoBean.java @@ -1,6 +1,6 @@ -package com.yutou.bili.bean.login; +package com.yutou.biliapi.bean.login; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/src/main/java/com/yutou/biliapi/bean/login/LoginUserDatabaseBean.java b/src/main/java/com/yutou/biliapi/bean/login/LoginUserDatabaseBean.java new file mode 100644 index 0000000..47b7dea --- /dev/null +++ b/src/main/java/com/yutou/biliapi/bean/login/LoginUserDatabaseBean.java @@ -0,0 +1,44 @@ +package com.yutou.biliapi.bean.login; + +import com.alibaba.fastjson2.JSONObject; +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.util.DateUtils; +import com.yutou.common.databases.AbsDatabasesBean; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.List; + +@EqualsAndHashCode(callSuper = true) +@Data +public class LoginUserDatabaseBean extends AbsDatabasesBean { + UserInfoBean userInfo; + + public LoginUserDatabaseBean(UserInfoBean userInfo) { + super("login_user",System.currentTimeMillis()); + this.userInfo=userInfo; + } + + @Override + public JSONObject toJson() { + if(userInfo==null){ + return new JSONObject(); + } + JSONObject json= JSONObject.parseObject(JSONObject.toJSONString(userInfo)); + json.put("sql_time", DateUtils.format(getSql_time(), "yyyy-MM-dd HH:mm:ss.SSS")); + return json; + } + + @Override + public List getFields() { + List fields = new ArrayList<>(List.of(UserInfoBean.class.getDeclaredFields())); + for (Field field : super.getFields()) { + if(!field.getName().contains("userInfo")){ + fields.add(field); + } + } + return fields; + } +} diff --git a/biliapi/src/main/java/com/yutou/bili/bean/login/QRCodeGenerateBean.java b/src/main/java/com/yutou/biliapi/bean/login/QRCodeGenerateBean.java similarity index 72% rename from biliapi/src/main/java/com/yutou/bili/bean/login/QRCodeGenerateBean.java rename to src/main/java/com/yutou/biliapi/bean/login/QRCodeGenerateBean.java index 02fa07f..318951a 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/login/QRCodeGenerateBean.java +++ b/src/main/java/com/yutou/biliapi/bean/login/QRCodeGenerateBean.java @@ -1,7 +1,7 @@ -package com.yutou.bili.bean.login; +package com.yutou.biliapi.bean.login; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/biliapi/src/main/java/com/yutou/bili/bean/login/UserInfoBean.java b/src/main/java/com/yutou/biliapi/bean/login/UserInfoBean.java similarity index 97% rename from biliapi/src/main/java/com/yutou/bili/bean/login/UserInfoBean.java rename to src/main/java/com/yutou/biliapi/bean/login/UserInfoBean.java index 72482a8..3e0878c 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/login/UserInfoBean.java +++ b/src/main/java/com/yutou/biliapi/bean/login/UserInfoBean.java @@ -1,12 +1,12 @@ -package com.yutou.bili.bean.login; +package com.yutou.biliapi.bean.login; import com.alibaba.fastjson2.annotation.JSONField; -import com.google.gson.annotations.SerializedName; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; import lombok.EqualsAndHashCode; +import java.math.BigInteger; import java.util.Date; @EqualsAndHashCode(callSuper = true) @@ -32,7 +32,7 @@ public class UserInfoBean extends BaseBean { private LevelInfo levelInfo; @JSONField(name = "mid") - private long mid; + private BigInteger mid; @JSONField(name = "mobile_verified") private int mobileVerified; diff --git a/biliapi/src/main/java/com/yutou/bili/bean/websocket/WebSocketBody.java b/src/main/java/com/yutou/biliapi/bean/websocket/WebSocketBody.java similarity index 96% rename from biliapi/src/main/java/com/yutou/bili/bean/websocket/WebSocketBody.java rename to src/main/java/com/yutou/biliapi/bean/websocket/WebSocketBody.java index 2956644..e19028f 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/websocket/WebSocketBody.java +++ b/src/main/java/com/yutou/biliapi/bean/websocket/WebSocketBody.java @@ -1,4 +1,4 @@ -package com.yutou.bili.bean.websocket; +package com.yutou.biliapi.bean.websocket; import com.alibaba.fastjson2.JSONObject; import lombok.Data; diff --git a/biliapi/src/main/java/com/yutou/bili/bean/websocket/WebSocketHeader.java b/src/main/java/com/yutou/biliapi/bean/websocket/WebSocketHeader.java similarity index 89% rename from biliapi/src/main/java/com/yutou/bili/bean/websocket/WebSocketHeader.java rename to src/main/java/com/yutou/biliapi/bean/websocket/WebSocketHeader.java index 12bd2da..d3fa900 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/websocket/WebSocketHeader.java +++ b/src/main/java/com/yutou/biliapi/bean/websocket/WebSocketHeader.java @@ -1,6 +1,6 @@ -package com.yutou.bili.bean.websocket; +package com.yutou.biliapi.bean.websocket; -import com.yutou.bili.utils.BytesUtils; +import com.yutou.biliapi.utils.BytesUtils; import lombok.Data; @Data diff --git a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSDanmuData.java b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSDanmuData.java similarity index 89% rename from biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSDanmuData.java rename to src/main/java/com/yutou/biliapi/bean/websocket/live/WSDanmuData.java index f418e0f..4d5cace 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSDanmuData.java +++ b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSDanmuData.java @@ -1,11 +1,13 @@ -package com.yutou.bili.bean.websocket.live; +package com.yutou.biliapi.bean.websocket.live; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; -import com.yutou.utils.Log; +import com.yutou.common.utils.Log; import lombok.Data; import lombok.EqualsAndHashCode; +import java.math.BigInteger; + /** * 弹幕信息 * 弹幕 @@ -21,7 +23,7 @@ public class WSDanmuData extends WSData { private long time; private String uCode; private String danmu; - private long uid; + private BigInteger uid; private String uname; private WSUserMedal medal; @@ -34,7 +36,7 @@ public class WSDanmuData extends WSData { setTime(infoData.getJSONArray(0).getLong(4)); setUCode(infoData.getJSONArray(0).getString(7)); setDanmu(infoData.getString(1)); - setUid(infoData.getJSONArray(2).getInteger(0)); + setUid(infoData.getJSONArray(2).getBigInteger(0)); setUname(infoData.getJSONArray(2).getString(1)); try { medal = WSUserMedal.create(infoData.getJSONArray(3)); diff --git a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSData.java b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSData.java similarity index 92% rename from biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSData.java rename to src/main/java/com/yutou/biliapi/bean/websocket/live/WSData.java index ad722ad..3601f58 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSData.java +++ b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSData.java @@ -1,7 +1,7 @@ -package com.yutou.bili.bean.websocket.live; +package com.yutou.biliapi.bean.websocket.live; import com.alibaba.fastjson2.JSONObject; -import com.yutou.inter.ISqlDatabaseBean; +import com.yutou.common.inter.ISqlDatabaseBean; import lombok.Data; import java.io.Serializable; diff --git a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSDmInteraction.java b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSDmInteraction.java similarity index 97% rename from biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSDmInteraction.java rename to src/main/java/com/yutou/biliapi/bean/websocket/live/WSDmInteraction.java index d73e5c3..548edae 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSDmInteraction.java +++ b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSDmInteraction.java @@ -1,4 +1,4 @@ -package com.yutou.bili.bean.websocket.live; +package com.yutou.biliapi.bean.websocket.live; import com.alibaba.fastjson2.JSONObject; import lombok.Data; diff --git a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSGuardBuy.java b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSGuardBuy.java similarity index 97% rename from biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSGuardBuy.java rename to src/main/java/com/yutou/biliapi/bean/websocket/live/WSGuardBuy.java index 06b10fa..cb55410 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSGuardBuy.java +++ b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSGuardBuy.java @@ -1,4 +1,4 @@ -package com.yutou.bili.bean.websocket.live; +package com.yutou.biliapi.bean.websocket.live; import com.alibaba.fastjson2.JSONObject; import lombok.Data; diff --git a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSInteractWord.java b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSInteractWord.java similarity index 98% rename from biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSInteractWord.java rename to src/main/java/com/yutou/biliapi/bean/websocket/live/WSInteractWord.java index b0ea750..95fb281 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSInteractWord.java +++ b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSInteractWord.java @@ -1,4 +1,4 @@ -package com.yutou.bili.bean.websocket.live; +package com.yutou.biliapi.bean.websocket.live; import com.alibaba.fastjson2.JSONObject; import lombok.Data; diff --git a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSMedalInfo.java b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSMedalInfo.java similarity index 92% rename from biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSMedalInfo.java rename to src/main/java/com/yutou/biliapi/bean/websocket/live/WSMedalInfo.java index d93cc5c..3d729d6 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSMedalInfo.java +++ b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSMedalInfo.java @@ -1,7 +1,7 @@ -package com.yutou.bili.bean.websocket.live; +package com.yutou.biliapi.bean.websocket.live; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSSendGift.java b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSSendGift.java similarity index 96% rename from biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSSendGift.java rename to src/main/java/com/yutou/biliapi/bean/websocket/live/WSSendGift.java index 13d2c44..ed4a062 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSSendGift.java +++ b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSSendGift.java @@ -1,4 +1,4 @@ -package com.yutou.bili.bean.websocket.live; +package com.yutou.biliapi.bean.websocket.live; import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.annotation.JSONField; @@ -76,7 +76,7 @@ public class WSSendGift extends WSData { @JSONField(name = "float_sc_resource_id") private long floatScResourceID; @JSONField(name = "giftId") - private long giftID; + private int giftId; @JSONField(name = "giftName") private String giftName; @JSONField(name = "giftType") @@ -150,7 +150,7 @@ public class WSSendGift extends WSData { } @lombok.Data - public static class FaceEffectV2 implements Serializable{ + public static class FaceEffectV2 implements Serializable { @JSONField(name = "id") private long id; @JSONField(name = "type") @@ -158,7 +158,7 @@ public class WSSendGift extends WSData { } @lombok.Data - public static class GiftInfo implements Serializable{ + public static class GiftInfo implements Serializable { @JSONField(name = "effect_id") private long effectID; @JSONField(name = "has_imaged_gift") @@ -224,6 +224,7 @@ public class WSSendGift extends WSData { @JSONField(name = "name") private String name; } + @lombok.Data public static class ComboSend implements Serializable { @JSONField(name = "action") @@ -231,13 +232,13 @@ public class WSSendGift extends WSData { @JSONField(name = "combo_id") private String comboID; @JSONField(name = "combo_num") - private long comboNum; + private int comboNum; @JSONField(name = "gift_id") private long giftID; @JSONField(name = "gift_name") private String giftName; @JSONField(name = "gift_num") - private long giftNum; + private int giftNum; @JSONField(name = "uid") private long uid; @JSONField(name = "uname") diff --git a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSSuperChatMessage.java b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSSuperChatMessage.java similarity index 97% rename from biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSSuperChatMessage.java rename to src/main/java/com/yutou/biliapi/bean/websocket/live/WSSuperChatMessage.java index 9344686..62d09e3 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSSuperChatMessage.java +++ b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSSuperChatMessage.java @@ -1,4 +1,4 @@ -package com.yutou.bili.bean.websocket.live; +package com.yutou.biliapi.bean.websocket.live; import com.alibaba.fastjson2.JSONObject; import lombok.Data; @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; /** * 超级留言 - * 醒目留言 + * 醒目留言 */ @EqualsAndHashCode(callSuper = true) @Data diff --git a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSUserMedal.java b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSUserMedal.java similarity index 93% rename from biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSUserMedal.java rename to src/main/java/com/yutou/biliapi/bean/websocket/live/WSUserMedal.java index 3114046..eb94fec 100644 --- a/biliapi/src/main/java/com/yutou/bili/bean/websocket/live/WSUserMedal.java +++ b/src/main/java/com/yutou/biliapi/bean/websocket/live/WSUserMedal.java @@ -1,4 +1,4 @@ -package com.yutou.bili.bean.websocket.live; +package com.yutou.biliapi.bean.websocket.live; import com.alibaba.fastjson2.JSONArray; import lombok.Data; diff --git a/src/main/java/com/yutou/biliapi/databases/BiliBiliLoginDatabase.java b/src/main/java/com/yutou/biliapi/databases/BiliBiliLoginDatabase.java new file mode 100644 index 0000000..01c9f23 --- /dev/null +++ b/src/main/java/com/yutou/biliapi/databases/BiliBiliLoginDatabase.java @@ -0,0 +1,79 @@ +package com.yutou.biliapi.databases; + +import com.yutou.biliapi.bean.login.LoginCookieDatabaseBean; +import com.yutou.biliapi.bean.login.LoginUserDatabaseBean; +import com.yutou.common.databases.AbsDatabasesBean; +import com.yutou.common.databases.SQLiteManager; + +import java.math.BigInteger; +import java.util.List; + +public class BiliBiliLoginDatabase extends SQLiteManager { + LoginCookieDatabaseBean cookie; + private static BiliBiliLoginDatabase instance; + + private BiliBiliLoginDatabase(Class tClass) { + try { + cookie = new LoginCookieDatabaseBean(); + } catch (Exception e) { + throw new RuntimeException(e); + } + init(); + } + + public static BiliBiliLoginDatabase getInstance() { + if (instance == null) { + instance = new BiliBiliLoginDatabase(LoginCookieDatabaseBean.class); + } + return instance; + } + + + public BiliBiliLoginDatabase initData(LoginCookieDatabaseBean cookie, LoginUserDatabaseBean user) { + this.cookie = cookie; + cookie.setTableName(getDataBean().get(0).getTableName()); + add(cookie); + add(user); + return this; + } + + public LoginCookieDatabaseBean getCookie(String userId) { + List list = super.get(cookie.getTableName(), LoginCookieDatabaseBean.class); + if (userId == null && !list.isEmpty()) { + return list.getFirst(); + } + for (LoginCookieDatabaseBean bean : list) { + if (bean.getSid().equals(userId)) { + return bean; + } + } + + return null; + } + + public LoginUserDatabaseBean getUser(String userId) { + List list = super.get(cookie.getTableName(), LoginUserDatabaseBean.class); + if (userId == null && !list.isEmpty()) { + return list.getFirst(); + } + for (LoginUserDatabaseBean bean : list) { + if (bean.getUserInfo().getMid().equals(new BigInteger(userId))) { + return bean; + } + } + return null; + } + + @Override + public String getFileName() { + return "bilibili_login.db"; + } + + @Override + protected List getDataBean() { + return List.of(new LoginCookieDatabaseBean(), new LoginUserDatabaseBean(null)); + } +} +/** + * + */ \ No newline at end of file diff --git a/src/main/java/com/yutou/biliapi/databases/BiliLiveConfigDatabase.java b/src/main/java/com/yutou/biliapi/databases/BiliLiveConfigDatabase.java new file mode 100644 index 0000000..961c62d --- /dev/null +++ b/src/main/java/com/yutou/biliapi/databases/BiliLiveConfigDatabase.java @@ -0,0 +1,69 @@ +package com.yutou.biliapi.databases; + +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; +import com.yutou.biliapi.bean.live.database.LiveConfigDatabaseBean; +import com.yutou.common.databases.AbsDatabasesBean; +import com.yutou.common.databases.SQLiteManager; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; + +public class BiliLiveConfigDatabase extends SQLiteManager { + String fileName; + + public BiliLiveConfigDatabase() { + this.fileName = "live_config.db"; + init(); + } + + @Override + public String getFileName() { + return fileName; + } + + @Override + protected List getDataBean() { + return List.of(new LiveConfigDatabaseBean()); + } + + public void setConfig(LiveConfigDatabaseBean bean) { + LiveConfigDatabaseBean config = getConfig(bean.getRoomId()); + if (config == null) { + add(bean); + return; + } + bean.setSql_time(config.getSql_time()); + update(bean); + } + + public LiveConfigDatabaseBean getConfig(BigInteger roomId) { + List list = get(getDataBean().get(0).getTableName(), LiveConfigDatabaseBean.class); + if (list.isEmpty()) { + return null; + } + for (LiveConfigDatabaseBean bean : list) { + if (bean.getRoomId() == roomId) { + return bean; + } + } + return null; + } + public boolean deleteConfig(BigInteger roomId) { + LiveConfigDatabaseBean config = getConfig(roomId); + if (config == null) { + return false; + } + return delete(config); + } + public List getAllConfig() { + List list = get(getDataBean().get(0).getTableName(), LiveConfigDatabaseBean.class); + if (list.isEmpty()) { + return new ArrayList<>(); + } + return list; + } + + +} diff --git a/src/main/java/com/yutou/biliapi/databases/BiliLiveDatabase.java b/src/main/java/com/yutou/biliapi/databases/BiliLiveDatabase.java new file mode 100644 index 0000000..ab2fa35 --- /dev/null +++ b/src/main/java/com/yutou/biliapi/databases/BiliLiveDatabase.java @@ -0,0 +1,121 @@ +package com.yutou.biliapi.databases; + +import com.alibaba.fastjson2.util.DateUtils; +import com.yutou.biliapi.bean.live.*; +import com.yutou.biliapi.bean.live.database.*; +import com.yutou.biliapi.bean.websocket.live.*; +import com.yutou.common.databases.AbsDatabasesBean; +import com.yutou.common.databases.SQLiteManager; +import com.yutou.common.okhttp.HttpDownloadUtils; + +import java.io.File; +import java.util.Date; +import java.util.List; + +import static com.alibaba.fastjson2.util.DateUtils.DateTimeFormatPattern.DATE_FORMAT_10_DASH; + +public class BiliLiveDatabase extends SQLiteManager { + LiveInfoDatabaseBean bean; + LiveRoomConfig config; + String fileName; + File rootPath; + public BiliLiveDatabase(LiveRoomConfig roomConfig) { + String time = DateUtils.format(new Date().getTime(), DATE_FORMAT_10_DASH); + rootPath = new File(roomConfig.getAnchorName() + File.separator + time + roomConfig.getRoomInfo().getTitle()); + config=roomConfig; + if(!rootPath.exists()){ + rootPath.mkdirs(); + } + fileName=rootPath.getAbsolutePath()+File.separator+"live.db"; + init(); + } + + @Override + public void init() { + super.init(); + HttpDownloadUtils.download(config.getRoomInfo().getUserCover(),rootPath.getAbsolutePath(),"poster.jpg"); + } + + @Override + public String getFileName() { + return fileName; + } + + @Override + protected List getDataBean() { + return List.of( + new LiveInfoDatabaseBean(), + new LiveDanmuDatabaseBean(), + new LiveGiftDatabaseBean(), + new LiveInteractWordDatabaseBean(), + new LiveSuperChatDatabaseBean(), + new LiveSourceDatabaseBean() + ); + } + + public void addLiveInfo(LiveRoomInfo info) { + this.bean = new LiveInfoDatabaseBean(info); + + List infos = get(bean.getTableName(), LiveInfoDatabaseBean.class); + if (infos.isEmpty()) { + createInfo(bean); + } + } + + private void addData(WSData bean) { + if (bean instanceof WSDanmuData) { + add(new LiveDanmuDatabaseBean((WSDanmuData) bean)); + } else if (bean instanceof WSInteractWord) { + add(new LiveInteractWordDatabaseBean((WSInteractWord) bean)); + } else if (bean instanceof WSSendGift) { + add(new LiveGiftDatabaseBean((WSSendGift) bean)); + } else if (bean instanceof WSSuperChatMessage) { + add(new LiveSuperChatDatabaseBean((WSSuperChatMessage) bean)); + } + } + + public void addSource(WSData bean) { + add(new LiveSourceDatabaseBean(bean)); + addData(bean); + } + + private void createInfo(LiveInfoDatabaseBean bean) { + add(bean); + } + + public List getSource(long startTime, long entTime) { + return get(startTime, entTime, LiveSourceDatabaseBean.class); + } + + public List get(long startTime, long entTime, Class clazz) { + String tableName = null; + StringBuilder sb = new StringBuilder(); + String where = null; + if (startTime != -1) { + sb.append(" `sql_time` >= ").append(startTime); + } + if (entTime != -1) { + if (!sb.isEmpty()) { + sb.append(" and "); + } + sb.append(" `sql_time` <= ").append(entTime); + } + if (!sb.isEmpty()) { + where = sb.toString(); + } + for (AbsDatabasesBean bean : getDataBean()) { + if (bean.getClass() == clazz) { + tableName = bean.getTableName(); + break; + } + } + return super.get(tableName, where, clazz); + } + + public static void main(String[] args) { + /* List list = getInstance().get(-1, 1727515148800L, LiveDanmuDatabaseBean.class); + for (LiveDanmuDatabaseBean bean : list) { + System.out.println(bean.getSql_time() + "|" + bean); + }*/ + } +} diff --git a/biliapi/src/main/java/com/yutou/bili/enums/LiveProtocol.java b/src/main/java/com/yutou/biliapi/enums/LiveProtocol.java similarity index 93% rename from biliapi/src/main/java/com/yutou/bili/enums/LiveProtocol.java rename to src/main/java/com/yutou/biliapi/enums/LiveProtocol.java index 307c742..b329300 100644 --- a/biliapi/src/main/java/com/yutou/bili/enums/LiveProtocol.java +++ b/src/main/java/com/yutou/biliapi/enums/LiveProtocol.java @@ -1,4 +1,4 @@ -package com.yutou.bili.enums; +package com.yutou.biliapi.enums; import lombok.Getter; diff --git a/biliapi/src/main/java/com/yutou/bili/enums/LiveVideoCodec.java b/src/main/java/com/yutou/biliapi/enums/LiveVideoCodec.java similarity index 93% rename from biliapi/src/main/java/com/yutou/bili/enums/LiveVideoCodec.java rename to src/main/java/com/yutou/biliapi/enums/LiveVideoCodec.java index de36623..f6b2ee3 100644 --- a/biliapi/src/main/java/com/yutou/bili/enums/LiveVideoCodec.java +++ b/src/main/java/com/yutou/biliapi/enums/LiveVideoCodec.java @@ -1,4 +1,4 @@ -package com.yutou.bili.enums; +package com.yutou.biliapi.enums; import lombok.Getter; diff --git a/biliapi/src/main/java/com/yutou/bili/enums/LiveVideoDefinition.java b/src/main/java/com/yutou/biliapi/enums/LiveVideoDefinition.java similarity index 94% rename from biliapi/src/main/java/com/yutou/bili/enums/LiveVideoDefinition.java rename to src/main/java/com/yutou/biliapi/enums/LiveVideoDefinition.java index aca15de..21598c1 100644 --- a/biliapi/src/main/java/com/yutou/bili/enums/LiveVideoDefinition.java +++ b/src/main/java/com/yutou/biliapi/enums/LiveVideoDefinition.java @@ -1,4 +1,4 @@ -package com.yutou.bili.enums; +package com.yutou.biliapi.enums; import lombok.Getter; diff --git a/biliapi/src/main/java/com/yutou/bili/enums/LiveVideoFormat.java b/src/main/java/com/yutou/biliapi/enums/LiveVideoFormat.java similarity index 93% rename from biliapi/src/main/java/com/yutou/bili/enums/LiveVideoFormat.java rename to src/main/java/com/yutou/biliapi/enums/LiveVideoFormat.java index fd47ff8..226d92f 100644 --- a/biliapi/src/main/java/com/yutou/bili/enums/LiveVideoFormat.java +++ b/src/main/java/com/yutou/biliapi/enums/LiveVideoFormat.java @@ -1,4 +1,4 @@ -package com.yutou.bili.enums; +package com.yutou.biliapi.enums; import lombok.Getter; diff --git a/biliapi/src/main/java/com/yutou/bili/net/BiliCookieManager.java b/src/main/java/com/yutou/biliapi/net/BiliCookieManager.java similarity index 92% rename from biliapi/src/main/java/com/yutou/bili/net/BiliCookieManager.java rename to src/main/java/com/yutou/biliapi/net/BiliCookieManager.java index c07658e..d0a98ab 100644 --- a/biliapi/src/main/java/com/yutou/bili/net/BiliCookieManager.java +++ b/src/main/java/com/yutou/biliapi/net/BiliCookieManager.java @@ -1,10 +1,9 @@ -package com.yutou.bili.net; +package com.yutou.biliapi.net; -import com.yutou.bili.bean.login.CheckCookieBean; -import com.yutou.bili.bean.login.LoginInfoBean; -import com.yutou.inter.IHttpApiCheckCallback; -import com.yutou.okhttp.HttpCallback; -import com.yutou.utils.RSAUtils; +import com.yutou.biliapi.bean.login.CheckCookieBean; +import com.yutou.common.inter.IHttpApiCheckCallback; +import com.yutou.common.okhttp.HttpCallback; +import com.yutou.common.utils.RSAUtils; import okhttp3.Headers; import javax.crypto.Cipher; @@ -30,7 +29,7 @@ public class BiliCookieManager { "-----END PUBLIC KEY-----"; public void checkCookie(IHttpApiCheckCallback callback){ - BiliLoginNetApiManager.getInstance().getLoginApi(true) + BiliLoginNetApiManager.getInstance().getLoginApi(null) .checkCookie().enqueue(new HttpCallback() { @Override public void onResponse(Headers headers, int code, String status, CheckCookieBean response, String rawResponse) { diff --git a/src/main/java/com/yutou/biliapi/net/BiliLiveNetApiManager.java b/src/main/java/com/yutou/biliapi/net/BiliLiveNetApiManager.java new file mode 100644 index 0000000..71a0b56 --- /dev/null +++ b/src/main/java/com/yutou/biliapi/net/BiliLiveNetApiManager.java @@ -0,0 +1,71 @@ +package com.yutou.biliapi.net; + +import com.alibaba.fastjson2.JSONObject; +import com.yutou.biliapi.api.LiveApi; +import com.yutou.biliapi.bean.live.LiveAnchorInfo; +import com.yutou.biliapi.bean.login.LoginCookieDatabaseBean; +import com.yutou.biliapi.databases.BiliBiliLoginDatabase; +import com.yutou.common.okhttp.api.BaseApi; +import org.springframework.util.StringUtils; + +import java.io.IOException; +import java.math.BigInteger; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class BiliLiveNetApiManager extends BaseApi { + private static BiliLiveNetApiManager instance; + + public static BiliLiveNetApiManager getInstance() { + if (instance == null) { + instance = new BiliLiveNetApiManager("https://api.live.bilibili.com"); + } + return instance; + } + + private BiliLiveNetApiManager(String URL) { + super(URL); + } + + public LiveApi getApi(String loginUid) { + if(StringUtils.hasText(loginUid)) { + LoginCookieDatabaseBean cookie = BiliBiliLoginDatabase.getInstance().getCookie(loginUid); + if (cookie != null) { + useCookie(JSONObject.parseObject(JSONObject.toJSONString(cookie))); + } + } + HashMap header = new HashMap<>(); + header.put("Accept-Language", "zh-CN,zh;q=0.8"); + header.put("Referer", "https://live.bilibili.com"); + header.put("Connection", "keep-alive"); + header.put("Upgrade-Insecure-Requests", "1"); + addHeader(header); + return createApi(LiveApi.class); + } + + public Map getAnchorInfos(String loginUid,List anchorIds) { + JSONObject json = new JSONObject(); + json.put("uids", anchorIds); + try { + String src = getApi(loginUid).getLiveRoomStatus(json).execute().body().getSrc(); + json = JSONObject.parseObject(src); + if (json.getInteger("code") == 0) { + Map map = new HashMap<>(); + JSONObject data = json.getJSONObject("data"); + for (String key : data.keySet()) { + LiveAnchorInfo info = JSONObject.parseObject(data.getString(key), LiveAnchorInfo.class); + map.put(new BigInteger(key), info); + } + return map; + } + return new HashMap<>(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public static void main(String[] args) { + + } +} diff --git a/biliapi/src/main/java/com/yutou/bili/net/BiliLoginNetApiManager.java b/src/main/java/com/yutou/biliapi/net/BiliLoginNetApiManager.java similarity index 86% rename from biliapi/src/main/java/com/yutou/bili/net/BiliLoginNetApiManager.java rename to src/main/java/com/yutou/biliapi/net/BiliLoginNetApiManager.java index 750a468..749b748 100644 --- a/biliapi/src/main/java/com/yutou/bili/net/BiliLoginNetApiManager.java +++ b/src/main/java/com/yutou/biliapi/net/BiliLoginNetApiManager.java @@ -1,14 +1,14 @@ -package com.yutou.bili.net; +package com.yutou.biliapi.net; import com.alibaba.fastjson2.JSONObject; -import com.yutou.bili.api.LoginApi; -import com.yutou.bili.bean.login.LoginCookieDatabaseBean; -import com.yutou.bili.bean.login.LoginInfoBean; -import com.yutou.bili.bean.login.QRCodeGenerateBean; -import com.yutou.bili.databases.BiliBiliLoginDatabase; -import com.yutou.okhttp.HttpBody; -import com.yutou.okhttp.HttpCallback; -import com.yutou.okhttp.api.BaseApi; +import com.yutou.biliapi.api.LoginApi; +import com.yutou.biliapi.bean.login.LoginCookieDatabaseBean; +import com.yutou.biliapi.bean.login.LoginInfoBean; +import com.yutou.biliapi.bean.login.QRCodeGenerateBean; +import com.yutou.biliapi.databases.BiliBiliLoginDatabase; +import com.yutou.common.okhttp.HttpBody; +import com.yutou.common.okhttp.HttpCallback; +import com.yutou.common.okhttp.api.BaseApi; import okhttp3.Headers; import org.springframework.util.StringUtils; import retrofit2.Response; @@ -38,12 +38,12 @@ public class BiliLoginNetApiManager extends BaseApi { } public LoginApi getLoginApi() { - return getLoginApi(false); + return getLoginApi(null); } - public LoginApi getLoginApi(boolean isCookie) { - if (isCookie) { - LoginCookieDatabaseBean cookie = BiliBiliLoginDatabase.getInstance().get(); + public LoginApi getLoginApi(String loginUid) { + if (StringUtils.hasText(loginUid)) { + LoginCookieDatabaseBean cookie = BiliBiliLoginDatabase.getInstance().getCookie(loginUid); if (cookie != null) { useCookie(JSONObject.parseObject(JSONObject.toJSONString(cookie))); } @@ -52,11 +52,6 @@ public class BiliLoginNetApiManager extends BaseApi { } public void login(HttpCallback callback) { - LoginCookieDatabaseBean cookie = BiliBiliLoginDatabase.getInstance().get(); - if (cookie != null) { - callback.onResponse(null, LOGIN_SUCCESS, null, cookie, null); - return; - } loginApi.getQRCodeGenerate().enqueue(new HttpCallback() { @Override public void onResponse(Headers headers, int code, String status, QRCodeGenerateBean response, String rawResponse) { diff --git a/biliapi/src/main/java/com/yutou/bili/net/BiliUserNetApiManager.java b/src/main/java/com/yutou/biliapi/net/BiliUserNetApiManager.java similarity index 63% rename from biliapi/src/main/java/com/yutou/bili/net/BiliUserNetApiManager.java rename to src/main/java/com/yutou/biliapi/net/BiliUserNetApiManager.java index fcb6b3a..e33404f 100644 --- a/biliapi/src/main/java/com/yutou/bili/net/BiliUserNetApiManager.java +++ b/src/main/java/com/yutou/biliapi/net/BiliUserNetApiManager.java @@ -1,11 +1,11 @@ -package com.yutou.bili.net; +package com.yutou.biliapi.net; import com.alibaba.fastjson2.JSONObject; -import com.yutou.bili.api.UserApi; -import com.yutou.bili.bean.login.LoginCookieDatabaseBean; -import com.yutou.bili.databases.BiliBiliLoginDatabase; -import com.yutou.inter.IHttpApiCheckCallback; -import com.yutou.okhttp.api.BaseApi; +import com.yutou.biliapi.api.UserApi; +import com.yutou.biliapi.bean.login.LoginCookieDatabaseBean; +import com.yutou.biliapi.databases.BiliBiliLoginDatabase; +import com.yutou.common.inter.IHttpApiCheckCallback; +import com.yutou.common.okhttp.api.BaseApi; import java.util.HashMap; @@ -25,8 +25,7 @@ public class BiliUserNetApiManager extends BaseApi { return manager; } - public void getUserApi(IHttpApiCheckCallback callback) { - LoginCookieDatabaseBean cookie = BiliBiliLoginDatabase.getInstance().get(); + public UserApi getUserApi(LoginCookieDatabaseBean cookie) { if (cookie != null) { HashMap headers = new HashMap<>(); JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(cookie)); @@ -36,10 +35,8 @@ public class BiliUserNetApiManager extends BaseApi { } headers.put("Cookie", ck.toString()); setHeaders(headers); - callback.onSuccess(createApi(UserApi.class)); - } else { - callback.onError(LOGIN_LOGOUT, "未登录"); } + return createApi(UserApi.class); } } diff --git a/biliapi/src/main/java/com/yutou/bili/net/WebSocketManager.java b/src/main/java/com/yutou/biliapi/net/WebSocketManager.java similarity index 57% rename from biliapi/src/main/java/com/yutou/bili/net/WebSocketManager.java rename to src/main/java/com/yutou/biliapi/net/WebSocketManager.java index a857aad..6e3bd03 100644 --- a/biliapi/src/main/java/com/yutou/bili/net/WebSocketManager.java +++ b/src/main/java/com/yutou/biliapi/net/WebSocketManager.java @@ -1,36 +1,41 @@ -package com.yutou.bili.net; +package com.yutou.biliapi.net; import com.aayushatharva.brotli4j.Brotli4jLoader; import com.aayushatharva.brotli4j.decoder.Decoder; import com.aayushatharva.brotli4j.decoder.DecoderJNI; import com.aayushatharva.brotli4j.decoder.DirectDecompress; import com.alibaba.fastjson2.JSONObject; -import com.yutou.bili.api.LiveApi; -import com.yutou.bili.bean.live.LiveDanmuInfo; -import com.yutou.bili.bean.live.LiveRoomConfig; -import com.yutou.bili.bean.websocket.WebSocketBody; -import com.yutou.bili.bean.websocket.WebSocketHeader; -import com.yutou.bili.bean.websocket.live.WSDanmuData; -import com.yutou.bili.bean.websocket.live.WSData; -import com.yutou.bili.databases.BiliLiveDatabase; -import com.yutou.bili.utils.BiliUserUtils; -import com.yutou.bili.utils.BytesUtils; -import com.yutou.inter.IHttpApiCheckCallback; -import com.yutou.okhttp.HttpCallback; -import com.yutou.utils.Log; +import com.alibaba.fastjson2.util.DateUtils; +import com.yutou.biliapi.api.LiveApi; +import com.yutou.biliapi.bean.live.LiveDanmuInfo; +import com.yutou.biliapi.bean.live.LiveRoomConfig; +import com.yutou.biliapi.bean.live.LiveRoomInfo; +import com.yutou.biliapi.bean.websocket.WebSocketBody; +import com.yutou.biliapi.bean.websocket.WebSocketHeader; +import com.yutou.biliapi.bean.websocket.live.WSData; +import com.yutou.biliapi.databases.BiliBiliLoginDatabase; +import com.yutou.biliapi.databases.BiliLiveDatabase; +import com.yutou.biliapi.utils.BiliUserUtils; +import com.yutou.biliapi.utils.BytesUtils; +import com.yutou.common.okhttp.HttpBody; +import com.yutou.common.okhttp.HttpCallback; +import com.yutou.common.utils.Log; import okhttp3.Headers; import org.java_websocket.client.WebSocketClient; import org.java_websocket.handshake.ServerHandshake; +import retrofit2.Response; import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.math.BigInteger; import java.net.URI; import java.net.URISyntaxException; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; -import java.util.Timer; -import java.util.TimerTask; +import java.util.*; + +import static com.alibaba.fastjson2.util.DateUtils.DateTimeFormatPattern.DATE_FORMAT_10_DASH; public class WebSocketManager { private static WebSocketManager instance; @@ -47,51 +52,66 @@ public class WebSocketManager { return instance; } - public void addRoom(LiveRoomConfig roomConfig) { - BiliLiveNetApiManager.getInstance().getApi(new IHttpApiCheckCallback() { - @Override - public void onSuccess(LiveApi api) { - api.getLiveRoomDanmuInfo(roomConfig.getRoomId()).enqueue(new HttpCallback() { - @Override - public void onResponse(Headers headers, int code, String status, LiveDanmuInfo response, String rawResponse) { - if (!response.getHostList().isEmpty()) { - LiveDanmuInfo.Host host = response.getHostList().get(0); - String url = "wss://" + host.getHost() + ":" + host.getWssPort() + "/sub"; - // url="ws://127.0.0.1:8765"; - try { - roomConfig.setLiveInfo(response); - new WebSocketClientTh(new URI(url), roomConfig); - } catch (URISyntaxException e) { - throw new RuntimeException(e); - } - } - } + public boolean checkRoom(LiveRoomConfig roomConfig) { + return roomMap.containsKey(roomConfig); + } - @Override - public void onFailure(Throwable throwable) { - throwable.printStackTrace(); + public void addRoom(LiveRoomConfig roomConfig) { + if (checkRoom(roomConfig)) { + return; + } + LiveApi api = BiliLiveNetApiManager.getInstance().getApi(roomConfig.getLoginUid()); + Response> execute = null; + try { + execute = api.getRoomInfo(roomConfig.getRoomId().toString()).execute(); + if (execute.isSuccessful()) { + roomConfig.setRoomInfo(execute.body() != null ? execute.body().getData() : null); + } + + } catch (IOException e) { + throw new RuntimeException(e); + } + api.getLiveRoomDanmuInfo(String.valueOf(roomConfig.getLoginUid())).enqueue(new HttpCallback() { + @Override + public void onResponse(Headers headers, int code, String status, LiveDanmuInfo response, String rawResponse) { + if (!response.getHostList().isEmpty()) { + LiveDanmuInfo.Host host = response.getHostList().get(0); + String url = "wss://" + host.getHost() + ":" + host.getWssPort() + "/sub"; + // url="ws://127.0.0.1:8765"; + try { + roomConfig.setLiveInfo(response); + new WebSocketClientTh(new URI(url), roomConfig); + } catch (URISyntaxException e) { + throw new RuntimeException(e); } - }); + } } @Override - public void onError(int code, String error) { - + public void onFailure(Throwable throwable) { + throwable.printStackTrace(); } }); } + public void stopRoom(LiveRoomConfig roomConfig) { + if (checkRoom(roomConfig)) { + roomMap.get(roomConfig).close(); + roomMap.remove(roomConfig); + } + } + private static class WebSocketClientTh extends WebSocketClient { private LiveRoomConfig roomConfig; private HeartbeatTask heartbeatTask; - + BiliLiveDatabase liveDatabase; public WebSocketClientTh(URI serverUri, LiveRoomConfig roomId) { super(serverUri); this.roomConfig = roomId; heartbeatTask = new HeartbeatTask(); Brotli4jLoader.ensureAvailability(); - BiliLiveDatabase.getInstance().addLiveInfo(roomConfig.getRoomInfo()); + liveDatabase = new BiliLiveDatabase(roomConfig); connect(); } @@ -166,7 +186,7 @@ public class WebSocketManager { Log.i("3协议:" + useHeader + " 命令数:" + body.getBodyList().size()); for (JSONObject json : body.getBodyList()) { WSData parse = WSData.parse(json); - BiliLiveDatabase.getInstance().addSource(parse); + liveDatabase.addSource(parse); Log.i("解压:" + parse); } System.out.println(); @@ -204,43 +224,36 @@ public class WebSocketManager { public void sendInitAuthData() { JSONObject json = new JSONObject(); if (roomConfig.isLogin()) { - json.put("uid", Long.parseLong(roomConfig.getUid())); + json.put("uid", new BigInteger(roomConfig.getLoginUid())); } else { json.put("uid", 0); } - BiliUserUtils.getBuvid(new IHttpApiCheckCallback() { - @Override - public void onSuccess(String api) { - try { - json.put("roomid", Long.parseLong(roomConfig.getRoomId())); - json.put("protover", 3); - json.put("buvid", api); - json.put("platform", "web"); - json.put("type", 2); - json.put("key", roomConfig.getLiveInfo().getToken()); - byte[] bytes = {0, 16, 0, 1, 0, 0, 0, 7, 0, 0, 0, 1}; - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - System.out.println("bytes.length = " + bytes.length); - Log.i(json); - outputStream.write(BytesUtils.toLH(json.toString().length() + 16)); - outputStream.write(bytes); - outputStream.write(json.toJSONString().getBytes(StandardCharsets.UTF_8)); - outputStream.flush(); - BytesUtils.printHex(outputStream.toByteArray()); - System.out.println(socket.isOpen()); - socket.send(outputStream.toByteArray()); + String buvid = BiliUserUtils.getBuvid(BiliBiliLoginDatabase.getInstance().getCookie(roomConfig.getLoginUid())); + if (buvid != null) { + try { + json.put("roomid", roomConfig.getRoomId()); + json.put("protover", 3); + json.put("buvid", buvid); + json.put("platform", "web"); + json.put("type", 2); + json.put("key", roomConfig.getLiveInfo().getToken()); + byte[] bytes = {0, 16, 0, 1, 0, 0, 0, 7, 0, 0, 0, 1}; + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + System.out.println("bytes.length = " + bytes.length); + Log.i(json); + outputStream.write(BytesUtils.toLH(json.toString().length() + 16)); + outputStream.write(bytes); + outputStream.write(json.toJSONString().getBytes(StandardCharsets.UTF_8)); + outputStream.flush(); +// BytesUtils.printHex(outputStream.toByteArray()); + System.out.println(socket.isOpen()); + socket.send(outputStream.toByteArray()); - } catch (Exception e) { - e.printStackTrace(); - } + } catch (Exception e) { + e.printStackTrace(); } - - @Override - public void onError(int code, String error) { - - } - }); + } } diff --git a/src/main/java/com/yutou/biliapi/utils/BiliUserUtils.java b/src/main/java/com/yutou/biliapi/utils/BiliUserUtils.java new file mode 100644 index 0000000..32ebca9 --- /dev/null +++ b/src/main/java/com/yutou/biliapi/utils/BiliUserUtils.java @@ -0,0 +1,32 @@ +package com.yutou.biliapi.utils; + +import com.yutou.biliapi.api.UserApi; +import com.yutou.biliapi.bean.live.SpiBean; +import com.yutou.biliapi.bean.login.LoginCookieDatabaseBean; +import com.yutou.biliapi.net.BiliUserNetApiManager; +import com.yutou.common.inter.IHttpApiCheckCallback; +import com.yutou.common.okhttp.HttpBody; +import com.yutou.common.okhttp.HttpCallback; +import com.yutou.common.utils.RedisTools; +import okhttp3.Headers; +import retrofit2.Response; + +import java.io.IOException; + +public class BiliUserUtils { + public static String getBuvid(LoginCookieDatabaseBean cookie) { + Response> execute = null; + try { + execute = BiliUserNetApiManager.getInstance().getUserApi(cookie).getFingerSpi().execute(); + } catch (IOException e) { + throw new RuntimeException(e); + } + if (execute.isSuccessful()) { + if (execute.body() != null) { + return execute.body().getData().getB_3(); + } + + } + return null; + } +} diff --git a/biliapi/src/main/java/com/yutou/bili/utils/BytesUtils.java b/src/main/java/com/yutou/biliapi/utils/BytesUtils.java similarity index 94% rename from biliapi/src/main/java/com/yutou/bili/utils/BytesUtils.java rename to src/main/java/com/yutou/biliapi/utils/BytesUtils.java index 6b27cd2..c5ea5d0 100644 --- a/biliapi/src/main/java/com/yutou/bili/utils/BytesUtils.java +++ b/src/main/java/com/yutou/biliapi/utils/BytesUtils.java @@ -1,6 +1,6 @@ -package com.yutou.bili.utils; +package com.yutou.biliapi.utils; -import com.yutou.utils.Log; +import com.yutou.common.utils.Log; import jakarta.xml.bind.DatatypeConverter; public class BytesUtils { diff --git a/biliapi/src/main/java/com/yutou/bili/utils/LiveHeartBeat.java b/src/main/java/com/yutou/biliapi/utils/LiveHeartBeat.java similarity index 93% rename from biliapi/src/main/java/com/yutou/bili/utils/LiveHeartBeat.java rename to src/main/java/com/yutou/biliapi/utils/LiveHeartBeat.java index 6a77a18..ec58403 100644 --- a/biliapi/src/main/java/com/yutou/bili/utils/LiveHeartBeat.java +++ b/src/main/java/com/yutou/biliapi/utils/LiveHeartBeat.java @@ -1,12 +1,10 @@ -package com.yutou.bili.utils; +package com.yutou.biliapi.utils; import org.java_websocket.client.WebSocketClient; import org.java_websocket.handshake.ServerHandshake; import java.net.URI; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; public class LiveHeartBeat { diff --git a/src/main/java/com/yutou/bilibili/BiliBili/Datas/AppData.java b/src/main/java/com/yutou/bilibili/BiliBili/Datas/AppData.java deleted file mode 100644 index 0cf0b85..0000000 --- a/src/main/java/com/yutou/bilibili/BiliBili/Datas/AppData.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.yutou.bilibili.BiliBili.Datas; - -public class AppData { - public static String FFMPEG=""; - public static String BILIBILI_HEADERS = "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36 Referer:https://live.bilibili.com"; - public static boolean LIVE_SAVE_FFMPEG=false; -} diff --git a/src/main/java/com/yutou/bilibili/BiliBili/Datas/BiliBiliUpData.java b/src/main/java/com/yutou/bilibili/BiliBili/Datas/BiliBiliUpData.java deleted file mode 100644 index f6689f5..0000000 --- a/src/main/java/com/yutou/bilibili/BiliBili/Datas/BiliBiliUpData.java +++ /dev/null @@ -1,28 +0,0 @@ -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; - } - - -} diff --git a/src/main/java/com/yutou/bilibili/BiliBili/Datas/GiftData.java b/src/main/java/com/yutou/bilibili/BiliBili/Datas/GiftData.java deleted file mode 100644 index 7ebc630..0000000 --- a/src/main/java/com/yutou/bilibili/BiliBili/Datas/GiftData.java +++ /dev/null @@ -1,13 +0,0 @@ -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; -} diff --git a/src/main/java/com/yutou/bilibili/BiliBili/Datas/LiveData.java b/src/main/java/com/yutou/bilibili/BiliBili/Datas/LiveData.java deleted file mode 100644 index 932ca01..0000000 --- a/src/main/java/com/yutou/bilibili/BiliBili/Datas/LiveData.java +++ /dev/null @@ -1,29 +0,0 @@ -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; -} diff --git a/src/main/java/com/yutou/bilibili/BiliBili/Datas/LiveInfo.java b/src/main/java/com/yutou/bilibili/BiliBili/Datas/LiveInfo.java deleted file mode 100644 index 56c5576..0000000 --- a/src/main/java/com/yutou/bilibili/BiliBili/Datas/LiveInfo.java +++ /dev/null @@ -1,15 +0,0 @@ -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; -} diff --git a/src/main/java/com/yutou/bilibili/BilibiliApplication.java b/src/main/java/com/yutou/bilibili/BilibiliApplication.java deleted file mode 100644 index 98662cf..0000000 --- a/src/main/java/com/yutou/bilibili/BilibiliApplication.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.yutou.bilibili; - -import com.yutou.bilibili.QQBot.QQBotManager; -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({ServiceTools.class, ExcelUtils.class, QQBotManager.class}) -@SpringBootApplication -public class BilibiliApplication { - - public static String version="0.8.4"; - - public static void main(String[] args) { - SpringApplication.run(BilibiliApplication.class, args); - } - -} diff --git a/src/main/java/com/yutou/bilibili/Controllers/LiveConfigController.java b/src/main/java/com/yutou/bilibili/Controllers/LiveConfigController.java new file mode 100644 index 0000000..e148d37 --- /dev/null +++ b/src/main/java/com/yutou/bilibili/Controllers/LiveConfigController.java @@ -0,0 +1,80 @@ +package com.yutou.bilibili.Controllers; + +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.yutou.biliapi.bean.live.database.LiveConfigDatabaseBean; +import com.yutou.bilibili.datas.ResultData; +import com.yutou.bilibili.datas.ReturnCode; +import com.yutou.bilibili.services.LiveConfigService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Controller; +import org.springframework.util.StringUtils; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.math.BigInteger; +import java.util.List; + +@Controller +@RequestMapping("/live/config/") +public class LiveConfigController { + @Resource + LiveConfigService configService; + + @RequestMapping(value = "set", method = RequestMethod.POST) + @ResponseBody + public ResultData setConfig(String url, LiveConfigDatabaseBean bean) { + LiveConfigDatabaseBean config = configService.addConfig(url, bean); + if (config != null) { + return ResultData.success(config.toJson()); + } + return ResultData.fail(ReturnCode.RC999); + } + + @RequestMapping(value = "update", method = RequestMethod.POST) + @ResponseBody + public ResultData updateConfig(String roomId, LiveConfigDatabaseBean bean) { + LiveConfigDatabaseBean config = configService.updateConfig(new BigInteger(roomId), bean); + if (config != null) { + return ResultData.success(config.toJson()); + } + return ResultData.fail(ReturnCode.RC999); + } + + @RequestMapping(value = "get", method = RequestMethod.GET) + @ResponseBody + public ResultData getConfig(String roomId) { + if ("0".equals(roomId) || !StringUtils.hasText(roomId)) { + return ResultData.fail(ReturnCode.RC999); + } + LiveConfigDatabaseBean config = configService.getConfig(new BigInteger(roomId)); + if (config != null) { + return ResultData.success(config.toJson()); + } + return ResultData.fail(ReturnCode.RC999); + } + + @RequestMapping(value = "all", method = RequestMethod.GET) + @ResponseBody + public ResultData getAllConfig() { + List config = configService.getAllConfig(); + if (config != null) { + return ResultData.success(JSONArray.parseArray(JSONArray.toJSONString(config))); + } + return ResultData.fail(ReturnCode.RC999); + } + + @RequestMapping(value = "delete", method = RequestMethod.GET) + @ResponseBody + public ResultData deleteConfig(BigInteger roomId) { + if (roomId.equals(BigInteger.ZERO)) { + return ResultData.fail(ReturnCode.RC999); + } + boolean flag = configService.deleteConfig(roomId); + if (flag) { + return ResultData.success(ReturnCode.RC100); + } + return ResultData.fail(ReturnCode.RC999); + } +} diff --git a/src/main/java/com/yutou/bilibili/Controllers/SystemConfigController.java b/src/main/java/com/yutou/bilibili/Controllers/SystemConfigController.java deleted file mode 100644 index e68988b..0000000 --- a/src/main/java/com/yutou/bilibili/Controllers/SystemConfigController.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.yutou.bilibili.Controllers; - -import com.alibaba.fastjson2.JSONObject; -import com.yutou.bilibili.BiliBili.Datas.AppData; -import com.yutou.bilibili.QQBot.QQBotManager; -import com.yutou.bilibili.Services.ISystemConfigService; -import com.yutou.bilibili.Tools.Config; -import jakarta.annotation.Resource; -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.UnsupportedEncodingException; -import java.net.URLDecoder; - -@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; - } - - @ResponseBody - @RequestMapping("/system/set/ffmpeg.do") - public JSONObject setFFmpeg(String ffmpeg) throws UnsupportedEncodingException { - ffmpeg = URLDecoder.decode(ffmpeg, "UTF-8"); - configService.setConfig(Config.SYSTEM_VIDEO_FFMPEG, ffmpeg); - AppData.FFMPEG = ffmpeg; - JSONObject json = new JSONObject(); - json.put("code", 0); - json.put("msg", "ok"); - return json; - } - - @ResponseBody - @RequestMapping("/system/get/ffmpeg.do") - public JSONObject getFFmpeg() { - JSONObject json = new JSONObject(); - JSONObject data = new JSONObject(); - String reg = configService.getConfig(Config.SYSTEM_VIDEO_FFMPEG); - data.put(Config.SYSTEM_VIDEO_FFMPEG, reg); - json.put("code", 0); - json.put("data", data); - return json; - } - - @ResponseBody - @RequestMapping("/system/set/savelive.do") - public JSONObject setSaveLive(String model) throws UnsupportedEncodingException { - JSONObject json = new JSONObject(); - if (StringUtils.isEmpty(configService.getConfig(Config.SYSTEM_VIDEO_FFMPEG))) { - json.put("code", 404); - json.put("msg", "请先设置FFmpeg路径"); - return json; - } - model = URLDecoder.decode(model, "UTF-8"); - configService.setConfig(Config.SYSTEM_VIDEO_SAVE_MODEL, model); - AppData.LIVE_SAVE_FFMPEG = model.equals("ffmpeg"); - json.put("code", 0); - json.put("msg", "ok"); - return json; - } - - @ResponseBody - @RequestMapping("/system/get/savelive.do") - public JSONObject getSaveLiveModel() { - JSONObject json = new JSONObject(); - JSONObject data = new JSONObject(); - String reg = configService.getConfig(Config.SYSTEM_VIDEO_SAVE_MODEL); - System.out.println(reg); - data.put(Config.SYSTEM_VIDEO_SAVE_MODEL, (!StringUtils.isEmpty(reg) && reg.equals("ffmpeg"))); - json.put("code", 0); - json.put("data", data); - return json; - } - - @ResponseBody - @RequestMapping("/system/qq/login.do") - public JSONObject loginQQ() { - JSONObject json = new JSONObject(); - json.put("code", 0); - json.put("msg", "ok"); - return json; - } -} diff --git a/src/main/java/com/yutou/bilibili/Controllers/TestControllers.java b/src/main/java/com/yutou/bilibili/Controllers/TestControllers.java new file mode 100644 index 0000000..443a95c --- /dev/null +++ b/src/main/java/com/yutou/bilibili/Controllers/TestControllers.java @@ -0,0 +1,14 @@ +package com.yutou.bilibili.Controllers; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class TestControllers { + @RequestMapping("/root/test") + @ResponseBody + public String test(){ + return "hello world"; + } +} diff --git a/src/main/java/com/yutou/bilibili/Controllers/UserController.java b/src/main/java/com/yutou/bilibili/Controllers/UserController.java deleted file mode 100644 index 3439850..0000000 --- a/src/main/java/com/yutou/bilibili/Controllers/UserController.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.yutou.bilibili.Controllers; - -import com.alibaba.fastjson2.JSON; -import com.alibaba.fastjson2.JSONArray; -import com.alibaba.fastjson2.JSONObject; -import com.yutou.bilibili.Services.ISystemConfigService; -import com.yutou.bilibili.Services.IUserService; -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 com.yutou.utils.AppTools; -import com.yutou.utils.RedisTools; -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -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.util.Date; -import java.util.UUID; - -@Controller -public class UserController { - @Resource - IUserService service; - - @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()); - RedisTools.set(user.getLogintoken(), user.getId() + "", 30 * 24 * 60); - 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()); - RedisTools.set(user.getLogintoken(), user.getId() + "", 30 * 24 * 60); - 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) { - RedisTools.remove(user.getLogintoken()); - 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.getUserToUid(Integer.parseInt(RedisTools.get(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"); - json.put("data", service.getUserUp(Integer.parseInt(RedisTools.get(token)))); - } - return json; - } - - @ResponseBody - @RequestMapping("/user/up/set/add.do") - public JSONObject addUp(HttpServletRequest request, BilibiliUpInfo info) { - JSONObject json = new JSONObject(); - 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.getUserToUid(Integer.parseInt(RedisTools.get(token))); - if (user == null) { - json.put("code", -2); - json.put("msg", "未登录"); - return json; - } - JSONArray powers = JSONArray.parseArray(user.getPower()); - JSONObject ujson = JSONObject.parseObject(JSONObject.toJSONString(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; - } - -} diff --git a/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java b/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java deleted file mode 100644 index 1594205..0000000 --- a/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.yutou.bilibili.QQBot; - -import com.alibaba.fastjson2.JSONObject; -import com.yutou.napcat.QQDatabase; -import com.yutou.napcat.QQNumberManager; -import com.yutou.napcat.handle.BaseHandle; -import com.yutou.napcat.handle.MessageHandleBuild; -import com.yutou.napcat.handle.Reply; -import com.yutou.napcat.handle.Text; -import com.yutou.napcat.http.NapCatApi; -import com.yutou.napcat.model.FriendBean; -import com.yutou.napcat.model.GroupBean; -import com.yutou.napcat.model.SendMessageResponse; -import com.yutou.okhttp.HttpBody; -import com.yutou.okhttp.HttpCallback; -import com.yutou.utils.ConfigTools; -import okhttp3.Headers; -import retrofit2.Response; - - -import java.io.File; -import java.util.Arrays; -import java.util.List; - -public class QQBotManager { - - public static Long defGroup = 891655174L; - public static Long defQQ = 583819556L; - - - private static QQBotManager botManager = null; - private static final long qqGroup = 891655174L; - private boolean isLogin = false; - private static boolean isInit = false; - - - private QQBotManager() { - Boolean isRun = ConfigTools.load(ConfigTools.CONFIG, "qq_bot", Boolean.class); - if (isRun != null && isRun) { - isLogin = true; - init(); - } - } - - private void init() { - NapCatApi.getGroupApi().getGroupList().enqueue(new HttpCallback>() { - @Override - public void onResponse(Headers headers,int code, String status, List response, String rawResponse) { - for (GroupBean groupBean : response) { - QQDatabase.addGroup(groupBean.getGroupId(), groupBean); - QQNumberManager.getManager().addNumber(groupBean.getGroupId(), true); - } - } - - @Override - public void onFailure(Throwable throwable) { - - } - }); - NapCatApi.getFriendApi().getFriendList().enqueue(new HttpCallback>() { - @Override - public void onResponse(Headers headers,int code, String status, List response, String rawResponse) { - for (FriendBean friendBean : response) { - QQDatabase.addUser(friendBean.getUserId(), friendBean); - QQNumberManager.getManager().addNumber(friendBean.getUserId(), false); - } - } - - @Override - public void onFailure(Throwable throwable) { - - } - }); - NapCatApi.getUtilsApi().getLoginInfo().enqueue(new HttpCallback() { - @Override - public void onResponse(Headers headers,int code, String status, FriendBean response, String rawResponse) { - QQDatabase.setMe(response); - } - - @Override - public void onFailure(Throwable throwable) { - - } - }); - isInit = true; - } - - public synchronized static QQBotManager getInstance() { - if (botManager == null && !isInit) { - botManager = new QQBotManager(); - } - return botManager; - } - - - private String getNotLoginQQ() { - return "没有登录QQ"; - } - - public SendMessageResponse sendPrivateMessage(Long qq, BaseHandle... items) { - return sendMessage(true, qq, items); - } - - private SendMessageResponse sendGroupMessage(Long group, BaseHandle... items) { - return sendMessage(false, group, items); - } - - public SendMessageResponse sendMessage(boolean user, Long qq, String msg) { - return sendMessage(user, qq, new Text(msg)); - } - - public SendMessageResponse sendMessage(Long qq, BaseHandle... items) { - return sendMessage(QQDatabase.checkFriend(qq), qq, Arrays.asList(items)); - } - - public SendMessageResponse sendMessage(boolean isUser, Long qq, BaseHandle... items) { - return sendMessage(isUser, qq, Arrays.asList(items)); - } - - public SendMessageResponse sendMessage(boolean isUser, Long qq, List> items) { - try { - if(!ConfigTools.load(ConfigTools.CONFIG,ConfigTools.QQ, Boolean.class)){ - return null; - } - MessageHandleBuild handleBuild = MessageHandleBuild - .create() - .setGroup(!isUser) - .setQQNumber(qq); - for (BaseHandle item : items) { - if (item.getData() == null) { - continue; - } - if (item instanceof Reply) { - if (((Reply) item).getData().getId() == -1) { - continue; - } - } - handleBuild.add(item); - } - Response> response; - if (isUser) { - response = NapCatApi.getMessageApi().sendPrivateMsg( - handleBuild.build() - ).execute(); - } else { - response = NapCatApi.getMessageApi().sendGroupMsg( - handleBuild.build() - ).execute(); - } - if (response.body() != null) { - return response.body().getData(); - } - } catch (Exception e) { - e.printStackTrace(); - SendMessageResponse response = new SendMessageResponse(); - response.setId(-1); - response.setE(e.getMessage()); - return response; - } - return null; - } - - public String sendMessage(String text) { - - return getNotLoginQQ(); - } - - public SendMessageResponse sendMessage(Long group, String text) { - return sendMessage(QQDatabase.checkFriend(group), group, new Text(text)); - } - - public void sendMessage(Long group, StringBuilder builder) { - if (QQNumberManager.getManager().isGroup(group)) { - System.out.println("发群"); - } else { - System.out.println("发个人"); - } - } - - public void sendMessage(File imageFile, Long qq, String text) { - sendMessage(imageFile, qq, null, text); - } - - public void sendMessage(File imageFile, Long qq, String replyMessageId, String text) { - - } - - public void sendMessage(File imageFile, String text) { - } - - public void sendMessage(List imgs, Long qq, String text) { - - } - - - public static void main(String[] args) { - JSONObject json = new JSONObject(); - json.put("t1", 3234567890L); - System.out.println("json = " + json); - - String tmp = json.toString(); - JSONObject json2 = JSONObject.parseObject(tmp); - System.out.println("json2 = " + json2); - } - - - public boolean isLogin() { - return true; - } - - -} diff --git a/src/main/java/com/yutou/bilibili/Services/ISystemConfigService.java b/src/main/java/com/yutou/bilibili/Services/ISystemConfigService.java deleted file mode 100644 index 2cbf6c8..0000000 --- a/src/main/java/com/yutou/bilibili/Services/ISystemConfigService.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.yutou.bilibili.Services; - -public interface ISystemConfigService { - String getConfig(String key); - void setConfig(String key,String value); -} diff --git a/src/main/java/com/yutou/bilibili/Services/IUserService.java b/src/main/java/com/yutou/bilibili/Services/IUserService.java deleted file mode 100644 index dc37877..0000000 --- a/src/main/java/com/yutou/bilibili/Services/IUserService.java +++ /dev/null @@ -1,18 +0,0 @@ -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 getUserToUid(Integer uid); - UUser getUserToToken(String token); - List getUserUp(int uid); -} diff --git a/src/main/java/com/yutou/bilibili/Services/impl/SystemConfigImpl.java b/src/main/java/com/yutou/bilibili/Services/impl/SystemConfigImpl.java deleted file mode 100644 index 471bfec..0000000 --- a/src/main/java/com/yutou/bilibili/Services/impl/SystemConfigImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -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 jakarta.annotation.Resource; -import org.springframework.stereotype.Service; - -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 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); - } - } -} diff --git a/src/main/java/com/yutou/bilibili/Services/impl/UserServiceImpl.java b/src/main/java/com/yutou/bilibili/Services/impl/UserServiceImpl.java deleted file mode 100644 index 38c3ad4..0000000 --- a/src/main/java/com/yutou/bilibili/Services/impl/UserServiceImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.yutou.bilibili.Services.impl; - -import com.yutou.bilibili.Services.IUserService; -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 com.yutou.utils.AppTools; -import jakarta.annotation.Resource; -import org.springframework.stereotype.Service; -import org.springframework.util.StringUtils; - -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 list=userDao.selectByExample(example); - if(list.isEmpty()){ - return null; - }else{ - return list.get(0); - } - } - - @Override - public UUser getUserToUid(Integer uid) { - return userDao.selectByPrimaryKey(uid); - } - - @Override - public List 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 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(); - } -} diff --git a/src/main/java/com/yutou/bilibili/Test/TestController.java b/src/main/java/com/yutou/bilibili/Test/TestController.java index a7bef08..d9fe49a 100644 --- a/src/main/java/com/yutou/bilibili/Test/TestController.java +++ b/src/main/java/com/yutou/bilibili/Test/TestController.java @@ -1,8 +1,20 @@ package com.yutou.bilibili.Test; +import com.yutou.bilibili.Tools.AESTools; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; @Controller public class TestController { - + @RequestMapping("/test") + @ResponseBody + public String test() { + return "f"; + } + @RequestMapping("/test2") + @ResponseBody + public String test2() { + return AESTools.encrypt("f"); + } } diff --git a/src/main/java/com/yutou/bilibili/Tools/AESTools.java b/src/main/java/com/yutou/bilibili/Tools/AESTools.java new file mode 100644 index 0000000..0a6b5b3 --- /dev/null +++ b/src/main/java/com/yutou/bilibili/Tools/AESTools.java @@ -0,0 +1,52 @@ +package com.yutou.bilibili.Tools; + +import javax.crypto.Cipher; +import javax.crypto.KeyGenerator; +import javax.crypto.spec.SecretKeySpec; +import java.nio.charset.StandardCharsets; +import java.util.Base64; + +public class AESTools { + private static final String key="fJjSoOM7tDIQN0Ne"; + private static final String model="AES/ECB/PKCS5Padding"; + + /** + * 加密 + * @param value 原文 + * @return 密文 + */ + public static String encrypt(String value){ + try { + KeyGenerator generator=KeyGenerator.getInstance("AES"); + generator.init(128); + Cipher cipher=Cipher.getInstance(model); + cipher.init(Cipher.ENCRYPT_MODE,new SecretKeySpec(key.getBytes(),"AES")); + byte[] bytes=cipher.doFinal(value.getBytes(StandardCharsets.UTF_8)); + return new String(Base64.getEncoder().encode(bytes)); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * 解密 + * @param value 密文 + * @return 原文 + */ + public static String decrypt(String value){ + try { + KeyGenerator generator=KeyGenerator.getInstance("AES"); + generator.init(128); + Cipher cipher=Cipher.getInstance(model); + cipher.init(Cipher.DECRYPT_MODE,new SecretKeySpec(key.getBytes(),"AES")); + byte[] encodeBytes=Base64.getDecoder().decode(value); + byte[] bytes=cipher.doFinal(encodeBytes); + return new String(bytes); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + +} diff --git a/src/main/java/com/yutou/bilibili/Tools/APIFilter.java b/src/main/java/com/yutou/bilibili/Tools/APIFilter.java deleted file mode 100644 index d014ffa..0000000 --- a/src/main/java/com/yutou/bilibili/Tools/APIFilter.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.yutou.bilibili.Tools; - -import com.alibaba.fastjson2.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 com.yutou.utils.AppTools; -import com.yutou.utils.Log; -import com.yutou.utils.RedisTools; -import jakarta.annotation.Resource; -import jakarta.servlet.*; -import jakarta.servlet.annotation.WebFilter; -import jakarta.servlet.http.Cookie; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import org.springframework.stereotype.Component; -import org.springframework.util.StringUtils; - -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 { - if (StringUtils.isEmpty(token)) { - response.sendRedirect("/"); - return; - } - UUser user = service.getUserToUid(Integer.parseInt(RedisTools.get(token))); - if (user == null) { - response.sendRedirect("/"); - } else { - String url = null; - try { - url = tmp.split(tmp.split("/")[tmp.split("/").length - 1])[0]; - } catch (Exception e) { - Log.e(e); - Log.i("无权限请求:" + 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 permissions = permissionDao.selectByExample(pExample); - if (permissions != null && permissions.size() > 0) { - if (powers.toJavaList(Integer.class).contains(permissions.get(0).getId())) { - filterChain.doFilter(servletRequest, servletResponse); - } - } - } - } - } - } - - -} diff --git a/src/main/java/com/yutou/bilibili/Tools/ApplicationClose.java b/src/main/java/com/yutou/bilibili/Tools/ApplicationClose.java index be8228c..76efb99 100644 --- a/src/main/java/com/yutou/bilibili/Tools/ApplicationClose.java +++ b/src/main/java/com/yutou/bilibili/Tools/ApplicationClose.java @@ -1,6 +1,6 @@ package com.yutou.bilibili.Tools; -import com.yutou.utils.Log; +import com.yutou.common.utils.Log; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextClosedEvent; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/yutou/bilibili/Tools/ApplicationInit.java b/src/main/java/com/yutou/bilibili/Tools/ApplicationInit.java index 89e9291..de4b3d9 100644 --- a/src/main/java/com/yutou/bilibili/Tools/ApplicationInit.java +++ b/src/main/java/com/yutou/bilibili/Tools/ApplicationInit.java @@ -1,22 +1,13 @@ package com.yutou.bilibili.Tools; -import com.yutou.bilibili.BiliBili.Datas.AppData; -import com.yutou.bilibili.BiliBili.Datas.LiveData; -import com.yutou.bilibili.Services.ISystemConfigService; -import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliLiveInfo; -import com.yutou.bilibili.mybatis.Bili.mybatis.model.BilibiliUpInfo; +import com.yutou.bilibili.services.SystemService; import jakarta.annotation.Resource; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; -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; +import java.util.logging.Level; +import java.util.logging.Logger; /** * 服务启动后执行 @@ -24,73 +15,13 @@ import java.util.TimerTask; @Component public class ApplicationInit implements ApplicationRunner { @Resource - ISystemConfigService configService; - private Timer timer; - + SystemService systemConfigService; @Override public void run(ApplicationArguments args) throws Exception { - AppData.FFMPEG = configService.getConfig(Config.SYSTEM_VIDEO_FFMPEG); - AppData.LIVE_SAVE_FFMPEG = configService.getConfig(Config.SYSTEM_VIDEO_SAVE_MODEL) != null && configService.getConfig(Config.SYSTEM_VIDEO_SAVE_MODEL).equals("ffmpeg"); - startTimer(); + Logger logger = Logger.getLogger("ApplicationInit"); + logger.log(Level.INFO, "服务启动后执行"); + systemConfigService.start(); } - 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); - if (time.equals(oldTime)) { - return; - } - checkLive(); - oldTime = time; - switch (time) { - case "00:00": - - 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() { - - } - }, 0, 2 * 60 * 1000); - } - } - - public void saveData(String time) { - - } } diff --git a/src/main/java/com/yutou/bilibili/Tools/AssTools.java b/src/main/java/com/yutou/bilibili/Tools/AssTools.java index 9700ccf..0c7e3f2 100644 --- a/src/main/java/com/yutou/bilibili/Tools/AssTools.java +++ b/src/main/java/com/yutou/bilibili/Tools/AssTools.java @@ -1,6 +1,6 @@ package com.yutou.bilibili.Tools; -import com.yutou.bilibili.BiliBili.Datas.DanmuData; +import com.yutou.bilibili.datas.DanmuData; import java.io.File; import java.io.FileWriter; diff --git a/src/main/java/com/yutou/bilibili/Tools/Config.java b/src/main/java/com/yutou/bilibili/Tools/Config.java deleted file mode 100644 index 5824943..0000000 --- a/src/main/java/com/yutou/bilibili/Tools/Config.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.yutou.bilibili.Tools; - -public class Config { - public static final String USER_REG="userReg"; - public static final String BILI_LIVE_FLAG="biliLive"; - public static final String SYSTEM_VIDEO_FFMPEG="ffmpeg_path"; - public static final String SYSTEM_VIDEO_SAVE_MODEL="save_live_model"; -} diff --git a/src/main/java/com/yutou/bilibili/Tools/DanmuTools.java b/src/main/java/com/yutou/bilibili/Tools/DanmuTools.java deleted file mode 100644 index 77e68a6..0000000 --- a/src/main/java/com/yutou/bilibili/Tools/DanmuTools.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.yutou.bilibili.Tools; - -import com.yutou.bilibili.BiliBili.Datas.DanmuData; -import com.yutou.bilibili.sqlite.BiliBiliLiveDatabasesManager; - -import java.io.File; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.nio.file.attribute.BasicFileAttributes; -import java.nio.file.attribute.FileTime; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class DanmuTools { - public static File danmuToAss(File live, File danmu, boolean useFileNameData, String... filterDanmu) { - BiliBiliLiveDatabasesManager manager = new BiliBiliLiveDatabasesManager(); - try { - FileTime creationTime = Files.readAttributes(Paths.get(live.getAbsolutePath()), BasicFileAttributes.class).creationTime(); - FileTime lastModifiedTime = Files.readAttributes(Paths.get(live.getAbsolutePath()), BasicFileAttributes.class).lastModifiedTime(); - Date startTime; - if (useFileNameData) { - startTime = getLiveDate(live.getName()); - } else { - startTime = new Date(creationTime.toMillis()); - } - manager.init(danmu); - List danmuData = manager.queryDanmu(startTime, new Date(lastModifiedTime.toMillis())); - AssTools assTools = new AssTools(live.getName(), startTime); - assTools.addFilter(filterDanmu); - assTools.setAlpha(128); - for (DanmuData danmuDatum : danmuData) { - assTools.addDanmu(danmuDatum); - } - assTools.saveDanmu(live.getAbsolutePath().replace(live.getName().substring(live.getName().lastIndexOf(".")), ".ass")); - } catch (Exception e) { - e.printStackTrace(); - } finally { - manager.close(); - } - return null; - } - - private static Date getLiveDate(String fileName) { - Pattern pattern = Pattern.compile("(\\[.*\\])."); - Matcher matcher = pattern.matcher(fileName); - if (matcher.find()) { - String str = matcher.group(1); - try { - return new SimpleDateFormat("[yyyy-MM-dd HHmmss]").parse(str); - } catch (ParseException e) { - e.printStackTrace(); - } - } - return null; - } - - public static void main(String[] args) { - File live = new File("Z:\\download\\演唱会or录播\\2022年2月11日Liyuu_1st演唱会\\[2022-02-11 163454]5265.mp4"); - File danmu = new File("Z:\\download\\演唱会or录播\\2022年2月11日Liyuu_1st演唱会\\[2022-02-11]5265.db"); - danmuToAss(live, danmu,true, "老板大气!点点红包抽礼物!"); - } -} diff --git a/src/main/java/com/yutou/bilibili/Tools/ExcelUtils.java b/src/main/java/com/yutou/bilibili/Tools/ExcelUtils.java deleted file mode 100644 index d8e764f..0000000 --- a/src/main/java/com/yutou/bilibili/Tools/ExcelUtils.java +++ /dev/null @@ -1,155 +0,0 @@ -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 com.yutou.utils.AppTools; -import com.yutou.utils.Log; -import jakarta.annotation.Resource; -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 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(); - Log.i("开始注入bean"); - utils.dataDao = getBean(BilibiliLiveDataDao.class); - utils.infoDao = getBean(BilibiliLiveInfoDao.class); - Log.i("注入完毕:"+(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(); - Log.i("进入统计:"+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), "记录时间"); - - Log.i("表头插入完毕:"+(System.currentTimeMillis()-timer)); - List 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 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())); - } - Log.i("数据填充完毕:"+(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(); - Log.i("文件写入完毕:"+(System.currentTimeMillis()-timer)); - file.renameTo(new File("excel"+File.separator+fileName)); - return file; - } catch (Exception e) { - Log.e(e); - } - - 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 getBean(Class clazz) { - return applicationContext.getBean(clazz); - } -} diff --git a/src/main/java/com/yutou/bilibili/Tools/FFmpegUtils.java b/src/main/java/com/yutou/bilibili/Tools/FFmpegUtils.java index 774118f..76f8c4b 100644 --- a/src/main/java/com/yutou/bilibili/Tools/FFmpegUtils.java +++ b/src/main/java/com/yutou/bilibili/Tools/FFmpegUtils.java @@ -1,7 +1,7 @@ package com.yutou.bilibili.Tools; -import com.yutou.utils.AppTools; -import com.yutou.utils.Log; +import com.yutou.common.utils.AppTools; +import com.yutou.common.utils.Log; import java.io.File; import java.io.InputStream; diff --git a/src/main/java/com/yutou/bilibili/Tools/HttpTools.java b/src/main/java/com/yutou/bilibili/Tools/HttpTools.java deleted file mode 100644 index e341825..0000000 --- a/src/main/java/com/yutou/bilibili/Tools/HttpTools.java +++ /dev/null @@ -1,262 +0,0 @@ -package com.yutou.bilibili.Tools; - -import com.alibaba.fastjson2.JSONObject; -import com.yutou.bilibili.interfaces.DownloadInterface; -import com.yutou.utils.Log; -import org.springframework.util.StringUtils; - -import java.io.*; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLConnection; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.util.Map; -import java.util.Set; - -public class HttpTools { - private static final int HttpRequestIndex = 3; - - public static String get(String url) { - return https_get(url, null); - } - - public static String post(final String url, final byte[] body) { - return http_post(url, body, 0, null); - } - - public static File syncDownload(final String url, final String saveName) { - return new HttpTools().http_syncDownload(url, saveName); - } - - public static String https_get(String url, Map header) { - try { - URLConnection connection; - connection = new URL(url).openConnection(); - connection.setConnectTimeout(60*1000); - connection.setReadTimeout(60*1000); - connection.setRequestProperty("User-Agent", getExtUa()); - if (header != null) { - for (String key : header.keySet()) { - connection.addRequestProperty(key, header.get(key)); - } - } - connection.connect(); - BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); - StringBuilder str = new StringBuilder(); - String tmp; - while ((tmp = reader.readLine()) != null) { - str.append(tmp).append("\n"); - } - reader.close(); - return str.toString(); - } catch (Exception e) { - System.err.println("error url = " + url); - e.printStackTrace(); - } - return null; - } - - public static String http_post(String url, byte[] body, int index, Map headers) { - String tmp; - StringBuilder str = new StringBuilder(); - try { - HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); - connection.setRequestMethod("POST"); - if (headers != null) { - for (String key : headers.keySet()) { - connection.addRequestProperty(key, headers.get(key)); - } - } - connection.setDoOutput(true); - connection.setDoInput(true); - connection.addRequestProperty("User-Agent", getExtUa()); - connection.setConnectTimeout(5 * 1000); - connection.setReadTimeout(10 * 1000); - //connection.addRequestProperty("Connection", "keep-alive"); - //connection.addRequestProperty("User-Agent", getExtUa()); - connection.addRequestProperty("content-type", "application/json"); - //connection.addRequestProperty("charset", "UTF-8"); - OutputStream outputStream = connection.getOutputStream(); - //System.out.println(new String(body)); - outputStream.write(body); - outputStream.flush(); - outputStream.close(); - connection.connect(); - BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); - while ((tmp = reader.readLine()) != null) { - str.append(tmp); - } - String finalStr = str.toString(); - - connection.disconnect(); - reader.close(); - return finalStr; - } catch (Exception e) { - if (index < HttpRequestIndex) { - return http_post(url, body, index + 1, headers); - } else { - e.printStackTrace(); - return null; - } - } - } - - 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 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); - } - }); - }*/ - } - - private static String donwloadPath = "tmp" + File.separator; - - public synchronized static void download(final String url, final String saveName, final DownloadInterface downloadInterface) { - new Thread(new Runnable() { - @Override - public void run() { - File jar = null; - try { - File savePath = new File(donwloadPath); - if (!savePath.exists()) { - savePath.mkdirs(); - } - Log.i("DOWNLOAD", "下载文件:" + url + " 保存文件:" + saveName); - HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); - connection.addRequestProperty("User-Agent", getExtUa()); - // Log.i(TAG,"获取到网络请求:"+connection.getResponseCode()); - - - InputStream inputStream = connection.getInputStream(); - jar = new File(donwloadPath + saveName + "_tmp.tmp"); - jar.createNewFile(); - Log.i("DOWNLOAD", "临时保存文件:" + jar.getAbsolutePath()); - OutputStream outputStream = new FileOutputStream(jar); - byte[] bytes = new byte[1024]; - double size = connection.getContentLength(); - double downSize = 0; - int len; - while ((len = inputStream.read(bytes)) > 0) { - outputStream.write(bytes, 0, len); - downSize += len; - if (downloadInterface != null) { - downloadInterface.onDownloading(downSize, size); - } - } - outputStream.close(); - inputStream.close(); - File oldJar = new File(donwloadPath + saveName); - if (oldJar.exists()) { - oldJar.delete(); - } - jar.renameTo(oldJar); - Log.i("DOWNLOAD", "实际保存:" + oldJar.getAbsolutePath() + " " + oldJar.getName()); - if (downloadInterface != null) { - downloadInterface.onDownload(oldJar); - - } - - } catch (Exception e) { - e.printStackTrace(); - if (jar != null) { - jar.delete(); - } - if (downloadInterface != null) { - downloadInterface.onError(e); - } - } - } - }).start(); - } - - public synchronized File http_syncDownload(final String url, final String saveName) { - if (StringUtils.isEmpty(url)) { - return null; - } - File jar = null; - try { - File savePath = new File(donwloadPath); - if (!savePath.exists()) { - savePath.mkdirs(); - } - Log.i("DOWNLOAD", "下载文件:" + url + " 保存文件:" + saveName); - HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); - connection.addRequestProperty("User-Agent", getExtUa()); - // Log.i(TAG,"获取到网络请求:"+connection.getResponseCode()); - - - InputStream inputStream = connection.getInputStream(); - jar = new File(donwloadPath + saveName + "_tmp.tmp"); - jar.createNewFile(); - Log.i("DOWNLOAD", "临时保存文件:" + jar.getAbsolutePath()); - OutputStream outputStream = new FileOutputStream(jar); - byte[] bytes = new byte[1024]; - double size = connection.getContentLength(); - double downSize = 0; - int len; - while ((len = inputStream.read(bytes)) > 0) { - outputStream.write(bytes, 0, len); - downSize += len; - } - outputStream.close(); - inputStream.close(); - File oldJar = new File(donwloadPath + saveName); - if (oldJar.exists()) { - oldJar.delete(); - } - connection.disconnect(); - jar.renameTo(oldJar); - Log.i("DOWNLOAD", "实际保存:" + oldJar.getAbsolutePath() + " " + oldJar.getName()); - return oldJar; - - } catch (Exception e) { - e.printStackTrace(); - if (jar != null) { - jar.delete(); - } - return null; - } - } -} diff --git a/src/main/java/com/yutou/bilibili/Tools/ServiceTools.java b/src/main/java/com/yutou/bilibili/Tools/ServiceTools.java deleted file mode 100644 index 88dee70..0000000 --- a/src/main/java/com/yutou/bilibili/Tools/ServiceTools.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.yutou.bilibili.Tools; - -import com.alibaba.fastjson2.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 com.yutou.utils.Log; -import jakarta.annotation.Resource; -import jakarta.servlet.http.HttpServletRequest; -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -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) { - Log.e(e); - Log.i("无权限请求:" + 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 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 getBean(Class clazz) { - return applicationContext.getBean(clazz); - } -} diff --git a/src/main/java/com/yutou/bilibili/Tools/TestMain.java b/src/main/java/com/yutou/bilibili/Tools/TestMain.java deleted file mode 100644 index d332010..0000000 --- a/src/main/java/com/yutou/bilibili/Tools/TestMain.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.yutou.bilibili.Tools; - -import com.alibaba.fastjson2.JSONObject; - -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.nio.charset.StandardCharsets; - -public class TestMain { - public static void main(String[] args) { - new TestMain(); - } - - public TestMain() { - - } - -} diff --git a/src/main/java/com/yutou/bilibili/Tools/Tools.java b/src/main/java/com/yutou/bilibili/Tools/Tools.java index 910a312..b108a9a 100644 --- a/src/main/java/com/yutou/bilibili/Tools/Tools.java +++ b/src/main/java/com/yutou/bilibili/Tools/Tools.java @@ -1,7 +1,7 @@ package com.yutou.bilibili.Tools; import com.yutou.bilibili.interfaces.DownloadInterface; -import com.yutou.utils.Log; +import com.yutou.common.utils.Log; import jakarta.servlet.http.HttpServletRequest; import org.springframework.core.io.FileSystemResource; import org.springframework.http.HttpHeaders; @@ -40,13 +40,13 @@ public class Tools { */ public static String getRemoteAddress(HttpServletRequest request) { String ip = request.getHeader("x-forwarded-for"); - if (ip == null || ip.length() == 0 || ip.equalsIgnoreCase("unknown")) { + if (ip == null || ip.isEmpty() || ip.equalsIgnoreCase("unknown")) { ip = request.getHeader("Proxy-Client-IP"); } - if (ip == null || ip.length() == 0 || ip.equalsIgnoreCase("unknown")) { + if (ip == null || ip.isEmpty() || ip.equalsIgnoreCase("unknown")) { ip = request.getHeader("WL-Proxy-Client-IP"); } - if (ip == null || ip.length() == 0 || ip.equalsIgnoreCase("unknown")) { + if (ip == null || ip.isEmpty() || ip.equalsIgnoreCase("unknown")) { ip = request.getRemoteAddr(); } return ip; diff --git a/src/main/java/com/yutou/bilibili/databases/SystemConfigDatabases.java b/src/main/java/com/yutou/bilibili/databases/SystemConfigDatabases.java new file mode 100644 index 0000000..06f73b9 --- /dev/null +++ b/src/main/java/com/yutou/bilibili/databases/SystemConfigDatabases.java @@ -0,0 +1,46 @@ +package com.yutou.bilibili.databases; + +import com.yutou.bilibili.datas.SystemConfigDatabaseBean; +import com.yutou.common.databases.AbsDatabasesBean; +import com.yutou.common.databases.SQLiteManager; + +import java.util.List; + +public class SystemConfigDatabases extends SQLiteManager { + @Override + public String getFileName() { + return "system_config.db"; + } + + @Override + protected List getDataBean() { + return List.of(new SystemConfigDatabaseBean()); + } + + public SystemConfigDatabases() { + super(); + init(); + } + + public void setConfig(SystemConfigDatabaseBean bean) { + SystemConfigDatabaseBean config = getConfig(); + if (config == null) { + add(bean); + } else { + bean.setSql_time(config.getSql_time()); + update(bean); + } + } + + public SystemConfigDatabaseBean getConfig() { + List list = get(getDataBean().get(0).getTableName(), SystemConfigDatabaseBean.class); + if (list.isEmpty()) { + return null; + } + return list.get(0); + } + + public SystemConfigDatabaseBean getDefaultConfig() { + return new SystemConfigDatabaseBean(); + } +} diff --git a/src/main/java/com/yutou/bilibili/BiliBili/Datas/DanmuData.java b/src/main/java/com/yutou/bilibili/datas/DanmuData.java similarity index 92% rename from src/main/java/com/yutou/bilibili/BiliBili/Datas/DanmuData.java rename to src/main/java/com/yutou/bilibili/datas/DanmuData.java index 90b05d7..f9376d8 100644 --- a/src/main/java/com/yutou/bilibili/BiliBili/Datas/DanmuData.java +++ b/src/main/java/com/yutou/bilibili/datas/DanmuData.java @@ -1,4 +1,4 @@ -package com.yutou.bilibili.BiliBili.Datas; +package com.yutou.bilibili.datas; import lombok.Data; diff --git a/src/main/java/com/yutou/bilibili/datas/ResultData.java b/src/main/java/com/yutou/bilibili/datas/ResultData.java new file mode 100644 index 0000000..9eb8c3a --- /dev/null +++ b/src/main/java/com/yutou/bilibili/datas/ResultData.java @@ -0,0 +1,41 @@ +package com.yutou.bilibili.datas; + +import lombok.Data; + +@Data +public class ResultData { + private int status; + private String message; + private T data; + private long timestamp ; + + public ResultData (){ + this.timestamp = System.currentTimeMillis(); + } + + + public static ResultData success(T data) { + ResultData resultData = new ResultData<>(); + resultData.setStatus(ReturnCode.RC100.getCode()); + resultData.setMessage(ReturnCode.RC100.getMessage()); + resultData.setData(data); + return resultData; + } + + public static ResultData fail(int code, String message) { + ResultData resultData = new ResultData<>(); + resultData.setStatus(code); + resultData.setMessage(message); + return resultData; + } + public static ResultData success(ReturnCode code) { + return fail(code); + } + public static ResultData fail(ReturnCode code) { + ResultData resultData = new ResultData<>(); + resultData.setStatus(code.getCode()); + resultData.setMessage(code.getMessage()); + return resultData; + } + +} diff --git a/src/main/java/com/yutou/bilibili/datas/ReturnCode.java b/src/main/java/com/yutou/bilibili/datas/ReturnCode.java new file mode 100644 index 0000000..bb1413b --- /dev/null +++ b/src/main/java/com/yutou/bilibili/datas/ReturnCode.java @@ -0,0 +1,47 @@ +package com.yutou.bilibili.datas; + +import lombok.Getter; + +@Getter +public enum ReturnCode { + /**操作成功**/ + RC100(100,"操作成功"), + /**操作失败**/ + RC999(999,"操作失败"), + /**服务限流**/ + RC200(200,"服务开启限流保护,请稍后再试!"), + /**服务降级**/ + RC201(201,"服务开启降级保护,请稍后再试!"), + /**热点参数限流**/ + RC202(202,"热点参数限流,请稍后再试!"), + /**系统规则不满足**/ + RC203(203,"系统规则不满足要求,请稍后再试!"), + /**授权规则不通过**/ + RC204(204,"授权规则不通过,请稍后再试!"), + /**access_denied**/ + RC403(403,"无访问权限,请联系管理员授予权限"), + /**access_denied**/ + RC401(401,"匿名用户访问无权限资源时的异常"), + /**服务异常**/ + RC500(500,"系统异常,请稍后重试"), + + INVALID_TOKEN(2001,"访问令牌不合法"), + ACCESS_DENIED(2003,"没有权限访问该资源"), + CLIENT_AUTHENTICATION_FAILED(1001,"客户端认证失败"), + USERNAME_OR_PASSWORD_ERROR(1002,"用户名或密码错误"), + UNSUPPORTED_GRANT_TYPE(1003, "不支持的认证模式"); + + + + /**自定义状态码**/ + private final int code; + /**自定义描述**/ + private final String message; + + ReturnCode(int code, String message){ + this.code = code; + this.message = message; + } + + +} diff --git a/src/main/java/com/yutou/bilibili/datas/SystemConfigDatabaseBean.java b/src/main/java/com/yutou/bilibili/datas/SystemConfigDatabaseBean.java new file mode 100644 index 0000000..783974a --- /dev/null +++ b/src/main/java/com/yutou/bilibili/datas/SystemConfigDatabaseBean.java @@ -0,0 +1,19 @@ +package com.yutou.bilibili.datas; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.yutou.common.databases.AbsDatabasesBean; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class SystemConfigDatabaseBean extends AbsDatabasesBean { + @JSONField(name = "timer_loop") + private long timerLoop = 5000; + + + public SystemConfigDatabaseBean() { + super("config", System.currentTimeMillis()); + } + +} diff --git a/src/main/java/com/yutou/bilibili/interfaces/NetworkInterface.java b/src/main/java/com/yutou/bilibili/interfaces/NetworkInterface.java deleted file mode 100644 index 1df9405..0000000 --- a/src/main/java/com/yutou/bilibili/interfaces/NetworkInterface.java +++ /dev/null @@ -1,18 +0,0 @@ -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); -} diff --git a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/dao/BilibiliLiveDataDao.java b/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/dao/BilibiliLiveDataDao.java deleted file mode 100644 index d337765..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/dao/BilibiliLiveDataDao.java +++ /dev/null @@ -1,46 +0,0 @@ -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 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 queryLiveData(@Param("roomid") int roomId, @Param("startTime")Date startTime, @Param("endTime")Date endTime, @Param("type")String[] type); - - List 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> queryPriceTimeGroup(@Param("roomid") int roomId, @Param("startTime")Date startTime, @Param("endTime")Date endTime); - - List> queryGiftTimeGroup(@Param("roomid") int roomId, @Param("startTime")Date startTime, @Param("endTime")Date endTime); -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/dao/BilibiliLiveInfoDao.java b/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/dao/BilibiliLiveInfoDao.java deleted file mode 100644 index 127ebcf..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/dao/BilibiliLiveInfoDao.java +++ /dev/null @@ -1,36 +0,0 @@ -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 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 queryTimeOfRoomid(@Param("roomid")int roomid, @Param("startTime") Date startTime, @Param("endTime")Date endTime); -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/dao/BilibiliUpInfoDao.java b/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/dao/BilibiliUpInfoDao.java deleted file mode 100644 index cb46ab6..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/dao/BilibiliUpInfoDao.java +++ /dev/null @@ -1,37 +0,0 @@ -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 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 queryToRoomIds(@Param("roomid")int[] roomid); - -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliLiveData.java b/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliLiveData.java deleted file mode 100644 index 822d4e2..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliLiveData.java +++ /dev/null @@ -1,36 +0,0 @@ -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; -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliLiveDataExample.java b/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliLiveDataExample.java deleted file mode 100644 index 5e8bd3c..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliLiveDataExample.java +++ /dev/null @@ -1,892 +0,0 @@ -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 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 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 criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList<>(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List 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 values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List 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 values) { - addCriterion("`uid` in", values, "uid"); - return (Criteria) this; - } - - public Criteria andUidNotIn(List 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 values) { - addCriterion("roomid in", values, "roomid"); - return (Criteria) this; - } - - public Criteria andRoomidNotIn(List 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 values) { - addCriterion("`type` in", values, "type"); - return (Criteria) this; - } - - public Criteria andTypeNotIn(List 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 values) { - addCriterion("msg in", values, "msg"); - return (Criteria) this; - } - - public Criteria andMsgNotIn(List 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 values) { - addCriterion("giftId in", values, "giftid"); - return (Criteria) this; - } - - public Criteria andGiftidNotIn(List 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 values) { - addCriterion("giftName in", values, "giftname"); - return (Criteria) this; - } - - public Criteria andGiftnameNotIn(List 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 values) { - addCriterion("giftIndex in", values, "giftindex"); - return (Criteria) this; - } - - public Criteria andGiftindexNotIn(List 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 values) { - addCriterion("price in", values, "price"); - return (Criteria) this; - } - - public Criteria andPriceNotIn(List 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 values) { - addCriterion("priceOfcommission in", values, "priceofcommission"); - return (Criteria) this; - } - - public Criteria andPriceofcommissionNotIn(List 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 values) { - addCriterion("subtime in", values, "subtime"); - return (Criteria) this; - } - - public Criteria andSubtimeNotIn(List 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); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliLiveInfo.java b/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliLiveInfo.java deleted file mode 100644 index b456cf1..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliLiveInfo.java +++ /dev/null @@ -1,63 +0,0 @@ -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; - } -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliLiveInfoExample.java b/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliLiveInfoExample.java deleted file mode 100644 index a783916..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliLiveInfoExample.java +++ /dev/null @@ -1,622 +0,0 @@ -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 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 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 criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList<>(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List 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 values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List 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 values) { - addCriterion("roomid in", values, "roomid"); - return (Criteria) this; - } - - public Criteria andRoomidNotIn(List 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 values) { - addCriterion("popular in", values, "popular"); - return (Criteria) this; - } - - public Criteria andPopularNotIn(List 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 values) { - addCriterion("userIndex in", values, "userindex"); - return (Criteria) this; - } - - public Criteria andUserindexNotIn(List 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 values) { - addCriterion("vipUserIndex in", values, "vipuserindex"); - return (Criteria) this; - } - - public Criteria andVipuserindexNotIn(List 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 values) { - addCriterion("giftUser in", values, "giftuser"); - return (Criteria) this; - } - - public Criteria andGiftuserNotIn(List 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 values) { - addCriterion("subtime in", values, "subtime"); - return (Criteria) this; - } - - public Criteria andSubtimeNotIn(List 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); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliUpInfo.java b/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliUpInfo.java deleted file mode 100644 index c3d113e..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliUpInfo.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.yutou.bilibili.mybatis.Bili.mybatis.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import lombok.Data; - -/** - * bilibili_up_info - * @author - */ -@Data -public class BilibiliUpInfo implements Serializable { - private Integer id; - - /** - * UP名字 - */ - private String name; - - /** - * 直播间 - */ - private String url; - - private Long mid=0L; - - /** - * 房间号 - */ - 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; - - public Integer checkLiveStatus(){ - List list=new ArrayList<>(); - list.add(this); - return live; - } - - public Integer getLive() { - return live; - } -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliUpInfoExample.java b/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliUpInfoExample.java deleted file mode 100644 index 1b17922..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/Bili/mybatis/model/BilibiliUpInfoExample.java +++ /dev/null @@ -1,821 +0,0 @@ -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 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 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 criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList<>(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List 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 values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List 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 values) { - addCriterion("`name` in", values, "name"); - return (Criteria) this; - } - - public Criteria andNameNotIn(List 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 values) { - addCriterion("url in", values, "url"); - return (Criteria) this; - } - - public Criteria andUrlNotIn(List 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 andMidIsNull() { - addCriterion("mid is null"); - return (Criteria) this; - } - - public Criteria andMidIsNotNull() { - addCriterion("mid is not null"); - return (Criteria) this; - } - - public Criteria andMidEqualTo(Integer value) { - addCriterion("mid =", value, "mid"); - return (Criteria) this; - } - - public Criteria andMidNotEqualTo(Integer value) { - addCriterion("mid <>", value, "mid"); - return (Criteria) this; - } - - public Criteria andMidGreaterThan(Integer value) { - addCriterion("mid >", value, "mid"); - return (Criteria) this; - } - - public Criteria andMidGreaterThanOrEqualTo(Integer value) { - addCriterion("mid >=", value, "mid"); - return (Criteria) this; - } - - public Criteria andMidLessThan(Integer value) { - addCriterion("mid <", value, "mid"); - return (Criteria) this; - } - - public Criteria andMidLessThanOrEqualTo(Integer value) { - addCriterion("mid <=", value, "mid"); - return (Criteria) this; - } - - public Criteria andMidIn(List values) { - addCriterion("mid in", values, "mid"); - return (Criteria) this; - } - - public Criteria andMidNotIn(List values) { - addCriterion("mid not in", values, "mid"); - return (Criteria) this; - } - - public Criteria andMidBetween(Integer value1, Integer value2) { - addCriterion("mid between", value1, value2, "mid"); - return (Criteria) this; - } - - public Criteria andMidNotBetween(Integer value1, Integer value2) { - addCriterion("mid not between", value1, value2, "mid"); - 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 values) { - addCriterion("roomid in", values, "roomid"); - return (Criteria) this; - } - - public Criteria andRoomidNotIn(List 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 values) { - addCriterion("offlineListening in", values, "offlinelistening"); - return (Criteria) this; - } - - public Criteria andOfflinelisteningNotIn(List 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 values) { - addCriterion("saveDanmu in", values, "savedanmu"); - return (Criteria) this; - } - - public Criteria andSavedanmuNotIn(List 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 values) { - addCriterion("`enable` in", values, "enable"); - return (Criteria) this; - } - - public Criteria andEnableNotIn(List 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 values) { - addCriterion("live in", values, "live"); - return (Criteria) this; - } - - public Criteria andLiveNotIn(List 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 values) { - addCriterion("saveLive in", values, "savelive"); - return (Criteria) this; - } - - public Criteria andSaveliveNotIn(List 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); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/dao/PermissionDao.java b/src/main/java/com/yutou/bilibili/mybatis/dao/PermissionDao.java deleted file mode 100644 index 786dc03..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/dao/PermissionDao.java +++ /dev/null @@ -1,32 +0,0 @@ -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 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); -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/dao/SConfigDao.java b/src/main/java/com/yutou/bilibili/mybatis/dao/SConfigDao.java deleted file mode 100644 index 8e9ee51..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/dao/SConfigDao.java +++ /dev/null @@ -1,32 +0,0 @@ -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 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); -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/dao/UBiliUpDao.java b/src/main/java/com/yutou/bilibili/mybatis/dao/UBiliUpDao.java deleted file mode 100644 index 926b1e0..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/dao/UBiliUpDao.java +++ /dev/null @@ -1,32 +0,0 @@ -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 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); -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/dao/UUserDao.java b/src/main/java/com/yutou/bilibili/mybatis/dao/UUserDao.java deleted file mode 100644 index 1ae6829..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/dao/UUserDao.java +++ /dev/null @@ -1,32 +0,0 @@ -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 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); -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/model/Permission.java b/src/main/java/com/yutou/bilibili/mybatis/model/Permission.java deleted file mode 100644 index 1330c39..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/model/Permission.java +++ /dev/null @@ -1,25 +0,0 @@ -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; -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/model/PermissionExample.java b/src/main/java/com/yutou/bilibili/mybatis/model/PermissionExample.java deleted file mode 100644 index 131ac40..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/model/PermissionExample.java +++ /dev/null @@ -1,401 +0,0 @@ -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 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 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 criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList<>(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List 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 values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List 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 values) { - addCriterion("title in", values, "title"); - return (Criteria) this; - } - - public Criteria andTitleNotIn(List 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 values) { - addCriterion("url in", values, "url"); - return (Criteria) this; - } - - public Criteria andUrlNotIn(List 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); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/model/SConfig.java b/src/main/java/com/yutou/bilibili/mybatis/model/SConfig.java deleted file mode 100644 index 9061b39..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/model/SConfig.java +++ /dev/null @@ -1,19 +0,0 @@ -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; -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/model/SConfigExample.java b/src/main/java/com/yutou/bilibili/mybatis/model/SConfigExample.java deleted file mode 100644 index 562c0df..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/model/SConfigExample.java +++ /dev/null @@ -1,401 +0,0 @@ -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 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 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 criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList<>(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List 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 values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List 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 values) { - addCriterion("configKey in", values, "configkey"); - return (Criteria) this; - } - - public Criteria andConfigkeyNotIn(List 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 values) { - addCriterion("configValue in", values, "configvalue"); - return (Criteria) this; - } - - public Criteria andConfigvalueNotIn(List 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); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/model/UBiliUp.java b/src/main/java/com/yutou/bilibili/mybatis/model/UBiliUp.java deleted file mode 100644 index 4aa15ce..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/model/UBiliUp.java +++ /dev/null @@ -1,19 +0,0 @@ -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; -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/model/UBiliUpExample.java b/src/main/java/com/yutou/bilibili/mybatis/model/UBiliUpExample.java deleted file mode 100644 index efdad7d..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/model/UBiliUpExample.java +++ /dev/null @@ -1,381 +0,0 @@ -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 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 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 criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList<>(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List 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 values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List 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 values) { - addCriterion("`uid` in", values, "uid"); - return (Criteria) this; - } - - public Criteria andUidNotIn(List 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 values) { - addCriterion("roomid in", values, "roomid"); - return (Criteria) this; - } - - public Criteria andRoomidNotIn(List 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); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/model/UUser.java b/src/main/java/com/yutou/bilibili/mybatis/model/UUser.java deleted file mode 100644 index f2c5f79..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/model/UUser.java +++ /dev/null @@ -1,34 +0,0 @@ -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; -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/mybatis/model/UUserExample.java b/src/main/java/com/yutou/bilibili/mybatis/model/UUserExample.java deleted file mode 100644 index dc763ad..0000000 --- a/src/main/java/com/yutou/bilibili/mybatis/model/UUserExample.java +++ /dev/null @@ -1,672 +0,0 @@ -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 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 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 criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList<>(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List 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 values) { - addCriterion("id in", values, "id"); - return (Criteria) this; - } - - public Criteria andIdNotIn(List 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 values) { - addCriterion("`user` in", values, "user"); - return (Criteria) this; - } - - public Criteria andUserNotIn(List 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 values) { - addCriterion("`password` in", values, "password"); - return (Criteria) this; - } - - public Criteria andPasswordNotIn(List 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 values) { - addCriterion("`power` in", values, "power"); - return (Criteria) this; - } - - public Criteria andPowerNotIn(List 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 values) { - addCriterion("bili_cookie in", values, "biliCookie"); - return (Criteria) this; - } - - public Criteria andBiliCookieNotIn(List 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 values) { - addCriterion("loginToken in", values, "logintoken"); - return (Criteria) this; - } - - public Criteria andLogintokenNotIn(List 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 values) { - addCriterion("subtime in", values, "subtime"); - return (Criteria) this; - } - - public Criteria andSubtimeNotIn(List 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); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/yutou/bilibili/services/LiveConfigService.java b/src/main/java/com/yutou/bilibili/services/LiveConfigService.java new file mode 100644 index 0000000..9c7414f --- /dev/null +++ b/src/main/java/com/yutou/bilibili/services/LiveConfigService.java @@ -0,0 +1,69 @@ +package com.yutou.bilibili.services; + +import com.yutou.biliapi.bean.live.LiveRoomInfo; +import com.yutou.biliapi.bean.live.MasterInfoBean; +import com.yutou.biliapi.bean.live.database.LiveConfigDatabaseBean; +import com.yutou.biliapi.databases.BiliLiveConfigDatabase; +import com.yutou.biliapi.net.BiliLiveNetApiManager; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +import java.io.IOException; +import java.math.BigInteger; +import java.util.List; + +@Service +public class LiveConfigService { + BiliLiveConfigDatabase database=new BiliLiveConfigDatabase(); + + public LiveConfigDatabaseBean addConfig(String url, LiveConfigDatabaseBean bean) { + if (!StringUtils.hasText(url)) { + return null; + } + String roomId = url.replace("https://live.bilibili.com/", "").split("\\?")[0]; + if (!StringUtils.hasText(roomId)) { + return null; + } + bean.setRoomId(new BigInteger(roomId)); + try { + LiveRoomInfo body = BiliLiveNetApiManager.getInstance().getApi(null).getRoomInfo(String.valueOf(bean.getRoomId())).execute().body().getData(); + MasterInfoBean infoBean = BiliLiveNetApiManager.getInstance().getApi(null).getMasterInfo(String.valueOf(body.getUid())).execute().body().getData(); + bean.setAnchorUid(body.getUid()); + bean.setAnchorFace(infoBean.getInfo().getFace()); + bean.setAnchorName(infoBean.getInfo().getUname()); + database.setConfig(bean); + return bean; + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public LiveConfigDatabaseBean updateConfig(BigInteger roomId, LiveConfigDatabaseBean bean) { + LiveConfigDatabaseBean config = database.getConfig(roomId); + if (config == null) { + return null; + } + bean.setRoomId(roomId); + bean.setSql_time(config.getSql_time()); + database.setConfig(bean); + return bean; + } + + public boolean deleteConfig(BigInteger roomId) { + LiveConfigDatabaseBean config = database.getConfig(roomId); + if (config == null) { + return false; + + } + return database.deleteConfig(roomId); + } + + public List getAllConfig() { + return database.getAllConfig(); + } + + public LiveConfigDatabaseBean getConfig(BigInteger roomId) { + return database.getConfig(roomId); + } +} diff --git a/src/main/java/com/yutou/bilibili/services/LiveDanmuService.java b/src/main/java/com/yutou/bilibili/services/LiveDanmuService.java new file mode 100644 index 0000000..60cdb25 --- /dev/null +++ b/src/main/java/com/yutou/bilibili/services/LiveDanmuService.java @@ -0,0 +1,7 @@ +package com.yutou.bilibili.services; + +import org.springframework.stereotype.Service; + +@Service +public class LiveDanmuService { +} diff --git a/src/main/java/com/yutou/bilibili/services/SystemService.java b/src/main/java/com/yutou/bilibili/services/SystemService.java new file mode 100644 index 0000000..ce565e7 --- /dev/null +++ b/src/main/java/com/yutou/bilibili/services/SystemService.java @@ -0,0 +1,88 @@ +package com.yutou.bilibili.services; + +import com.yutou.biliapi.api.LiveApi; +import com.yutou.biliapi.bean.live.LiveRoomConfig; +import com.yutou.biliapi.bean.live.LiveRoomInfo; +import com.yutou.biliapi.bean.live.database.LiveConfigDatabaseBean; +import com.yutou.biliapi.databases.BiliLiveConfigDatabase; +import com.yutou.biliapi.net.BiliLiveNetApiManager; +import com.yutou.biliapi.net.WebSocketManager; +import com.yutou.bilibili.databases.SystemConfigDatabases; +import com.yutou.bilibili.datas.SystemConfigDatabaseBean; +import com.yutou.common.okhttp.HttpBody; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import retrofit2.Response; + +import java.io.IOException; +import java.util.Date; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +@Service +public class SystemService { + SystemConfigDatabases databases = new SystemConfigDatabases(); + private ScheduledExecutorService timer; + private ScheduledFuture scheduled; + BiliLiveConfigDatabase liveConfigDatabase = new BiliLiveConfigDatabase(); + + public long getLoopTimer() { + SystemConfigDatabaseBean config = databases.getConfig(); + if (config == null) { + return databases.getDefaultConfig().getTimerLoop(); + } + return config.getTimerLoop(); + } + + public void start() { + if (timer == null) { + timer = Executors.newScheduledThreadPool(1); + } + System.out.println("执行任务"); + if (scheduled != null) { + scheduled.cancel(true); + } + scheduled = timer.scheduleAtFixedRate(() -> { + List list = liveConfigDatabase.getAllConfig(); + for (LiveConfigDatabaseBean bean : list) { + if (bean.isRecordDanmu() && bean.checkRecordDanmuTime()) { + recordDanmu(bean); + } + if (bean.isRecordLive() && bean.checkRecordLiveTime()) { + recordVideo(bean); + } + } + }, 0, getLoopTimer(), TimeUnit.MILLISECONDS); + } + + // 录制弹幕 + private void recordDanmu(LiveConfigDatabaseBean bean) { + LiveRoomConfig config = new LiveRoomConfig(); + config.setLoginUid(bean.getRecordUid()); + config.setRoomId(bean.getRoomId()); + config.setAnchorName(bean.getAnchorName()); + config.setLogin(StringUtils.hasText(bean.getRecordUid())); + WebSocketManager.getInstance().addRoom(config); + } + + // 录制视频 + private void recordVideo(LiveConfigDatabaseBean bean) { + + } + + public static void main(String[] args) throws InterruptedException { + SystemService service = new SystemService(); + System.out.println(new Date()); + service.start(); + Thread.sleep(15000); + System.out.println(new Date()); + service.start(); + } + +} diff --git a/src/main/java/com/yutou/bilibili/sqlite/BiliBiliLiveDatabasesManager.java b/src/main/java/com/yutou/bilibili/sqlite/BiliBiliLiveDatabasesManager.java index 3c36d2f..9ac76c5 100644 --- a/src/main/java/com/yutou/bilibili/sqlite/BiliBiliLiveDatabasesManager.java +++ b/src/main/java/com/yutou/bilibili/sqlite/BiliBiliLiveDatabasesManager.java @@ -1,10 +1,10 @@ package com.yutou.bilibili.sqlite; import com.alibaba.fastjson2.JSONObject; -import com.yutou.bilibili.BiliBili.Datas.DanmuData; -import com.yutou.databases.AbsDatabasesBean; -import com.yutou.databases.SQLiteManager; -import com.yutou.utils.Log; +import com.yutou.bilibili.datas.DanmuData; +import com.yutou.common.databases.AbsDatabasesBean; +import com.yutou.common.databases.SQLiteManager; +import com.yutou.common.utils.Log; import java.io.File; import java.sql.ResultSet; diff --git a/src/main/java/com/yutou/common/databases/AbsDatabasesBean.java b/src/main/java/com/yutou/common/databases/AbsDatabasesBean.java new file mode 100644 index 0000000..03b5b12 --- /dev/null +++ b/src/main/java/com/yutou/common/databases/AbsDatabasesBean.java @@ -0,0 +1,54 @@ +package com.yutou.common.databases; + +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; +import com.alibaba.fastjson2.JSONWriter; +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.annotation.JSONType; +import lombok.Data; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Set; +@JSONType(ignores = {"fields", "tableName"}) +@Data +public class AbsDatabasesBean { + String tableName; + @JSONField(name = "sql_time") + public Date sql_time; + + private AbsDatabasesBean() { + } + + public AbsDatabasesBean(String tableName,long saveTimer) { + this.tableName = tableName; + this.sql_time = new Date(saveTimer); + } + + public JSONObject toJson() { + JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(this, JSONWriter.Feature.WriteMapNullValue)); + json.remove("tableName"); + json.remove("fields"); + json.put("id", "0"); + for (String key : json.keySet()) { + if(json.get(key) instanceof JSONArray){ + json.put(key,json.getString(key)); + } + if(json.get(key) instanceof String&& "null".equals(json.getString(key))){ + json.put(key,""); + } + } + System.out.println("创建" + tableName + "表 json:" + json); + return json; + } + + public List getFields() { + Field[] fields = getClass().getDeclaredFields(); + List list = new ArrayList<>(); + list.addAll(List.of(fields)); + list.addAll(List.of(getClass().getFields())); + return list; + } +} diff --git a/common/src/main/java/com/yutou/databases/SQLiteManager.java b/src/main/java/com/yutou/common/databases/SQLiteManager.java similarity index 66% rename from common/src/main/java/com/yutou/databases/SQLiteManager.java rename to src/main/java/com/yutou/common/databases/SQLiteManager.java index 27cf485..9c6e7d5 100644 --- a/common/src/main/java/com/yutou/databases/SQLiteManager.java +++ b/src/main/java/com/yutou/common/databases/SQLiteManager.java @@ -1,20 +1,22 @@ -package com.yutou.databases; +package com.yutou.common.databases; +import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.inter.ISqlDatabaseBean; -import com.yutou.utils.Log; +import com.alibaba.fastjson2.util.DateUtils; +import com.yutou.biliapi.bean.live.database.LiveConfigDatabaseBean; +import com.yutou.common.inter.ISqlDatabaseBean; +import com.yutou.common.utils.Log; import lombok.Data; import lombok.Getter; import java.io.File; import java.lang.reflect.Field; +import java.math.BigInteger; import java.sql.*; -import java.util.ArrayList; +import java.util.*; import java.util.Date; -import java.util.List; -import java.util.Set; public abstract class SQLiteManager { protected Connection conn; @@ -22,29 +24,34 @@ public abstract class SQLiteManager { private File sql; @Getter public BuildSql build; + public abstract String getFileName(); + public void init() { List data = getDataBean(); List items; List tables = new ArrayList<>(); for (AbsDatabasesBean bean : data) { - Field[] fields = bean.getClass().getDeclaredFields(); - items=new ArrayList<>(); + List fields = bean.getFields(); + items = new ArrayList<>(); for (Field field : fields) { String name = field.getAnnotation(JSONField.class).name(); - System.out.println(bean.getTableName()+" "+name); if (name.equals("tableName")) continue; String type = BuildSqlItem.TYPE_STRING; if (field.getType() == int.class) { type = BuildSqlItem.TYPE_INT; + } else if (field.getType() == long.class) { + type = BuildSqlItem.TYPE_LONG; } else if (field.getType() == String.class) { type = BuildSqlItem.TYPE_STRING; } else if (field.getType() == Date.class) { type = BuildSqlItem.TYPE_TIME; - }else if( field.getType() == boolean.class){ + } else if (field.getType() == boolean.class) { type = BuildSqlItem.TYPE_BOOLEAN; - }else if(field.getType() == ISqlDatabaseBean.class){ - type=BuildSqlItem.TYPE_TEXT; + } else if (field.getType() == ISqlDatabaseBean.class) { + type = BuildSqlItem.TYPE_TEXT; + } else if (field.getType() == BigInteger.class) { + type = BuildSqlItem.TYPE_INT; } items.add(BuildSqlItem.create().setName(name).setType(type).setNull(!"id".equals(name)).setKey("id".equals(name))); } @@ -98,10 +105,10 @@ public abstract class SQLiteManager { sb.append("INSERT INTO `").append(t.getTableName()).append("` "); sb.append("("); value.append("("); - JSONObject json=t.toJson(); + JSONObject json = t.toJson(); Set keySet = json.keySet(); for (String key : keySet) { - if("id".equals(key)) { + if ("id".equals(key)) { continue; } sb.append("`").append(key).append("`,"); @@ -115,32 +122,93 @@ public abstract class SQLiteManager { statement.executeUpdate(sb.toString()); statement.close(); } catch (SQLException e) { + e.printStackTrace(); throw new RuntimeException(e); } } + public void update(T t) { + try { + String id = DateUtils.format(t.getSql_time(), "yyyy-MM-dd HH:mm:ss.SSS"); + Statement statement = conn.createStatement(); + StringBuilder sb = new StringBuilder(); + sb.append("UPDATE `").append(t.getTableName()).append("` "); + sb.append("SET "); + JSONObject json = t.toJson(); + Set keySet = json.keySet(); + for (String key : keySet) { + if ("id".equals(key) || "sql_time".equals(key)) { + continue; + } + sb.append(" `").append(key).append("` = "); + if (json.get(key) instanceof String) { + sb.append("'").append(json.get(key)).append("', "); + } else { + sb.append(json.get(key)).append(", "); + } + } + sb.deleteCharAt(sb.length() - 2); + sb.append(" WHERE `sql_time` = ").append("'").append(id).append("'"); + statement.executeUpdate(sb.toString()); + statement.close(); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + + } + public List get(String table, Class tClass) { + return get(table, null, tClass); + } + + public List get(String table, String where, Class tClass) { List list = new ArrayList<>(); try { Statement statement = conn.createStatement(); String sql = "SELECT * FROM `" + table + "`"; + if (where != null) { + sql += " WHERE " + where; + } ResultSet resultSet = statement.executeQuery(sql); while (resultSet.next()) { JSONObject json = new JSONObject(); for (int i = 0; i < resultSet.getMetaData().getColumnCount(); i++) { String name = resultSet.getMetaData().getColumnName(i + 1); - json.put(name, resultSet.getObject(name)); + Object value = resultSet.getObject(name); + if (value instanceof String && ((String) value).startsWith("[")) { + json.put(name, JSON.parseArray((String) value)); + } else { + json.put(name, resultSet.getObject(name)); + } } list.add(json.to(tClass)); } resultSet.close(); statement.closeOnCompletion(); } catch (Exception e) { + e.printStackTrace(); throw new RuntimeException(e); } return list; } + protected boolean delete(T t) { + try { + String id = DateUtils.format(t.getSql_time(), "yyyy-MM-dd HH:mm:ss.SSS"); + Statement statement = conn.createStatement(); + StringBuilder sb = new StringBuilder(); + sb.append("DELETE FROM `").append(t.getTableName()).append("` "); + sb.append(" WHERE `sql_time` = ").append("'").append(id).append("'"); + int ret = statement.executeUpdate(sb.toString()); + statement.close(); + return ret != 0; + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + private void createSql(BuildSql build) { try { @@ -170,8 +238,9 @@ public abstract class SQLiteManager { for (BuildSqlItem item : items) { StringBuilder builder = new StringBuilder(); String type = switch (item.getType()) { - case "int" -> " INTEGER "; - case "TIME" -> " NUMERIC "; + case BuildSqlItem.TYPE_INT -> " INTEGER "; + case BuildSqlItem.TYPE_TIME, BuildSqlItem.TYPE_LONG -> " NUMERIC "; + case BuildSqlItem.TYPE_BOOLEAN -> " BOOLEAN "; default -> " TEXT "; }; builder.append("`") @@ -196,7 +265,11 @@ public abstract class SQLiteManager { try { this.build = buildSql; Class.forName("org.sqlite.JDBC"); - sql = new File("databases" + File.separator + buildSql.getFileName()); + if (buildSql.getFileName().startsWith(new File("").getAbsolutePath())) { + sql = new File(buildSql.getFileName()); + } else { + sql = new File("databases" + File.separator + buildSql.getFileName()); + } if (!sql.exists()) { createSql(buildSql); } else { @@ -228,7 +301,12 @@ public abstract class SQLiteManager { protected abstract List getDataBean(); public static void main(String[] args) { - + LiveConfigDatabaseBean bean = new LiveConfigDatabaseBean(); + bean.setRoomId(new BigInteger("123")); + bean.setRecordLive(true); + bean.setKeywordList(List.of("111", "22")); + JSONObject json = bean.toJson(); + System.out.println("json = " + json); } @Data @@ -283,11 +361,13 @@ public abstract class SQLiteManager { @Data public static class BuildSqlItem { - public static final String TYPE_INT = "int"; - public static final String TYPE_STRING = "String"; + public static final String TYPE_INT = "INTEGER"; + public static final String TYPE_LONG = "NUMERIC"; + public static final String TYPE_STRING = "TEXT"; public static final String TYPE_TIME = "TIME"; public static final String TYPE_BOOLEAN = "boolean"; public static final String TYPE_TEXT = "TEXT"; + public static final String TYPE_DATE = "DATE"; String name; diff --git a/common/src/main/java/com/yutou/inter/IHttpApiCheckCallback.java b/src/main/java/com/yutou/common/inter/IHttpApiCheckCallback.java similarity index 78% rename from common/src/main/java/com/yutou/inter/IHttpApiCheckCallback.java rename to src/main/java/com/yutou/common/inter/IHttpApiCheckCallback.java index 17a7588..76ab740 100644 --- a/common/src/main/java/com/yutou/inter/IHttpApiCheckCallback.java +++ b/src/main/java/com/yutou/common/inter/IHttpApiCheckCallback.java @@ -1,4 +1,4 @@ -package com.yutou.inter; +package com.yutou.common.inter; public interface IHttpApiCheckCallback { void onSuccess(T api); diff --git a/common/src/main/java/com/yutou/inter/ISqlDatabaseBean.java b/src/main/java/com/yutou/common/inter/ISqlDatabaseBean.java similarity index 65% rename from common/src/main/java/com/yutou/inter/ISqlDatabaseBean.java rename to src/main/java/com/yutou/common/inter/ISqlDatabaseBean.java index 50e510f..a7d9775 100644 --- a/common/src/main/java/com/yutou/inter/ISqlDatabaseBean.java +++ b/src/main/java/com/yutou/common/inter/ISqlDatabaseBean.java @@ -1,4 +1,4 @@ -package com.yutou.inter; +package com.yutou.common.inter; public interface ISqlDatabaseBean { String getJson(); diff --git a/common/src/main/java/com/yutou/okhttp/BaseBean.java b/src/main/java/com/yutou/common/okhttp/BaseBean.java similarity index 71% rename from common/src/main/java/com/yutou/okhttp/BaseBean.java rename to src/main/java/com/yutou/common/okhttp/BaseBean.java index ffca9c9..99c9937 100644 --- a/common/src/main/java/com/yutou/okhttp/BaseBean.java +++ b/src/main/java/com/yutou/common/okhttp/BaseBean.java @@ -1,4 +1,4 @@ -package com.yutou.okhttp; +package com.yutou.common.okhttp; import java.io.Serializable; diff --git a/common/src/main/java/com/yutou/okhttp/FileBody.java b/src/main/java/com/yutou/common/okhttp/FileBody.java similarity index 78% rename from common/src/main/java/com/yutou/okhttp/FileBody.java rename to src/main/java/com/yutou/common/okhttp/FileBody.java index f492250..21b70a6 100644 --- a/common/src/main/java/com/yutou/okhttp/FileBody.java +++ b/src/main/java/com/yutou/common/okhttp/FileBody.java @@ -1,4 +1,4 @@ -package com.yutou.okhttp; +package com.yutou.common.okhttp; import lombok.Data; diff --git a/common/src/main/java/com/yutou/okhttp/FileCallback.java b/src/main/java/com/yutou/common/okhttp/FileCallback.java similarity index 98% rename from common/src/main/java/com/yutou/okhttp/FileCallback.java rename to src/main/java/com/yutou/common/okhttp/FileCallback.java index edf0842..ae74f24 100644 --- a/common/src/main/java/com/yutou/okhttp/FileCallback.java +++ b/src/main/java/com/yutou/common/okhttp/FileCallback.java @@ -1,4 +1,4 @@ -package com.yutou.okhttp; +package com.yutou.common.okhttp; import okhttp3.Headers; import okhttp3.HttpUrl; diff --git a/common/src/main/java/com/yutou/okhttp/GetRequestParams.java b/src/main/java/com/yutou/common/okhttp/GetRequestParams.java similarity index 96% rename from common/src/main/java/com/yutou/okhttp/GetRequestParams.java rename to src/main/java/com/yutou/common/okhttp/GetRequestParams.java index c574f91..406fa0d 100644 --- a/common/src/main/java/com/yutou/okhttp/GetRequestParams.java +++ b/src/main/java/com/yutou/common/okhttp/GetRequestParams.java @@ -1,4 +1,4 @@ -package com.yutou.okhttp; +package com.yutou.common.okhttp; import okhttp3.Headers; diff --git a/common/src/main/java/com/yutou/okhttp/HttpBody.java b/src/main/java/com/yutou/common/okhttp/HttpBody.java similarity index 85% rename from common/src/main/java/com/yutou/okhttp/HttpBody.java rename to src/main/java/com/yutou/common/okhttp/HttpBody.java index 7d8588e..7c24c82 100644 --- a/common/src/main/java/com/yutou/okhttp/HttpBody.java +++ b/src/main/java/com/yutou/common/okhttp/HttpBody.java @@ -1,4 +1,4 @@ -package com.yutou.okhttp; +package com.yutou.common.okhttp; import lombok.Data; diff --git a/common/src/main/java/com/yutou/okhttp/HttpCallback.java b/src/main/java/com/yutou/common/okhttp/HttpCallback.java similarity index 96% rename from common/src/main/java/com/yutou/okhttp/HttpCallback.java rename to src/main/java/com/yutou/common/okhttp/HttpCallback.java index 147a502..ceee106 100644 --- a/common/src/main/java/com/yutou/okhttp/HttpCallback.java +++ b/src/main/java/com/yutou/common/okhttp/HttpCallback.java @@ -1,4 +1,4 @@ -package com.yutou.okhttp; +package com.yutou.common.okhttp; import okhttp3.Headers; import retrofit2.Call; diff --git a/src/main/java/com/yutou/common/okhttp/HttpDownloadUtils.java b/src/main/java/com/yutou/common/okhttp/HttpDownloadUtils.java new file mode 100644 index 0000000..37e9224 --- /dev/null +++ b/src/main/java/com/yutou/common/okhttp/HttpDownloadUtils.java @@ -0,0 +1,48 @@ +package com.yutou.common.okhttp; + +import com.yutou.common.utils.Log; +import okhttp3.*; +import org.jetbrains.annotations.NotNull; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; +import java.util.logging.Level; + +public class HttpDownloadUtils { + public static void download(String url, String path,String fileName) { + OkHttpClient okHttpClient = new OkHttpClient(); + Request request = new Request.Builder() + .get() + .url(url) + .build(); + Call call = okHttpClient.newCall(request); + call.enqueue(new Callback() { + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + + } + + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + InputStream inputStream = Objects.requireNonNull(response.body()).byteStream(); + File target = new File(path, fileName); + FileOutputStream fileOutputStream = new FileOutputStream(target); + + try { + byte[] buffer = new byte[2048]; + int len; + while ((len = inputStream.read(buffer)) != -1) { + fileOutputStream.write(buffer, 0, len); + } + fileOutputStream.flush(); + } catch (IOException e) { + Log.getLogger("download").log(Level.FINE, "download error:"+url, e); + } + + } + }); + } +} diff --git a/common/src/main/java/com/yutou/okhttp/HttpLoggingInterceptor.java b/src/main/java/com/yutou/common/okhttp/HttpLoggingInterceptor.java similarity index 98% rename from common/src/main/java/com/yutou/okhttp/HttpLoggingInterceptor.java rename to src/main/java/com/yutou/common/okhttp/HttpLoggingInterceptor.java index ac6e501..ca0f922 100644 --- a/common/src/main/java/com/yutou/okhttp/HttpLoggingInterceptor.java +++ b/src/main/java/com/yutou/common/okhttp/HttpLoggingInterceptor.java @@ -1,7 +1,7 @@ -package com.yutou.okhttp; +package com.yutou.common.okhttp; -import com.yutou.utils.Log; +import com.yutou.common.utils.Log; import okhttp3.*; import okhttp3.internal.http.HttpHeaders; import okio.Buffer; @@ -16,7 +16,7 @@ public class HttpLoggingInterceptor implements Interceptor { private static final Charset UTF8 = Charset.forName("UTF-8"); - private volatile Level printLevel = Level.NONE; + private volatile Level printLevel = Level.BODY; private java.util.logging.Level colorLevel; private Logger logger; diff --git a/common/src/main/java/com/yutou/okhttp/IRequestParam.java b/src/main/java/com/yutou/common/okhttp/IRequestParam.java similarity index 84% rename from common/src/main/java/com/yutou/okhttp/IRequestParam.java rename to src/main/java/com/yutou/common/okhttp/IRequestParam.java index c1ac1e5..96befcd 100644 --- a/common/src/main/java/com/yutou/okhttp/IRequestParam.java +++ b/src/main/java/com/yutou/common/okhttp/IRequestParam.java @@ -1,4 +1,4 @@ -package com.yutou.okhttp; +package com.yutou.common.okhttp; import okhttp3.Request; diff --git a/common/src/main/java/com/yutou/okhttp/ParamsContext.java b/src/main/java/com/yutou/common/okhttp/ParamsContext.java similarity index 97% rename from common/src/main/java/com/yutou/okhttp/ParamsContext.java rename to src/main/java/com/yutou/common/okhttp/ParamsContext.java index f964114..21ef4b8 100644 --- a/common/src/main/java/com/yutou/okhttp/ParamsContext.java +++ b/src/main/java/com/yutou/common/okhttp/ParamsContext.java @@ -1,4 +1,4 @@ -package com.yutou.okhttp; +package com.yutou.common.okhttp; import okhttp3.Request; diff --git a/common/src/main/java/com/yutou/okhttp/PostRequestParams.java b/src/main/java/com/yutou/common/okhttp/PostRequestParams.java similarity index 98% rename from common/src/main/java/com/yutou/okhttp/PostRequestParams.java rename to src/main/java/com/yutou/common/okhttp/PostRequestParams.java index 6145eaa..0a3c253 100644 --- a/common/src/main/java/com/yutou/okhttp/PostRequestParams.java +++ b/src/main/java/com/yutou/common/okhttp/PostRequestParams.java @@ -1,4 +1,4 @@ -package com.yutou.okhttp; +package com.yutou.common.okhttp; import com.alibaba.fastjson2.JSONObject; diff --git a/common/src/main/java/com/yutou/okhttp/api/BaseApi.java b/src/main/java/com/yutou/common/okhttp/api/BaseApi.java similarity index 93% rename from common/src/main/java/com/yutou/okhttp/api/BaseApi.java rename to src/main/java/com/yutou/common/okhttp/api/BaseApi.java index a52f0ba..ff82369 100644 --- a/common/src/main/java/com/yutou/okhttp/api/BaseApi.java +++ b/src/main/java/com/yutou/common/okhttp/api/BaseApi.java @@ -1,13 +1,13 @@ -package com.yutou.okhttp.api; +package com.yutou.common.okhttp.api; import com.alibaba.fastjson2.JSONObject; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.internal.bind.DateTypeAdapter; -import com.yutou.okhttp.HttpLoggingInterceptor; -import com.yutou.okhttp.ParamsContext; -import com.yutou.okhttp.converter.JsonCallAdapter; -import com.yutou.okhttp.converter.JsonConverterFactory; +import com.yutou.common.okhttp.HttpLoggingInterceptor; +import com.yutou.common.okhttp.ParamsContext; +import com.yutou.common.okhttp.converter.JsonCallAdapter; +import com.yutou.common.okhttp.converter.JsonConverterFactory; import okhttp3.*; import retrofit2.CallAdapter; import retrofit2.Converter; diff --git a/common/src/main/java/com/yutou/okhttp/converter/JsonCallAdapter.java b/src/main/java/com/yutou/common/okhttp/converter/JsonCallAdapter.java similarity index 91% rename from common/src/main/java/com/yutou/okhttp/converter/JsonCallAdapter.java rename to src/main/java/com/yutou/common/okhttp/converter/JsonCallAdapter.java index 8fe0ff9..1ebd9fa 100644 --- a/common/src/main/java/com/yutou/okhttp/converter/JsonCallAdapter.java +++ b/src/main/java/com/yutou/common/okhttp/converter/JsonCallAdapter.java @@ -1,4 +1,4 @@ -package com.yutou.okhttp.converter; +package com.yutou.common.okhttp.converter; import org.jetbrains.annotations.Nullable; import retrofit2.CallAdapter; diff --git a/common/src/main/java/com/yutou/okhttp/converter/JsonConverterFactory.java b/src/main/java/com/yutou/common/okhttp/converter/JsonConverterFactory.java similarity index 96% rename from common/src/main/java/com/yutou/okhttp/converter/JsonConverterFactory.java rename to src/main/java/com/yutou/common/okhttp/converter/JsonConverterFactory.java index c2d3a58..2efb991 100644 --- a/common/src/main/java/com/yutou/okhttp/converter/JsonConverterFactory.java +++ b/src/main/java/com/yutou/common/okhttp/converter/JsonConverterFactory.java @@ -1,4 +1,4 @@ -package com.yutou.okhttp.converter; +package com.yutou.common.okhttp.converter; import com.google.gson.Gson; import com.google.gson.TypeAdapter; diff --git a/common/src/main/java/com/yutou/okhttp/converter/JsonRequestBodyConverter.java b/src/main/java/com/yutou/common/okhttp/converter/JsonRequestBodyConverter.java similarity index 96% rename from common/src/main/java/com/yutou/okhttp/converter/JsonRequestBodyConverter.java rename to src/main/java/com/yutou/common/okhttp/converter/JsonRequestBodyConverter.java index 6c7df58..47308dd 100644 --- a/common/src/main/java/com/yutou/okhttp/converter/JsonRequestBodyConverter.java +++ b/src/main/java/com/yutou/common/okhttp/converter/JsonRequestBodyConverter.java @@ -1,4 +1,4 @@ -package com.yutou.okhttp.converter; +package com.yutou.common.okhttp.converter; import com.google.gson.Gson; import com.google.gson.TypeAdapter; diff --git a/common/src/main/java/com/yutou/okhttp/converter/JsonResponseBodyConverter.java b/src/main/java/com/yutou/common/okhttp/converter/JsonResponseBodyConverter.java similarity index 92% rename from common/src/main/java/com/yutou/okhttp/converter/JsonResponseBodyConverter.java rename to src/main/java/com/yutou/common/okhttp/converter/JsonResponseBodyConverter.java index 7469e22..de5b176 100644 --- a/common/src/main/java/com/yutou/okhttp/converter/JsonResponseBodyConverter.java +++ b/src/main/java/com/yutou/common/okhttp/converter/JsonResponseBodyConverter.java @@ -1,11 +1,11 @@ -package com.yutou.okhttp.converter; +package com.yutou.common.okhttp.converter; import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONReader; import com.google.gson.Gson; import com.google.gson.TypeAdapter; -import com.yutou.okhttp.FileBody; -import com.yutou.okhttp.HttpBody; +import com.yutou.common.okhttp.FileBody; +import com.yutou.common.okhttp.HttpBody; import okhttp3.ResponseBody; import org.jetbrains.annotations.Nullable; import retrofit2.Converter; diff --git a/common/src/main/java/com/yutou/utils/AppTools.java b/src/main/java/com/yutou/common/utils/AppTools.java similarity index 99% rename from common/src/main/java/com/yutou/utils/AppTools.java rename to src/main/java/com/yutou/common/utils/AppTools.java index 1f44dfd..7306292 100644 --- a/common/src/main/java/com/yutou/utils/AppTools.java +++ b/src/main/java/com/yutou/common/utils/AppTools.java @@ -1,4 +1,4 @@ -package com.yutou.utils; +package com.yutou.common.utils; import jakarta.servlet.http.Cookie; import jakarta.servlet.http.HttpServletRequest; diff --git a/common/src/main/java/com/yutou/utils/Base64Tools.java b/src/main/java/com/yutou/common/utils/Base64Tools.java similarity index 96% rename from common/src/main/java/com/yutou/utils/Base64Tools.java rename to src/main/java/com/yutou/common/utils/Base64Tools.java index 4b9cafd..6c80e6b 100644 --- a/common/src/main/java/com/yutou/utils/Base64Tools.java +++ b/src/main/java/com/yutou/common/utils/Base64Tools.java @@ -1,4 +1,5 @@ -package com.yutou.utils; +package com.yutou.common.utils; + import java.io.File; import java.io.IOException; diff --git a/common/src/main/java/com/yutou/utils/ConfigTools.java b/src/main/java/com/yutou/common/utils/ConfigTools.java similarity index 98% rename from common/src/main/java/com/yutou/utils/ConfigTools.java rename to src/main/java/com/yutou/common/utils/ConfigTools.java index 4bbb231..039c890 100644 --- a/common/src/main/java/com/yutou/utils/ConfigTools.java +++ b/src/main/java/com/yutou/common/utils/ConfigTools.java @@ -1,4 +1,4 @@ -package com.yutou.utils; +package com.yutou.common.utils; import com.alibaba.fastjson2.JSONObject; diff --git a/common/src/main/java/com/yutou/utils/Log.java b/src/main/java/com/yutou/common/utils/Log.java similarity index 98% rename from common/src/main/java/com/yutou/utils/Log.java rename to src/main/java/com/yutou/common/utils/Log.java index f0becbf..83f04ec 100644 --- a/common/src/main/java/com/yutou/utils/Log.java +++ b/src/main/java/com/yutou/common/utils/Log.java @@ -1,4 +1,4 @@ -package com.yutou.utils; +package com.yutou.common.utils; import java.io.File; diff --git a/common/src/main/java/com/yutou/utils/RSAUtils.java b/src/main/java/com/yutou/common/utils/RSAUtils.java similarity index 99% rename from common/src/main/java/com/yutou/utils/RSAUtils.java rename to src/main/java/com/yutou/common/utils/RSAUtils.java index 7ff6826..b6ab8cc 100644 --- a/common/src/main/java/com/yutou/utils/RSAUtils.java +++ b/src/main/java/com/yutou/common/utils/RSAUtils.java @@ -1,4 +1,4 @@ -package com.yutou.utils; +package com.yutou.common.utils; import org.apache.commons.codec.binary.Base64; diff --git a/common/src/main/java/com/yutou/utils/RedisTools.java b/src/main/java/com/yutou/common/utils/RedisTools.java similarity index 97% rename from common/src/main/java/com/yutou/utils/RedisTools.java rename to src/main/java/com/yutou/common/utils/RedisTools.java index 16eeb9f..9f4b391 100644 --- a/common/src/main/java/com/yutou/utils/RedisTools.java +++ b/src/main/java/com/yutou/common/utils/RedisTools.java @@ -1,10 +1,8 @@ -package com.yutou.utils; +package com.yutou.common.utils; -import com.alibaba.fastjson2.JSONObject; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig; -import redis.clients.jedis.JedisPubSub; import java.io.IOException; import java.io.InputStream; @@ -29,7 +27,7 @@ public class RedisTools { //Properties properties = PropertyUtil.loadProperties("jedis.properties"); //host = properties.getProperty("redis.host"); //port = Integer.valueOf(properties.getProperty("redis.port")); - host = "172.22.81.254"; + host = "127.0.0.1"; port = 6379; } diff --git a/qqbot/src/main/java/com/yutou/napcat/NapCatQQ.java b/src/main/java/com/yutou/qqbot/NapCatQQ.java similarity index 87% rename from qqbot/src/main/java/com/yutou/napcat/NapCatQQ.java rename to src/main/java/com/yutou/qqbot/NapCatQQ.java index f1cf592..62dbffd 100644 --- a/qqbot/src/main/java/com/yutou/napcat/NapCatQQ.java +++ b/src/main/java/com/yutou/qqbot/NapCatQQ.java @@ -1,10 +1,11 @@ -package com.yutou.napcat; +package com.yutou.qqbot; -import com.yutou.napcat.handle.MessageHandleBuild; -import com.yutou.napcat.handle.Text; -import com.yutou.napcat.http.NapCatApi; -import com.yutou.napcat.model.SendMessageResponse; -import com.yutou.okhttp.HttpCallback; +import com.yutou.qqbot.handle.MessageHandleBuild; +import com.yutou.qqbot.handle.Text; +import com.yutou.qqbot.http.NapCatApi; +import com.yutou.qqbot.model.SendMessageResponse; +import com.yutou.common.okhttp.HttpCallback; +import com.yutou.common.utils.Base64Tools; import okhttp3.Headers; import java.io.File; @@ -26,6 +27,7 @@ public class NapCatQQ { list.add(new Text("5")); QQBotManager.getInstance().sendMessage(false, 891655174L, list);*/ NapCatApi.setLog(false); + Base64Tools.decode("111"); File file = new File("C:\\Users\\58381\\Downloads\\0074TT8Yly1hp5mqidwqeg30g20f27wh.gif"); NapCatApi.getMessageApi().sendPrivateMsg( MessageHandleBuild.create() diff --git a/qqbot/src/main/java/com/yutou/napcat/QQDatabase.java b/src/main/java/com/yutou/qqbot/QQDatabase.java similarity index 91% rename from qqbot/src/main/java/com/yutou/napcat/QQDatabase.java rename to src/main/java/com/yutou/qqbot/QQDatabase.java index 46e5e7d..56424b8 100644 --- a/qqbot/src/main/java/com/yutou/napcat/QQDatabase.java +++ b/src/main/java/com/yutou/qqbot/QQDatabase.java @@ -1,7 +1,7 @@ -package com.yutou.napcat; +package com.yutou.qqbot; -import com.yutou.napcat.model.FriendBean; -import com.yutou.napcat.model.GroupBean; +import com.yutou.qqbot.model.FriendBean; +import com.yutou.qqbot.model.GroupBean; import lombok.Getter; import lombok.Setter; diff --git a/qqbot/src/main/java/com/yutou/napcat/QQNumberManager.java b/src/main/java/com/yutou/qqbot/QQNumberManager.java similarity index 92% rename from qqbot/src/main/java/com/yutou/napcat/QQNumberManager.java rename to src/main/java/com/yutou/qqbot/QQNumberManager.java index 7799209..02ba398 100644 --- a/qqbot/src/main/java/com/yutou/napcat/QQNumberManager.java +++ b/src/main/java/com/yutou/qqbot/QQNumberManager.java @@ -1,20 +1,27 @@ -package com.yutou.napcat; +package com.yutou.qqbot; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; -import com.yutou.utils.RedisTools; +import com.yutou.common.utils.RedisTools; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; import redis.clients.jedis.Jedis; import java.util.ArrayList; import java.util.List; import java.util.Set; +@Controller public class QQNumberManager { - private static QQNumberManager manager; - private QQNumberManager(){ - + @ResponseBody + @RequestMapping("/bot/test") + public String test(){ + return "hello world"; } + private static QQNumberManager manager; + public static QQNumberManager getManager() { if(manager==null) { diff --git a/qqbot/src/main/java/com/yutou/napcat/enums/MessageEnum.java b/src/main/java/com/yutou/qqbot/enums/MessageEnum.java similarity index 94% rename from qqbot/src/main/java/com/yutou/napcat/enums/MessageEnum.java rename to src/main/java/com/yutou/qqbot/enums/MessageEnum.java index 9a93a93..10607cd 100644 --- a/qqbot/src/main/java/com/yutou/napcat/enums/MessageEnum.java +++ b/src/main/java/com/yutou/qqbot/enums/MessageEnum.java @@ -1,4 +1,4 @@ -package com.yutou.napcat.enums; +package com.yutou.qqbot.enums; public enum MessageEnum { TEXT("text"), diff --git a/qqbot/src/main/java/com/yutou/napcat/enums/RecordFormatEnum.java b/src/main/java/com/yutou/qqbot/enums/RecordFormatEnum.java similarity index 92% rename from qqbot/src/main/java/com/yutou/napcat/enums/RecordFormatEnum.java rename to src/main/java/com/yutou/qqbot/enums/RecordFormatEnum.java index 052fb0c..feb587f 100644 --- a/qqbot/src/main/java/com/yutou/napcat/enums/RecordFormatEnum.java +++ b/src/main/java/com/yutou/qqbot/enums/RecordFormatEnum.java @@ -1,4 +1,4 @@ -package com.yutou.napcat.enums; +package com.yutou.qqbot.enums; public enum RecordFormatEnum { MP3("mp3"), diff --git a/qqbot/src/main/java/com/yutou/napcat/event/GroupMessageEvent.java b/src/main/java/com/yutou/qqbot/event/GroupMessageEvent.java similarity index 66% rename from qqbot/src/main/java/com/yutou/napcat/event/GroupMessageEvent.java rename to src/main/java/com/yutou/qqbot/event/GroupMessageEvent.java index 0d4a9b6..45b6dfa 100644 --- a/qqbot/src/main/java/com/yutou/napcat/event/GroupMessageEvent.java +++ b/src/main/java/com/yutou/qqbot/event/GroupMessageEvent.java @@ -1,6 +1,6 @@ -package com.yutou.napcat.event; +package com.yutou.qqbot.event; -import com.yutou.napcat.model.GroupFrom; +import com.yutou.qqbot.model.GroupFrom; import lombok.Getter; import lombok.Setter; diff --git a/qqbot/src/main/java/com/yutou/napcat/event/MessageEvent.java b/src/main/java/com/yutou/qqbot/event/MessageEvent.java similarity index 96% rename from qqbot/src/main/java/com/yutou/napcat/event/MessageEvent.java rename to src/main/java/com/yutou/qqbot/event/MessageEvent.java index 977db2b..e6a4787 100644 --- a/qqbot/src/main/java/com/yutou/napcat/event/MessageEvent.java +++ b/src/main/java/com/yutou/qqbot/event/MessageEvent.java @@ -1,12 +1,12 @@ -package com.yutou.napcat.event; +package com.yutou.qqbot.event; import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.napcat.QQDatabase; -import com.yutou.napcat.enums.MessageEnum; -import com.yutou.napcat.handle.*; -import com.yutou.napcat.model.SourceFrom; +import com.yutou.qqbot.QQDatabase; +import com.yutou.qqbot.enums.MessageEnum; +import com.yutou.qqbot.handle.*; +import com.yutou.qqbot.model.SourceFrom; import lombok.Data; import lombok.val; diff --git a/qqbot/src/main/java/com/yutou/napcat/handle/At.java b/src/main/java/com/yutou/qqbot/handle/At.java similarity index 87% rename from qqbot/src/main/java/com/yutou/napcat/handle/At.java rename to src/main/java/com/yutou/qqbot/handle/At.java index 866f6fb..9cb87ba 100644 --- a/qqbot/src/main/java/com/yutou/napcat/handle/At.java +++ b/src/main/java/com/yutou/qqbot/handle/At.java @@ -1,6 +1,6 @@ -package com.yutou.napcat.handle; +package com.yutou.qqbot.handle; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; public class At extends BaseHandle { diff --git a/qqbot/src/main/java/com/yutou/napcat/handle/BaseHandle.java b/src/main/java/com/yutou/qqbot/handle/BaseHandle.java similarity index 82% rename from qqbot/src/main/java/com/yutou/napcat/handle/BaseHandle.java rename to src/main/java/com/yutou/qqbot/handle/BaseHandle.java index 376a6a5..15a986f 100644 --- a/qqbot/src/main/java/com/yutou/napcat/handle/BaseHandle.java +++ b/src/main/java/com/yutou/qqbot/handle/BaseHandle.java @@ -1,6 +1,6 @@ -package com.yutou.napcat.handle; +package com.yutou.qqbot.handle; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; @Data diff --git a/qqbot/src/main/java/com/yutou/napcat/handle/Image.java b/src/main/java/com/yutou/qqbot/handle/Image.java similarity index 90% rename from qqbot/src/main/java/com/yutou/napcat/handle/Image.java rename to src/main/java/com/yutou/qqbot/handle/Image.java index ab035bf..799426c 100644 --- a/qqbot/src/main/java/com/yutou/napcat/handle/Image.java +++ b/src/main/java/com/yutou/qqbot/handle/Image.java @@ -1,7 +1,7 @@ -package com.yutou.napcat.handle; +package com.yutou.qqbot.handle; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.utils.Base64Tools; +import com.yutou.common.utils.Base64Tools; import lombok.Data; import java.io.File; diff --git a/qqbot/src/main/java/com/yutou/napcat/handle/MessageHandleBuild.java b/src/main/java/com/yutou/qqbot/handle/MessageHandleBuild.java similarity index 97% rename from qqbot/src/main/java/com/yutou/napcat/handle/MessageHandleBuild.java rename to src/main/java/com/yutou/qqbot/handle/MessageHandleBuild.java index 9486daa..52ea92e 100644 --- a/qqbot/src/main/java/com/yutou/napcat/handle/MessageHandleBuild.java +++ b/src/main/java/com/yutou/qqbot/handle/MessageHandleBuild.java @@ -1,4 +1,4 @@ -package com.yutou.napcat.handle; +package com.yutou.qqbot.handle; import com.alibaba.fastjson2.JSONObject; diff --git a/qqbot/src/main/java/com/yutou/napcat/handle/OtherHandle.java b/src/main/java/com/yutou/qqbot/handle/OtherHandle.java similarity index 76% rename from qqbot/src/main/java/com/yutou/napcat/handle/OtherHandle.java rename to src/main/java/com/yutou/qqbot/handle/OtherHandle.java index 800c8b6..ff2f038 100644 --- a/qqbot/src/main/java/com/yutou/napcat/handle/OtherHandle.java +++ b/src/main/java/com/yutou/qqbot/handle/OtherHandle.java @@ -1,6 +1,6 @@ -package com.yutou.napcat.handle; +package com.yutou.qqbot.handle; -import com.yutou.napcat.model.AppShareBean; +import com.yutou.qqbot.model.AppShareBean; import lombok.Data; public class OtherHandle extends BaseHandle{ diff --git a/qqbot/src/main/java/com/yutou/napcat/handle/QuoteReply.java b/src/main/java/com/yutou/qqbot/handle/QuoteReply.java similarity index 88% rename from qqbot/src/main/java/com/yutou/napcat/handle/QuoteReply.java rename to src/main/java/com/yutou/qqbot/handle/QuoteReply.java index cab5cad..e2bf238 100644 --- a/qqbot/src/main/java/com/yutou/napcat/handle/QuoteReply.java +++ b/src/main/java/com/yutou/qqbot/handle/QuoteReply.java @@ -1,4 +1,4 @@ -package com.yutou.napcat.handle; +package com.yutou.qqbot.handle; public class QuoteReply { private final String messageId; diff --git a/qqbot/src/main/java/com/yutou/napcat/handle/Record.java b/src/main/java/com/yutou/qqbot/handle/Record.java similarity index 89% rename from qqbot/src/main/java/com/yutou/napcat/handle/Record.java rename to src/main/java/com/yutou/qqbot/handle/Record.java index bec8dfd..128acce 100644 --- a/qqbot/src/main/java/com/yutou/napcat/handle/Record.java +++ b/src/main/java/com/yutou/qqbot/handle/Record.java @@ -1,6 +1,6 @@ -package com.yutou.napcat.handle; +package com.yutou.qqbot.handle; -import com.yutou.utils.ConfigTools; +import com.yutou.common.utils.ConfigTools; import lombok.Data; public class Record extends BaseHandle { diff --git a/qqbot/src/main/java/com/yutou/napcat/handle/Reply.java b/src/main/java/com/yutou/qqbot/handle/Reply.java similarity index 91% rename from qqbot/src/main/java/com/yutou/napcat/handle/Reply.java rename to src/main/java/com/yutou/qqbot/handle/Reply.java index 76aaedc..eec90cd 100644 --- a/qqbot/src/main/java/com/yutou/napcat/handle/Reply.java +++ b/src/main/java/com/yutou/qqbot/handle/Reply.java @@ -1,4 +1,4 @@ -package com.yutou.napcat.handle; +package com.yutou.qqbot.handle; import lombok.Data; diff --git a/qqbot/src/main/java/com/yutou/napcat/handle/Text.java b/src/main/java/com/yutou/qqbot/handle/Text.java similarity index 96% rename from qqbot/src/main/java/com/yutou/napcat/handle/Text.java rename to src/main/java/com/yutou/qqbot/handle/Text.java index db82d5c..7a0245d 100644 --- a/qqbot/src/main/java/com/yutou/napcat/handle/Text.java +++ b/src/main/java/com/yutou/qqbot/handle/Text.java @@ -1,4 +1,4 @@ -package com.yutou.napcat.handle; +package com.yutou.qqbot.handle; import lombok.Data; diff --git a/qqbot/src/main/java/com/yutou/napcat/http/FriendApi.java b/src/main/java/com/yutou/qqbot/http/FriendApi.java similarity index 63% rename from qqbot/src/main/java/com/yutou/napcat/http/FriendApi.java rename to src/main/java/com/yutou/qqbot/http/FriendApi.java index 324da72..ed61450 100644 --- a/qqbot/src/main/java/com/yutou/napcat/http/FriendApi.java +++ b/src/main/java/com/yutou/qqbot/http/FriendApi.java @@ -1,7 +1,7 @@ -package com.yutou.napcat.http; +package com.yutou.qqbot.http; -import com.yutou.napcat.model.FriendBean; -import com.yutou.okhttp.HttpBody; +import com.yutou.qqbot.model.FriendBean; +import com.yutou.common.okhttp.HttpBody; import retrofit2.Call; import retrofit2.http.POST; diff --git a/qqbot/src/main/java/com/yutou/napcat/http/GroupApi.java b/src/main/java/com/yutou/qqbot/http/GroupApi.java similarity index 87% rename from qqbot/src/main/java/com/yutou/napcat/http/GroupApi.java rename to src/main/java/com/yutou/qqbot/http/GroupApi.java index 1901c9c..b6e79aa 100644 --- a/qqbot/src/main/java/com/yutou/napcat/http/GroupApi.java +++ b/src/main/java/com/yutou/qqbot/http/GroupApi.java @@ -1,9 +1,9 @@ -package com.yutou.napcat.http; +package com.yutou.qqbot.http; -import com.yutou.napcat.model.GroupBean; -import com.yutou.napcat.model.GroupUserBean; -import com.yutou.okhttp.BaseBean; -import com.yutou.okhttp.HttpBody; +import com.yutou.qqbot.model.GroupBean; +import com.yutou.qqbot.model.GroupUserBean; +import com.yutou.common.okhttp.BaseBean; +import com.yutou.common.okhttp.HttpBody; import retrofit2.Call; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; diff --git a/qqbot/src/main/java/com/yutou/napcat/http/MessageAPI.java b/src/main/java/com/yutou/qqbot/http/MessageAPI.java similarity index 79% rename from qqbot/src/main/java/com/yutou/napcat/http/MessageAPI.java rename to src/main/java/com/yutou/qqbot/http/MessageAPI.java index 2986cc1..ec685c6 100644 --- a/qqbot/src/main/java/com/yutou/napcat/http/MessageAPI.java +++ b/src/main/java/com/yutou/qqbot/http/MessageAPI.java @@ -1,10 +1,10 @@ -package com.yutou.napcat.http; +package com.yutou.qqbot.http; import com.alibaba.fastjson2.JSONObject; -import com.yutou.napcat.model.MessageBean; -import com.yutou.napcat.model.SendMessageResponse; -import com.yutou.okhttp.BaseBean; -import com.yutou.okhttp.HttpBody; +import com.yutou.qqbot.model.MessageBean; +import com.yutou.qqbot.model.SendMessageResponse; +import com.yutou.common.okhttp.BaseBean; +import com.yutou.common.okhttp.HttpBody; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.Field; @@ -14,7 +14,7 @@ import retrofit2.http.POST; public interface MessageAPI { /** * 发送私聊消息 - * @param message {@link com.yutou.napcat.handle.MessageHandleBuild} + * @param message {@link com.yutou.qqbot.handle.MessageHandleBuild} * @return 消息id */ @POST("/send_private_msg") diff --git a/qqbot/src/main/java/com/yutou/napcat/http/NapCatApi.java b/src/main/java/com/yutou/qqbot/http/NapCatApi.java similarity index 82% rename from qqbot/src/main/java/com/yutou/napcat/http/NapCatApi.java rename to src/main/java/com/yutou/qqbot/http/NapCatApi.java index 85287de..70b7946 100644 --- a/qqbot/src/main/java/com/yutou/napcat/http/NapCatApi.java +++ b/src/main/java/com/yutou/qqbot/http/NapCatApi.java @@ -1,8 +1,8 @@ -package com.yutou.napcat.http; +package com.yutou.qqbot.http; -import com.yutou.okhttp.HttpLoggingInterceptor; -import com.yutou.okhttp.api.BaseApi; -import com.yutou.utils.ConfigTools; +import com.yutou.common.okhttp.HttpLoggingInterceptor; +import com.yutou.common.okhttp.api.BaseApi; +import com.yutou.common.utils.ConfigTools; public class NapCatApi extends BaseApi { private static final String URL; diff --git a/qqbot/src/main/java/com/yutou/napcat/http/UtilsApi.java b/src/main/java/com/yutou/qqbot/http/UtilsApi.java similarity index 88% rename from qqbot/src/main/java/com/yutou/napcat/http/UtilsApi.java rename to src/main/java/com/yutou/qqbot/http/UtilsApi.java index 63a0ab7..7997de0 100644 --- a/qqbot/src/main/java/com/yutou/napcat/http/UtilsApi.java +++ b/src/main/java/com/yutou/qqbot/http/UtilsApi.java @@ -1,8 +1,8 @@ -package com.yutou.napcat.http; +package com.yutou.qqbot.http; -import com.yutou.napcat.model.*; -import com.yutou.okhttp.BaseBean; -import com.yutou.okhttp.HttpBody; +import com.yutou.qqbot.model.*; +import com.yutou.common.okhttp.BaseBean; +import com.yutou.common.okhttp.HttpBody; import retrofit2.Call; import retrofit2.http.Field; import retrofit2.http.FormUrlEncoded; @@ -13,7 +13,7 @@ public interface UtilsApi { * 获取语音 * * @param fileId 收到的语音文件名(消息段的 file 参数),如 0B38145AA44505000B38145AA4450500.silk - * @param format 要转换到的格式,目前支持 mp3、amr、wma、m4a、spx、ogg、wav、flac {@link com.yutou.napcat.enums.RecordFormatEnum} + * @param format 要转换到的格式,目前支持 mp3、amr、wma、m4a、spx、ogg、wav、flac {@link com.yutou.qqbot.enums.RecordFormatEnum} * @return 转换后的语音文件路径 */ @FormUrlEncoded diff --git a/qqbot/src/main/java/com/yutou/napcat/model/AppShareBean.java b/src/main/java/com/yutou/qqbot/model/AppShareBean.java similarity index 97% rename from qqbot/src/main/java/com/yutou/napcat/model/AppShareBean.java rename to src/main/java/com/yutou/qqbot/model/AppShareBean.java index b6da655..e61de10 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/AppShareBean.java +++ b/src/main/java/com/yutou/qqbot/model/AppShareBean.java @@ -1,7 +1,7 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; import java.util.Map; diff --git a/qqbot/src/main/java/com/yutou/napcat/model/CheckSendImageBean.java b/src/main/java/com/yutou/qqbot/model/CheckSendImageBean.java similarity index 72% rename from qqbot/src/main/java/com/yutou/napcat/model/CheckSendImageBean.java rename to src/main/java/com/yutou/qqbot/model/CheckSendImageBean.java index fe7823d..75932ac 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/CheckSendImageBean.java +++ b/src/main/java/com/yutou/qqbot/model/CheckSendImageBean.java @@ -1,7 +1,7 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; @Data diff --git a/qqbot/src/main/java/com/yutou/napcat/model/CheckSendRecordBean.java b/src/main/java/com/yutou/qqbot/model/CheckSendRecordBean.java similarity index 72% rename from qqbot/src/main/java/com/yutou/napcat/model/CheckSendRecordBean.java rename to src/main/java/com/yutou/qqbot/model/CheckSendRecordBean.java index 89b16ef..2696706 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/CheckSendRecordBean.java +++ b/src/main/java/com/yutou/qqbot/model/CheckSendRecordBean.java @@ -1,7 +1,7 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; @Data diff --git a/qqbot/src/main/java/com/yutou/napcat/model/FriendBean.java b/src/main/java/com/yutou/qqbot/model/FriendBean.java similarity index 81% rename from qqbot/src/main/java/com/yutou/napcat/model/FriendBean.java rename to src/main/java/com/yutou/qqbot/model/FriendBean.java index db53c52..9417d2d 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/FriendBean.java +++ b/src/main/java/com/yutou/qqbot/model/FriendBean.java @@ -1,7 +1,7 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; @Data diff --git a/qqbot/src/main/java/com/yutou/napcat/model/GroupBean.java b/src/main/java/com/yutou/qqbot/model/GroupBean.java similarity index 84% rename from qqbot/src/main/java/com/yutou/napcat/model/GroupBean.java rename to src/main/java/com/yutou/qqbot/model/GroupBean.java index 1d7c9ab..020de57 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/GroupBean.java +++ b/src/main/java/com/yutou/qqbot/model/GroupBean.java @@ -1,7 +1,7 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; @Data diff --git a/qqbot/src/main/java/com/yutou/napcat/model/GroupFrom.java b/src/main/java/com/yutou/qqbot/model/GroupFrom.java similarity index 70% rename from qqbot/src/main/java/com/yutou/napcat/model/GroupFrom.java rename to src/main/java/com/yutou/qqbot/model/GroupFrom.java index 1b3b278..43bb2c3 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/GroupFrom.java +++ b/src/main/java/com/yutou/qqbot/model/GroupFrom.java @@ -1,4 +1,4 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import lombok.Data; diff --git a/qqbot/src/main/java/com/yutou/napcat/model/GroupUserBean.java b/src/main/java/com/yutou/qqbot/model/GroupUserBean.java similarity index 95% rename from qqbot/src/main/java/com/yutou/napcat/model/GroupUserBean.java rename to src/main/java/com/yutou/qqbot/model/GroupUserBean.java index 9e20250..e8e00d9 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/GroupUserBean.java +++ b/src/main/java/com/yutou/qqbot/model/GroupUserBean.java @@ -1,7 +1,7 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; @Data diff --git a/qqbot/src/main/java/com/yutou/napcat/model/Message.java b/src/main/java/com/yutou/qqbot/model/Message.java similarity index 92% rename from qqbot/src/main/java/com/yutou/napcat/model/Message.java rename to src/main/java/com/yutou/qqbot/model/Message.java index 962a07d..f0bc8f4 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/Message.java +++ b/src/main/java/com/yutou/qqbot/model/Message.java @@ -1,4 +1,4 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import lombok.Data; diff --git a/qqbot/src/main/java/com/yutou/napcat/model/MessageBean.java b/src/main/java/com/yutou/qqbot/model/MessageBean.java similarity index 93% rename from qqbot/src/main/java/com/yutou/napcat/model/MessageBean.java rename to src/main/java/com/yutou/qqbot/model/MessageBean.java index df79626..b76d9e5 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/MessageBean.java +++ b/src/main/java/com/yutou/qqbot/model/MessageBean.java @@ -1,7 +1,7 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; /** diff --git a/qqbot/src/main/java/com/yutou/napcat/model/QQBotStatusBean.java b/src/main/java/com/yutou/qqbot/model/QQBotStatusBean.java similarity index 84% rename from qqbot/src/main/java/com/yutou/napcat/model/QQBotStatusBean.java rename to src/main/java/com/yutou/qqbot/model/QQBotStatusBean.java index 24b0498..dd342c1 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/QQBotStatusBean.java +++ b/src/main/java/com/yutou/qqbot/model/QQBotStatusBean.java @@ -1,7 +1,7 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; @Data diff --git a/qqbot/src/main/java/com/yutou/napcat/model/QQBotVersionBean.java b/src/main/java/com/yutou/qqbot/model/QQBotVersionBean.java similarity index 92% rename from qqbot/src/main/java/com/yutou/napcat/model/QQBotVersionBean.java rename to src/main/java/com/yutou/qqbot/model/QQBotVersionBean.java index 9ba668e..6355061 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/QQBotVersionBean.java +++ b/src/main/java/com/yutou/qqbot/model/QQBotVersionBean.java @@ -1,4 +1,4 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import com.alibaba.fastjson2.annotation.JSONField; import lombok.Data; diff --git a/qqbot/src/main/java/com/yutou/napcat/model/SendMessageRequest.java b/src/main/java/com/yutou/qqbot/model/SendMessageRequest.java similarity index 79% rename from qqbot/src/main/java/com/yutou/napcat/model/SendMessageRequest.java rename to src/main/java/com/yutou/qqbot/model/SendMessageRequest.java index feb73c7..0e46b6a 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/SendMessageRequest.java +++ b/src/main/java/com/yutou/qqbot/model/SendMessageRequest.java @@ -1,9 +1,9 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import com.alibaba.fastjson2.annotation.JSONField; import com.google.gson.annotations.SerializedName; -import com.yutou.napcat.handle.BaseHandle; -import com.yutou.okhttp.BaseBean; +import com.yutou.qqbot.handle.BaseHandle; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/qqbot/src/main/java/com/yutou/napcat/model/SendMessageResponse.java b/src/main/java/com/yutou/qqbot/model/SendMessageResponse.java similarity index 79% rename from qqbot/src/main/java/com/yutou/napcat/model/SendMessageResponse.java rename to src/main/java/com/yutou/qqbot/model/SendMessageResponse.java index c8b0df3..fed688e 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/SendMessageResponse.java +++ b/src/main/java/com/yutou/qqbot/model/SendMessageResponse.java @@ -1,7 +1,7 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/qqbot/src/main/java/com/yutou/napcat/model/SenderBean.java b/src/main/java/com/yutou/qqbot/model/SenderBean.java similarity index 85% rename from qqbot/src/main/java/com/yutou/napcat/model/SenderBean.java rename to src/main/java/com/yutou/qqbot/model/SenderBean.java index ffc1596..4c6fe51 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/SenderBean.java +++ b/src/main/java/com/yutou/qqbot/model/SenderBean.java @@ -1,7 +1,7 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import com.alibaba.fastjson2.annotation.JSONField; -import com.yutou.okhttp.BaseBean; +import com.yutou.common.okhttp.BaseBean; import lombok.Data; /** diff --git a/qqbot/src/main/java/com/yutou/napcat/model/SourceFrom.java b/src/main/java/com/yutou/qqbot/model/SourceFrom.java similarity index 90% rename from qqbot/src/main/java/com/yutou/napcat/model/SourceFrom.java rename to src/main/java/com/yutou/qqbot/model/SourceFrom.java index 0dc3553..6623e00 100644 --- a/qqbot/src/main/java/com/yutou/napcat/model/SourceFrom.java +++ b/src/main/java/com/yutou/qqbot/model/SourceFrom.java @@ -1,4 +1,4 @@ -package com.yutou.napcat.model; +package com.yutou.qqbot.model; import com.alibaba.fastjson2.annotation.JSONField; import lombok.Data; diff --git a/src/main/resources/mappers/BilibiliLiveDataDao.xml b/src/main/resources/mappers/BilibiliLiveDataDao.xml deleted file mode 100644 index 43ea14c..0000000 --- a/src/main/resources/mappers/BilibiliLiveDataDao.xml +++ /dev/null @@ -1,388 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - id, `uid`, roomid, `type`, msg, giftId, giftName, giftIndex, price, priceOfcommission, - subtime - - - - - delete from bilibili_live_data - where id = #{id,jdbcType=INTEGER} - - - delete from bilibili_live_data - - - - - - insert into bilibili_live_data (`uid`, roomid, `type`, - msg, giftId, giftName, - giftIndex, price, priceOfcommission, - subtime) - values (#{uid,jdbcType=INTEGER}, #{roomid,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR}, - #{msg,jdbcType=VARCHAR}, #{giftid,jdbcType=INTEGER}, #{giftname,jdbcType=VARCHAR}, - #{giftindex,jdbcType=INTEGER}, #{price,jdbcType=INTEGER}, #{priceofcommission,jdbcType=INTEGER}, - #{subtime,jdbcType=TIMESTAMP}) - - - insert into bilibili_live_data - - - `uid`, - - - roomid, - - - `type`, - - - msg, - - - giftId, - - - giftName, - - - giftIndex, - - - price, - - - priceOfcommission, - - - subtime, - - - - - #{uid,jdbcType=INTEGER}, - - - #{roomid,jdbcType=INTEGER}, - - - #{type,jdbcType=VARCHAR}, - - - #{msg,jdbcType=VARCHAR}, - - - #{giftid,jdbcType=INTEGER}, - - - #{giftname,jdbcType=VARCHAR}, - - - #{giftindex,jdbcType=INTEGER}, - - - #{price,jdbcType=INTEGER}, - - - #{priceofcommission,jdbcType=INTEGER}, - - - #{subtime,jdbcType=TIMESTAMP}, - - - - - - update bilibili_live_data - - - id = #{record.id,jdbcType=INTEGER}, - - - `uid` = #{record.uid,jdbcType=INTEGER}, - - - roomid = #{record.roomid,jdbcType=INTEGER}, - - - `type` = #{record.type,jdbcType=VARCHAR}, - - - msg = #{record.msg,jdbcType=VARCHAR}, - - - giftId = #{record.giftid,jdbcType=INTEGER}, - - - giftName = #{record.giftname,jdbcType=VARCHAR}, - - - giftIndex = #{record.giftindex,jdbcType=INTEGER}, - - - price = #{record.price,jdbcType=INTEGER}, - - - priceOfcommission = #{record.priceofcommission,jdbcType=INTEGER}, - - - subtime = #{record.subtime,jdbcType=TIMESTAMP}, - - - - - - - - update bilibili_live_data - set id = #{record.id,jdbcType=INTEGER}, - `uid` = #{record.uid,jdbcType=INTEGER}, - roomid = #{record.roomid,jdbcType=INTEGER}, - `type` = #{record.type,jdbcType=VARCHAR}, - msg = #{record.msg,jdbcType=VARCHAR}, - giftId = #{record.giftid,jdbcType=INTEGER}, - giftName = #{record.giftname,jdbcType=VARCHAR}, - giftIndex = #{record.giftindex,jdbcType=INTEGER}, - price = #{record.price,jdbcType=INTEGER}, - priceOfcommission = #{record.priceofcommission,jdbcType=INTEGER}, - subtime = #{record.subtime,jdbcType=TIMESTAMP} - - - - - - update bilibili_live_data - - - `uid` = #{uid,jdbcType=INTEGER}, - - - roomid = #{roomid,jdbcType=INTEGER}, - - - `type` = #{type,jdbcType=VARCHAR}, - - - msg = #{msg,jdbcType=VARCHAR}, - - - giftId = #{giftid,jdbcType=INTEGER}, - - - giftName = #{giftname,jdbcType=VARCHAR}, - - - giftIndex = #{giftindex,jdbcType=INTEGER}, - - - price = #{price,jdbcType=INTEGER}, - - - priceOfcommission = #{priceofcommission,jdbcType=INTEGER}, - - - subtime = #{subtime,jdbcType=TIMESTAMP}, - - - where id = #{id,jdbcType=INTEGER} - - - update bilibili_live_data - set `uid` = #{uid,jdbcType=INTEGER}, - roomid = #{roomid,jdbcType=INTEGER}, - `type` = #{type,jdbcType=VARCHAR}, - msg = #{msg,jdbcType=VARCHAR}, - giftId = #{giftid,jdbcType=INTEGER}, - giftName = #{giftname,jdbcType=VARCHAR}, - giftIndex = #{giftindex,jdbcType=INTEGER}, - price = #{price,jdbcType=INTEGER}, - priceOfcommission = #{priceofcommission,jdbcType=INTEGER}, - subtime = #{subtime,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=INTEGER} - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/mappers/BilibiliLiveInfoDao.xml b/src/main/resources/mappers/BilibiliLiveInfoDao.xml deleted file mode 100644 index a275b7b..0000000 --- a/src/main/resources/mappers/BilibiliLiveInfoDao.xml +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - id, roomid, popular, userIndex, vipUserIndex, giftUser, subtime - - - - - delete from bilibili_live_info - where id = #{id,jdbcType=INTEGER} - - - delete from bilibili_live_info - - - - - - insert into bilibili_live_info (roomid, popular, userIndex, - vipUserIndex, giftUser, subtime - ) - values (#{roomid,jdbcType=INTEGER}, #{popular,jdbcType=INTEGER}, #{userindex,jdbcType=INTEGER}, - #{vipuserindex,jdbcType=INTEGER}, #{giftuser,jdbcType=INTEGER}, #{subtime,jdbcType=TIMESTAMP} - ) - - - insert into bilibili_live_info - - - roomid, - - - popular, - - - userIndex, - - - vipUserIndex, - - - giftUser, - - - subtime, - - - - - #{roomid,jdbcType=INTEGER}, - - - #{popular,jdbcType=INTEGER}, - - - #{userindex,jdbcType=INTEGER}, - - - #{vipuserindex,jdbcType=INTEGER}, - - - #{giftuser,jdbcType=INTEGER}, - - - #{subtime,jdbcType=TIMESTAMP}, - - - - - - update bilibili_live_info - - - id = #{record.id,jdbcType=INTEGER}, - - - roomid = #{record.roomid,jdbcType=INTEGER}, - - - popular = #{record.popular,jdbcType=INTEGER}, - - - userIndex = #{record.userindex,jdbcType=INTEGER}, - - - vipUserIndex = #{record.vipuserindex,jdbcType=INTEGER}, - - - giftUser = #{record.giftuser,jdbcType=INTEGER}, - - - subtime = #{record.subtime,jdbcType=TIMESTAMP}, - - - - - - - - update bilibili_live_info - set id = #{record.id,jdbcType=INTEGER}, - roomid = #{record.roomid,jdbcType=INTEGER}, - popular = #{record.popular,jdbcType=INTEGER}, - userIndex = #{record.userindex,jdbcType=INTEGER}, - vipUserIndex = #{record.vipuserindex,jdbcType=INTEGER}, - giftUser = #{record.giftuser,jdbcType=INTEGER}, - subtime = #{record.subtime,jdbcType=TIMESTAMP} - - - - - - update bilibili_live_info - - - roomid = #{roomid,jdbcType=INTEGER}, - - - popular = #{popular,jdbcType=INTEGER}, - - - userIndex = #{userindex,jdbcType=INTEGER}, - - - vipUserIndex = #{vipuserindex,jdbcType=INTEGER}, - - - giftUser = #{giftuser,jdbcType=INTEGER}, - - - subtime = #{subtime,jdbcType=TIMESTAMP}, - - - where id = #{id,jdbcType=INTEGER} - - - update bilibili_live_info - set roomid = #{roomid,jdbcType=INTEGER}, - popular = #{popular,jdbcType=INTEGER}, - userIndex = #{userindex,jdbcType=INTEGER}, - vipUserIndex = #{vipuserindex,jdbcType=INTEGER}, - giftUser = #{giftuser,jdbcType=INTEGER}, - subtime = #{subtime,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=INTEGER} - - - - \ No newline at end of file diff --git a/src/main/resources/mappers/BilibiliUpInfoDao.xml b/src/main/resources/mappers/BilibiliUpInfoDao.xml deleted file mode 100644 index 2ec2e6f..0000000 --- a/src/main/resources/mappers/BilibiliUpInfoDao.xml +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - id, `name`, url, mid, roomid, offlineListening, saveDanmu, `enable`, live, saveLive - - - - - delete from bilibili_up_info - where id = #{id,jdbcType=INTEGER} - - - delete from bilibili_up_info - - - - - - insert into bilibili_up_info (`name`, url, mid, - roomid, offlineListening, saveDanmu, - `enable`, live, saveLive - ) - values (#{name,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{mid,jdbcType=INTEGER}, - #{roomid,jdbcType=INTEGER}, #{offlinelistening,jdbcType=INTEGER}, #{savedanmu,jdbcType=INTEGER}, - #{enable,jdbcType=INTEGER}, #{live,jdbcType=INTEGER}, #{savelive,jdbcType=INTEGER} - ) - - - insert into bilibili_up_info - - - `name`, - - - url, - - - mid, - - - roomid, - - - offlineListening, - - - saveDanmu, - - - `enable`, - - - live, - - - saveLive, - - - - - #{name,jdbcType=VARCHAR}, - - - #{url,jdbcType=VARCHAR}, - - - #{mid,jdbcType=INTEGER}, - - - #{roomid,jdbcType=INTEGER}, - - - #{offlinelistening,jdbcType=INTEGER}, - - - #{savedanmu,jdbcType=INTEGER}, - - - #{enable,jdbcType=INTEGER}, - - - #{live,jdbcType=INTEGER}, - - - #{savelive,jdbcType=INTEGER}, - - - - - - update bilibili_up_info - - - id = #{record.id,jdbcType=INTEGER}, - - - `name` = #{record.name,jdbcType=VARCHAR}, - - - url = #{record.url,jdbcType=VARCHAR}, - - - mid = #{record.mid,jdbcType=INTEGER}, - - - roomid = #{record.roomid,jdbcType=INTEGER}, - - - offlineListening = #{record.offlinelistening,jdbcType=INTEGER}, - - - saveDanmu = #{record.savedanmu,jdbcType=INTEGER}, - - - `enable` = #{record.enable,jdbcType=INTEGER}, - - - live = #{record.live,jdbcType=INTEGER}, - - - saveLive = #{record.savelive,jdbcType=INTEGER}, - - - - - - - - update bilibili_up_info - set id = #{record.id,jdbcType=INTEGER}, - `name` = #{record.name,jdbcType=VARCHAR}, - url = #{record.url,jdbcType=VARCHAR}, - mid = #{record.mid,jdbcType=INTEGER}, - roomid = #{record.roomid,jdbcType=INTEGER}, - offlineListening = #{record.offlinelistening,jdbcType=INTEGER}, - saveDanmu = #{record.savedanmu,jdbcType=INTEGER}, - `enable` = #{record.enable,jdbcType=INTEGER}, - live = #{record.live,jdbcType=INTEGER}, - saveLive = #{record.savelive,jdbcType=INTEGER} - - - - - - update bilibili_up_info - - - `name` = #{name,jdbcType=VARCHAR}, - - - url = #{url,jdbcType=VARCHAR}, - - - mid = #{mid,jdbcType=INTEGER}, - - - roomid = #{roomid,jdbcType=INTEGER}, - - - offlineListening = #{offlinelistening,jdbcType=INTEGER}, - - - saveDanmu = #{savedanmu,jdbcType=INTEGER}, - - - `enable` = #{enable,jdbcType=INTEGER}, - - - live = #{live,jdbcType=INTEGER}, - - - saveLive = #{savelive,jdbcType=INTEGER}, - - - where id = #{id,jdbcType=INTEGER} - - - update bilibili_up_info - set `name` = #{name,jdbcType=VARCHAR}, - url = #{url,jdbcType=VARCHAR}, - mid = #{mid,jdbcType=INTEGER}, - roomid = #{roomid,jdbcType=INTEGER}, - offlineListening = #{offlinelistening,jdbcType=INTEGER}, - saveDanmu = #{savedanmu,jdbcType=INTEGER}, - `enable` = #{enable,jdbcType=INTEGER}, - live = #{live,jdbcType=INTEGER}, - saveLive = #{savelive,jdbcType=INTEGER} - where id = #{id,jdbcType=INTEGER} - - - - - \ No newline at end of file diff --git a/src/main/resources/mappers/PermissionDao.xml b/src/main/resources/mappers/PermissionDao.xml deleted file mode 100644 index 034ced3..0000000 --- a/src/main/resources/mappers/PermissionDao.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - id, title, url - - - - - delete from permission - where id = #{id,jdbcType=INTEGER} - - - delete from permission - - - - - - insert into permission (title, url) - values (#{title,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}) - - - insert into permission - - - title, - - - url, - - - - - #{title,jdbcType=VARCHAR}, - - - #{url,jdbcType=VARCHAR}, - - - - - - update permission - - - id = #{record.id,jdbcType=INTEGER}, - - - title = #{record.title,jdbcType=VARCHAR}, - - - url = #{record.url,jdbcType=VARCHAR}, - - - - - - - - update permission - set id = #{record.id,jdbcType=INTEGER}, - title = #{record.title,jdbcType=VARCHAR}, - url = #{record.url,jdbcType=VARCHAR} - - - - - - update permission - - - title = #{title,jdbcType=VARCHAR}, - - - url = #{url,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=INTEGER} - - - update permission - set title = #{title,jdbcType=VARCHAR}, - url = #{url,jdbcType=VARCHAR} - where id = #{id,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/src/main/resources/mappers/SConfigDao.xml b/src/main/resources/mappers/SConfigDao.xml deleted file mode 100644 index 8b859d7..0000000 --- a/src/main/resources/mappers/SConfigDao.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - id, configKey, configValue - - - - - delete from s_config - where id = #{id,jdbcType=INTEGER} - - - delete from s_config - - - - - - insert into s_config (configKey, configValue) - values (#{configkey,jdbcType=VARCHAR}, #{configvalue,jdbcType=VARCHAR}) - - - insert into s_config - - - configKey, - - - configValue, - - - - - #{configkey,jdbcType=VARCHAR}, - - - #{configvalue,jdbcType=VARCHAR}, - - - - - - update s_config - - - id = #{record.id,jdbcType=INTEGER}, - - - configKey = #{record.configkey,jdbcType=VARCHAR}, - - - configValue = #{record.configvalue,jdbcType=VARCHAR}, - - - - - - - - update s_config - set id = #{record.id,jdbcType=INTEGER}, - configKey = #{record.configkey,jdbcType=VARCHAR}, - configValue = #{record.configvalue,jdbcType=VARCHAR} - - - - - - update s_config - - - configKey = #{configkey,jdbcType=VARCHAR}, - - - configValue = #{configvalue,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=INTEGER} - - - update s_config - set configKey = #{configkey,jdbcType=VARCHAR}, - configValue = #{configvalue,jdbcType=VARCHAR} - where id = #{id,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/src/main/resources/mappers/UBiliUpDao.xml b/src/main/resources/mappers/UBiliUpDao.xml deleted file mode 100644 index c7cbd58..0000000 --- a/src/main/resources/mappers/UBiliUpDao.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - id, `uid`, roomid - - - - - delete from u_bili_up - where id = #{id,jdbcType=INTEGER} - - - delete from u_bili_up - - - - - - insert into u_bili_up (`uid`, roomid) - values (#{uid,jdbcType=INTEGER}, #{roomid,jdbcType=INTEGER}) - - - insert into u_bili_up - - - `uid`, - - - roomid, - - - - - #{uid,jdbcType=INTEGER}, - - - #{roomid,jdbcType=INTEGER}, - - - - - - update u_bili_up - - - id = #{record.id,jdbcType=INTEGER}, - - - `uid` = #{record.uid,jdbcType=INTEGER}, - - - roomid = #{record.roomid,jdbcType=INTEGER}, - - - - - - - - update u_bili_up - set id = #{record.id,jdbcType=INTEGER}, - `uid` = #{record.uid,jdbcType=INTEGER}, - roomid = #{record.roomid,jdbcType=INTEGER} - - - - - - update u_bili_up - - - `uid` = #{uid,jdbcType=INTEGER}, - - - roomid = #{roomid,jdbcType=INTEGER}, - - - where id = #{id,jdbcType=INTEGER} - - - update u_bili_up - set `uid` = #{uid,jdbcType=INTEGER}, - roomid = #{roomid,jdbcType=INTEGER} - where id = #{id,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/src/main/resources/mappers/UUserDao.xml b/src/main/resources/mappers/UUserDao.xml deleted file mode 100644 index feda7af..0000000 --- a/src/main/resources/mappers/UUserDao.xml +++ /dev/null @@ -1,237 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - id, `user`, `password`, `power`, bili_cookie, loginToken, subtime - - - - - delete from u_user - where id = #{id,jdbcType=INTEGER} - - - delete from u_user - - - - - - insert into u_user (`user`, `password`, `power`, - bili_cookie, loginToken, subtime - ) - values (#{user,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{power,jdbcType=VARCHAR}, - #{biliCookie,jdbcType=VARCHAR}, #{logintoken,jdbcType=VARCHAR}, #{subtime,jdbcType=TIMESTAMP} - ) - - - insert into u_user - - - `user`, - - - `password`, - - - `power`, - - - bili_cookie, - - - loginToken, - - - subtime, - - - - - #{user,jdbcType=VARCHAR}, - - - #{password,jdbcType=VARCHAR}, - - - #{power,jdbcType=VARCHAR}, - - - #{biliCookie,jdbcType=VARCHAR}, - - - #{logintoken,jdbcType=VARCHAR}, - - - #{subtime,jdbcType=TIMESTAMP}, - - - - - - update u_user - - - id = #{record.id,jdbcType=INTEGER}, - - - `user` = #{record.user,jdbcType=VARCHAR}, - - - `password` = #{record.password,jdbcType=VARCHAR}, - - - `power` = #{record.power,jdbcType=VARCHAR}, - - - bili_cookie = #{record.biliCookie,jdbcType=VARCHAR}, - - - loginToken = #{record.logintoken,jdbcType=VARCHAR}, - - - subtime = #{record.subtime,jdbcType=TIMESTAMP}, - - - - - - - - update u_user - set id = #{record.id,jdbcType=INTEGER}, - `user` = #{record.user,jdbcType=VARCHAR}, - `password` = #{record.password,jdbcType=VARCHAR}, - `power` = #{record.power,jdbcType=VARCHAR}, - bili_cookie = #{record.biliCookie,jdbcType=VARCHAR}, - loginToken = #{record.logintoken,jdbcType=VARCHAR}, - subtime = #{record.subtime,jdbcType=TIMESTAMP} - - - - - - update u_user - - - `user` = #{user,jdbcType=VARCHAR}, - - - `password` = #{password,jdbcType=VARCHAR}, - - - `power` = #{power,jdbcType=VARCHAR}, - - - bili_cookie = #{biliCookie,jdbcType=VARCHAR}, - - - loginToken = #{logintoken,jdbcType=VARCHAR}, - - - subtime = #{subtime,jdbcType=TIMESTAMP}, - - - where id = #{id,jdbcType=INTEGER} - - - update u_user - set `user` = #{user,jdbcType=VARCHAR}, - `password` = #{password,jdbcType=VARCHAR}, - `power` = #{power,jdbcType=VARCHAR}, - bili_cookie = #{biliCookie,jdbcType=VARCHAR}, - loginToken = #{logintoken,jdbcType=VARCHAR}, - subtime = #{subtime,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=INTEGER} - - \ No newline at end of file