Browse Source

feat: 重构模块

ageerle 2 tuần trước cách đây
mục cha
commit
2509099146
100 tập tin đã thay đổi với 68 bổ sung9629 xóa
  1. 14 0
      pom.xml
  2. 8 11
      ruoyi-common/pom.xml
  3. 0 13
      ruoyi-common/ruoyi-common-bom/pom.xml
  4. 14 31
      ruoyi-common/ruoyi-common-chat/pom.xml
  5. 3 0
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/config/properties/WebSocketProperties.java
  6. 0 73
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/ConsoleEventSourceListenerV2.java
  7. 0 92
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/ConsoleEventSourceListenerV3.java
  8. 0 417
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/PluginTest.java
  9. 0 24
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/WeatherPlugin.java
  10. 0 13
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/WeatherReq.java
  11. 0 15
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/WeatherResp.java
  12. 0 223
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/WebSearchToolsTest.java
  13. 0 75
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/domain/request/ChatRequest.java
  14. 0 33
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/domain/request/Dall3Request.java
  15. 0 2
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/handler/PlusWebSocketHandler.java
  16. 0 198
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/localModels/LocalModelsofitClient.java
  17. 0 25
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/localModels/SearchService.java
  18. 0 36
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/plugin/CmdPlugin.java
  19. 23 13
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/request/ChatRequest.java
  20. 0 1
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/sse/ConsoleEventSourceListener.java
  21. 0 1
      ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/sse/PluginListener.java
  22. 6 13
      ruoyi-common/ruoyi-common-core/pom.xml
  23. 0 49
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/pom.xml
  24. 0 32
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/constant/Constants.java
  25. 0 51
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/exception/BaseException.java
  26. 0 60
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/IBaseConnectionListener.java
  27. 0 149
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/IBaseMsgListener.java
  28. 0 46
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/IDanmuMsgListener.java
  29. 0 47
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/IEnterRoomMsgListener.java
  30. 0 47
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/IGiftMsgListener.java
  31. 0 46
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/ILikeMsgListener.java
  32. 0 47
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/ISuperChatMsgListener.java
  33. 0 33
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/BaseCmdMsg.java
  34. 0 74
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/BaseMsg.java
  35. 0 38
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/ICmdMsg.java
  36. 0 67
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/IDanmuMsg.java
  37. 0 62
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/IEnterRoomMsg.java
  38. 0 100
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/IGiftMsg.java
  39. 0 71
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/ILikeMsg.java
  40. 0 34
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/IMsg.java
  41. 0 49
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/ISuperChatMsg.java
  42. 0 55
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-client/pom.xml
  43. 0 200
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-client/src/main/java/tech/ordinaryroad/live/chat/client/commons/client/BaseLiveChatClient.java
  44. 0 135
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-client/src/main/java/tech/ordinaryroad/live/chat/client/commons/client/IBaseLiveChatClient.java
  45. 0 139
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-client/src/main/java/tech/ordinaryroad/live/chat/client/commons/client/config/BaseLiveChatClientConfig.java
  46. 0 83
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-client/src/main/java/tech/ordinaryroad/live/chat/client/commons/client/enums/ClientStatusEnums.java
  47. 0 25
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-util/pom.xml
  48. 0 80
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-util/src/main/java/tech/ordinaryroad/live/chat/client/commons/util/OrLiveChatCookieUtil.java
  49. 0 40
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-util/src/main/java/tech/ordinaryroad/live/chat/client/commons/util/OrLiveChatNumberUtil.java
  50. 0 50
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-util/src/main/java/tech/ordinaryroad/live/chat/client/commons/util/OrLiveChatReflectUtil.java
  51. 0 54
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-util/src/main/java/tech/ordinaryroad/live/chat/client/commons/util/OrLocalDateTimeUtil.java
  52. 0 44
      ruoyi-common/ruoyi-common-live/live-chat-client-commons/pom.xml
  53. 0 55
      ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty-client/pom.xml
  54. 0 349
      ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty-client/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/client/base/BaseNettyClient.java
  55. 0 65
      ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty-client/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/client/config/BaseNettyClientConfig.java
  56. 0 66
      ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty-client/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/client/handler/BaseNettyClientBinaryFrameHandler.java
  57. 0 65
      ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty-client/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/client/handler/BaseNettyClientConnectionHandler.java
  58. 0 59
      ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty/pom.xml
  59. 0 39
      ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/frame/base/BaseBinaryWebSocketFrame.java
  60. 0 184
      ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/handler/base/BaseBinaryFrameHandler.java
  61. 0 168
      ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/handler/base/BaseConnectionHandler.java
  62. 0 47
      ruoyi-common/ruoyi-common-live/live-chat-client-servers/pom.xml
  63. 0 71
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/pom.xml
  64. 0 247
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/api/BilibiliApis.java
  65. 0 74
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/api/request/BilibiliLikeReportV3Request.java
  66. 0 77
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/api/request/BilibiliSendMsgRequest.java
  67. 0 184
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/client/BilibiliLiveChatClient.java
  68. 0 67
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/config/BilibiliLiveChatClientConfig.java
  69. 0 143
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/constant/BilibiliCmdEnum.java
  70. 0 86
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/constant/OperationEnum.java
  71. 0 67
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/constant/ProtoverEnum.java
  72. 0 38
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/listener/IBilibiliConnectionListener.java
  73. 0 138
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/listener/IBilibiliMsgListener.java
  74. 0 92
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/AuthMsg.java
  75. 0 63
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/AuthReplyMsg.java
  76. 0 102
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/DanmuMsgMsg.java
  77. 0 58
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/HeartbeatMsg.java
  78. 0 60
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/HeartbeatReplyMsg.java
  79. 0 396
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/InteractWordMsg.java
  80. 0 158
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/LikeInfoV3ClickMsg.java
  81. 0 351
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/SendGiftMsg.java
  82. 0 81
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/SendSmsReplyMsg.java
  83. 0 202
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/SuperChatMessageMsg.java
  84. 0 68
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/base/BaseBilibiliCmdMsg.java
  85. 0 50
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/base/BaseBilibiliMsg.java
  86. 0 44
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/base/IBilibiliMsg.java
  87. 0 66
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/dto/MedalInfo.java
  88. 0 40
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/netty/frame/AuthWebSocketFrame.java
  89. 0 40
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/netty/frame/HeartbeatWebSocketFrame.java
  90. 0 54
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/netty/frame/base/BaseBilibiliWebSocketFrame.java
  91. 0 113
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/netty/frame/factory/BilibiliWebSocketFrameFactory.java
  92. 0 153
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/netty/handler/BilibiliBinaryFrameHandler.java
  93. 0 154
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/netty/handler/BilibiliConnectionHandler.java
  94. 0 78
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/protobuf/Dm_v2Proto.java
  95. 0 74
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/protobuf/Dm_v2_20Proto.java
  96. 0 610
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/protobuf/dm_v2.java
  97. 0 48
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/protobuf/dm_v2OrBuilder.java
  98. 0 565
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/protobuf/dm_v2_20.java
  99. 0 45
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/protobuf/dm_v2_20OrBuilder.java
  100. 0 259
      ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/util/BilibiliCodecUtil.java

+ 14 - 0
pom.xml

@@ -18,6 +18,7 @@
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
         <java.version>17</java.version>
+        <mysql.version>8.0.33</mysql.version>
         <spring-boot.mybatis>3.0.1</spring-boot.mybatis>
         <springdoc.version>2.1.0</springdoc.version>
         <therapi-javadoc.version>0.15.0</therapi-javadoc.version>
@@ -60,6 +61,7 @@
         <weixin-java-miniapp.version>4.5.0</weixin-java-miniapp.version>
         <weixin-java-pay.version>4.6.0</weixin-java-pay.version>
         <weixin-java-cp.version>4.6.0</weixin-java-cp.version>
+        <weixin-java-cp.version>4.6.0</weixin-java-cp.version>
     </properties>
 
     <profiles>
@@ -96,6 +98,12 @@
     <dependencyManagement>
         <dependencies>
 
+            <dependency>
+                <groupId>mysql</groupId>
+                <artifactId>mysql-connector-java</artifactId>
+                <version>${mysql.version}</version>
+            </dependency>
+
             <!-- SpringBoot的依赖配置-->
             <dependency>
                 <groupId>org.springframework.boot</groupId>
@@ -315,6 +323,12 @@
                 <version>${revision}</version>
             </dependency>
 
+            <dependency>
+                <groupId>org.ruoyi</groupId>
+                <artifactId>ruoyi-chat-api</artifactId>
+                <version>${revision}</version>
+            </dependency>
+
             <dependency>
                 <groupId>org.ruoyi</groupId>
                 <artifactId>ruoyi-system-api</artifactId>

+ 8 - 11
ruoyi-common/pom.xml

@@ -2,13 +2,20 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
     <parent>
         <artifactId>ruoyi-ai</artifactId>
         <groupId>org.ruoyi</groupId>
         <version>${revision}</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
-    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>ruoyi-common</artifactId>
+    <packaging>pom</packaging>
+
+    <description>
+        common 通用模块
+    </description>
 
     <modules>
         <module>ruoyi-common-bom</module>
@@ -32,16 +39,6 @@
         <module>ruoyi-common-encrypt</module>
         <module>ruoyi-common-tenant</module>
         <module>ruoyi-common-chat</module>
-        <module>ruoyi-common-pay</module>
-        <module>ruoyi-common-wechat</module>
-        <module>ruoyi-common-live</module>
     </modules>
 
-    <artifactId>ruoyi-common</artifactId>
-    <packaging>pom</packaging>
-
-    <description>
-        common 通用模块
-    </description>
-
 </project>

+ 0 - 13
ruoyi-common/ruoyi-common-bom/pom.xml

@@ -159,25 +159,12 @@
                 <version>${revision}</version>
             </dependency>
 
-            <!-- 微信模块 -->
-            <dependency>
-                <groupId>org.ruoyi</groupId>
-                <artifactId>ruoyi-common-wechat</artifactId>
-                <version>${revision}</version>
-            </dependency>
-
             <dependency>
                 <groupId>org.ruoyi</groupId>
                 <artifactId>ruoyi-chat</artifactId>
                 <version>${revision}</version>
             </dependency>
 
-            <!-- 支付模块 -->
-            <dependency>
-                <groupId>org.ruoyi</groupId>
-                <artifactId>ruoyi-common-pay</artifactId>
-                <version>${revision}</version>
-            </dependency>
         </dependencies>
 
     </dependencyManagement>

+ 14 - 31
ruoyi-common/ruoyi-common-chat/pom.xml

@@ -18,6 +18,10 @@
 
     <properties>
         <retrofit2.version>2.9.0</retrofit2.version>
+        <azure.version>1.0.0-beta.12</azure.version>
+        <chatglm.version>release-V4-2.3.0</chatglm.version>
+        <okhttp.version>2.7.5</okhttp.version>
+        <jtokkit.version>0.5.0</jtokkit.version>
     </properties>
 
     <dependencies>
@@ -26,38 +30,22 @@
             <artifactId>ruoyi-common-core</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <version>8.0.33</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.azure</groupId>
-            <artifactId>azure-ai-openai</artifactId>
-            <version>1.0.0-beta.12</version>
-        </dependency>
-
-        <dependency>
-            <groupId>io.github.ollama4j</groupId>
-            <artifactId>ollama4j</artifactId>
-            <version>1.0.79</version>
-        </dependency>
-
         <!-- 序列化模块 -->
         <dependency>
             <groupId>org.ruoyi</groupId>
             <artifactId>ruoyi-common-json</artifactId>
-            <version>1.0.0</version>
         </dependency>
 
+        <!-- redis模块 -->
         <dependency>
             <groupId>org.ruoyi</groupId>
             <artifactId>ruoyi-common-redis</artifactId>
         </dependency>
+
         <dependency>
-            <groupId>org.ruoyi</groupId>
-            <artifactId>ruoyi-common-satoken</artifactId>
+            <groupId>com.azure</groupId>
+            <artifactId>azure-ai-openai</artifactId>
+            <version>${azure.version}</version>
         </dependency>
 
         <dependency>
@@ -79,13 +67,7 @@
         <dependency>
             <groupId>com.knuddels</groupId>
             <artifactId>jtokkit</artifactId>
-            <version>0.5.0</version>
-        </dependency>
-
-        <dependency>
-            <groupId>cn.hutool</groupId>
-            <artifactId>hutool-all</artifactId>
-            <version>5.8.12</version>
+            <version>${jtokkit.version}</version>
         </dependency>
 
         <dependency>
@@ -102,13 +84,14 @@
         <dependency>
             <groupId>cn.bigmodel.openapi</groupId>
             <artifactId>oapi-java-sdk</artifactId>
-            <version>release-V4-2.3.0</version>
+            <version>${chatglm.version}</version>
         </dependency>
+
         <dependency>
             <groupId>com.squareup.okhttp</groupId>
             <artifactId>okhttp</artifactId>
-            <version>2.7.5</version>
-            <scope>compile</scope>
+            <version>${okhttp.version}</version>
         </dependency>
+
     </dependencies>
 </project>

+ 3 - 0
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/config/properties/WebSocketProperties.java

@@ -12,6 +12,9 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
 @Data
 public class WebSocketProperties {
 
+    /**
+     * 是否开启
+     */
     private Boolean enabled;
 
     /**

+ 0 - 73
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/ConsoleEventSourceListenerV2.java

@@ -1,73 +0,0 @@
-package org.ruoyi.common.chat.demo;
-
-import cn.hutool.json.JSONUtil;
-
-import lombok.Getter;
-import lombok.SneakyThrows;
-import lombok.extern.slf4j.Slf4j;
-import okhttp3.Response;
-import okhttp3.ResponseBody;
-import okhttp3.sse.EventSource;
-import okhttp3.sse.EventSourceListener;
-import org.ruoyi.common.chat.entity.chat.ChatCompletionResponse;
-
-import java.util.Objects;
-import java.util.concurrent.CountDownLatch;
-
-/**
- * 描述: sse
- *
- * @author https:www.unfbx.com
- * 2023-06-15
- */
-@Slf4j
-public class ConsoleEventSourceListenerV2 extends EventSourceListener {
-    @Getter
-    String args = "";
-    final CountDownLatch countDownLatch;
-
-    public ConsoleEventSourceListenerV2(CountDownLatch countDownLatch) {
-        this.countDownLatch = countDownLatch;
-    }
-
-    @Override
-    public void onOpen(EventSource eventSource, Response response) {
-        log.info("OpenAI建立sse连接...");
-    }
-
-    @Override
-    public void onEvent(EventSource eventSource, String id, String type, String data) {
-        log.info("OpenAI返回数据:{}", data);
-        if (data.equals("[DONE]")) {
-            log.info("OpenAI返回数据结束了");
-            countDownLatch.countDown();
-            return;
-        }
-        ChatCompletionResponse chatCompletionResponse = JSONUtil.toBean(data, ChatCompletionResponse.class);
-        if(Objects.nonNull(chatCompletionResponse.getChoices().get(0).getDelta().getFunctionCall())){
-            args += chatCompletionResponse.getChoices().get(0).getDelta().getFunctionCall().getArguments();
-        }
-    }
-
-    @Override
-    public void onClosed(EventSource eventSource) {
-        log.info("OpenAI关闭sse连接...");
-    }
-
-    @SneakyThrows
-    @Override
-    public void onFailure(EventSource eventSource, Throwable t, Response response) {
-        if(Objects.isNull(response)){
-            log.error("OpenAI  sse连接异常:{}", t);
-            eventSource.cancel();
-            return;
-        }
-        ResponseBody body = response.body();
-        if (Objects.nonNull(body)) {
-            log.error("OpenAI  sse连接异常data:{},异常:{}", body.string(), t);
-        } else {
-            log.error("OpenAI  sse连接异常data:{},异常:{}", response, t);
-        }
-        eventSource.cancel();
-    }
-}

+ 0 - 92
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/ConsoleEventSourceListenerV3.java

@@ -1,92 +0,0 @@
-package org.ruoyi.common.chat.demo;
-
-import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.json.JSONUtil;
-import lombok.Getter;
-import lombok.SneakyThrows;
-import lombok.extern.slf4j.Slf4j;
-import okhttp3.Response;
-import okhttp3.ResponseBody;
-import okhttp3.sse.EventSource;
-import okhttp3.sse.EventSourceListener;
-import org.ruoyi.common.chat.entity.chat.ChatCompletionResponse;
-import org.ruoyi.common.chat.entity.chat.Message;
-import org.ruoyi.common.chat.entity.chat.tool.ToolCallFunction;
-import org.ruoyi.common.chat.entity.chat.tool.ToolCalls;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.CountDownLatch;
-
-/**
- * 描述: demo测试实现类,仅供思路参考
- *
- * @author https:www.unfbx.com
- * 2023-11-12
- */
-@Slf4j
-public class ConsoleEventSourceListenerV3 extends EventSourceListener {
-    @Getter
-    List<ToolCalls> choices = new ArrayList<>();
-    @Getter
-    ToolCalls toolCalls = new ToolCalls();
-    @Getter
-    ToolCallFunction toolCallFunction = ToolCallFunction.builder().name("").arguments("").build();
-    final CountDownLatch countDownLatch;
-
-    public ConsoleEventSourceListenerV3(CountDownLatch countDownLatch) {
-        this.countDownLatch = countDownLatch;
-    }
-
-    @Override
-    public void onOpen(EventSource eventSource, Response response) {
-        log.info("OpenAI建立sse连接...");
-    }
-
-    @Override
-    public void onEvent(EventSource eventSource, String id, String type, String data) {
-        log.info("OpenAI返回数据:{}", data);
-        if (data.equals("[DONE]")) {
-            log.info("OpenAI返回数据结束了");
-            return;
-        }
-        ChatCompletionResponse chatCompletionResponse = JSONUtil.toBean(data, ChatCompletionResponse.class);
-        Message delta = chatCompletionResponse.getChoices().get(0).getDelta();
-        if (CollectionUtil.isNotEmpty(delta.getToolCalls())) {
-            choices.addAll(delta.getToolCalls());
-        }
-    }
-
-    @Override
-    public void onClosed(EventSource eventSource) {
-        if(CollectionUtil.isNotEmpty(choices)){
-            toolCalls.setId(choices.get(0).getId());
-            toolCalls.setType(choices.get(0).getType());
-            choices.forEach(e -> {
-                toolCallFunction.setName(e.getFunction().getName());
-                toolCallFunction.setArguments(toolCallFunction.getArguments() + e.getFunction().getArguments());
-                toolCalls.setFunction(toolCallFunction);
-            });
-        }
-        log.info("OpenAI关闭sse连接...");
-        countDownLatch.countDown();
-    }
-
-    @SneakyThrows
-    @Override
-    public void onFailure(EventSource eventSource, Throwable t, Response response) {
-        if(Objects.isNull(response)){
-            log.error("OpenAI  sse连接异常:{}", t);
-            eventSource.cancel();
-            return;
-        }
-        ResponseBody body = response.body();
-        if (Objects.nonNull(body)) {
-            log.error("OpenAI  sse连接异常data:{},异常:{}", body.string(), t);
-        } else {
-            log.error("OpenAI  sse连接异常data:{},异常:{}", response, t);
-        }
-        eventSource.cancel();
-    }
-}

+ 0 - 417
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/PluginTest.java

@@ -1,417 +0,0 @@
-package org.ruoyi.common.chat.demo;
-
-import cn.hutool.json.JSONUtil;
-import com.alibaba.fastjson.JSONObject;
-import lombok.Builder;
-import lombok.Data;
-import lombok.extern.slf4j.Slf4j;
-import okhttp3.OkHttpClient;
-import okhttp3.logging.HttpLoggingInterceptor;
-import org.junit.Before;
-import org.junit.Test;
-import org.ruoyi.common.chat.entity.chat.*;
-import org.ruoyi.common.chat.entity.chat.tool.ToolCallFunction;
-import org.ruoyi.common.chat.entity.chat.tool.ToolCalls;
-import org.ruoyi.common.chat.entity.chat.tool.Tools;
-import org.ruoyi.common.chat.entity.chat.tool.ToolsFunction;
-import org.ruoyi.common.chat.openai.OpenAiClient;
-import org.ruoyi.common.chat.openai.OpenAiStreamClient;
-import org.ruoyi.common.chat.openai.function.KeyRandomStrategy;
-import org.ruoyi.common.chat.openai.interceptor.DynamicKeyOpenAiAuthInterceptor;
-import org.ruoyi.common.chat.openai.interceptor.OpenAILogger;
-import org.ruoyi.common.chat.openai.interceptor.OpenAiResponseInterceptor;
-import org.ruoyi.common.chat.openai.plugin.PluginAbstract;
-import org.ruoyi.common.chat.plugin.CmdPlugin;
-import org.ruoyi.common.chat.plugin.CmdReq;
-import org.ruoyi.common.chat.sse.ConsoleEventSourceListener;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- * 描述:
- *
- * @author ageerle@163.com
- * date 2025/3/8
- */
-@Slf4j
-public class PluginTest {
-
-    private OpenAiClient openAiClient;
-    private OpenAiStreamClient openAiStreamClient;
-
-    @Before
-    public void before() {
-        //可以为null
-//        Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 7890));
-        HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(new OpenAILogger());
-        //!!!!千万别再生产或者测试环境打开BODY级别日志!!!!
-        //!!!生产或者测试环境建议设置为这三种级别:NONE,BASIC,HEADERS,!!!
-        httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.HEADERS);
-        OkHttpClient okHttpClient = new OkHttpClient
-                .Builder()
-//                .proxy(proxy)
-                .addInterceptor(httpLoggingInterceptor)
-                .addInterceptor(new OpenAiResponseInterceptor())
-                .connectTimeout(10, TimeUnit.SECONDS)
-                .writeTimeout(30, TimeUnit.SECONDS)
-                .readTimeout(30, TimeUnit.SECONDS)
-                .build();
-        openAiClient = OpenAiClient.builder()
-                //支持多key传入,请求时候随机选择
-                .apiKey(Arrays.asList("sk-xx"))
-                //自定义key的获取策略:默认KeyRandomStrategy
-                //.keyStrategy(new KeyRandomStrategy())
-                .keyStrategy(new KeyRandomStrategy())
-                .okHttpClient(okHttpClient)
-                //自己做了代理就传代理地址,没有可不不传,(关注公众号回复:openai ,获取免费的测试代理地址)
-                .apiHost("https://api.pandarobot.chat/")
-                .build();
-
-        openAiStreamClient = OpenAiStreamClient.builder()
-                //支持多key传入,请求时候随机选择
-                .apiKey(Arrays.asList("sk-xx"))
-                //自定义key的获取策略:默认KeyRandomStrategy
-                .keyStrategy(new KeyRandomStrategy())
-                .authInterceptor(new DynamicKeyOpenAiAuthInterceptor())
-                .okHttpClient(okHttpClient)
-                //自己做了代理就传代理地址,没有可不不传,(关注公众号回复:openai ,获取免费的测试代理地址)
-                .apiHost("https://api.pandarobot.chat/")
-                .build();
-    }
-
-
-    @Test
-    public void chatFunction() {
-        //模型:GPT_3_5_TURBO_16K_0613
-        Message message = Message.builder().role(Message.Role.USER).content("给我输出一个长度为2的中文词语,并解释下词语对应物品的用途").build();
-        //属性一
-        JSONObject wordLength = new JSONObject();
-        wordLength.put("type", "number");
-        wordLength.put("description", "词语的长度");
-        //属性二
-        JSONObject language = new JSONObject();
-        language.put("type", "string");
-        language.put("enum", Arrays.asList("zh", "en"));
-        language.put("description", "语言类型,例如:zh代表中文、en代表英语");
-        //参数
-        JSONObject properties = new JSONObject();
-        properties.put("wordLength", wordLength);
-        properties.put("language", language);
-
-        Parameters parameters = Parameters.builder()
-                .type("object")
-                .properties(properties)
-                .required(Collections.singletonList("wordLength")).build();
-        Functions functions = Functions.builder()
-                .name("getOneWord")
-                .description("获取一个指定长度和语言类型的词语")
-                .parameters(parameters)
-                .build();
-
-        ChatCompletion chatCompletion = ChatCompletion
-                .builder()
-                .messages(Collections.singletonList(message))
-                .functions(Collections.singletonList(functions))
-                .functionCall("auto")
-                .model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
-                .build();
-        ChatCompletionResponse chatCompletionResponse = openAiClient.chatCompletion(chatCompletion);
-
-        ChatChoice chatChoice = chatCompletionResponse.getChoices().get(0);
-        log.info("构造的方法值:{}", chatChoice.getMessage().getFunctionCall());
-        log.info("构造的方法名称:{}", chatChoice.getMessage().getFunctionCall().getName());
-        log.info("构造的方法参数:{}", chatChoice.getMessage().getFunctionCall().getArguments());
-        WordParam wordParam = JSONUtil.toBean(chatChoice.getMessage().getFunctionCall().getArguments(), WordParam.class);
-        String oneWord = getOneWord(wordParam);
-
-        FunctionCall functionCall = FunctionCall.builder()
-                .arguments(chatChoice.getMessage().getFunctionCall().getArguments())
-                .name("getOneWord")
-                .build();
-        Message message2 = Message.builder().role(Message.Role.ASSISTANT).content("方法参数").functionCall(functionCall).build();
-        String content
-                = "{ " +
-                "\"wordLength\": \"3\", " +
-                "\"language\": \"zh\", " +
-                "\"word\": \"" + oneWord + "\"," +
-                "\"用途\": [\"直接吃\", \"做沙拉\", \"售卖\"]" +
-                "}";
-        Message message3 = Message.builder().role(Message.Role.FUNCTION).name("getOneWord").content(content).build();
-        List<Message> messageList = Arrays.asList(message, message2, message3);
-        ChatCompletion chatCompletionV2 = ChatCompletion
-                .builder()
-                .messages(messageList)
-                .model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
-                .build();
-        ChatCompletionResponse chatCompletionResponseV2 = openAiClient.chatCompletion(chatCompletionV2);
-        log.info("自定义的方法返回值:{}",chatCompletionResponseV2.getChoices().get(0).getMessage().getContent());
-    }
-
-
-    @Test
-    public void plugin() {
-        CmdPlugin plugin = new CmdPlugin(CmdReq.class);
-        // 插件名称
-        plugin.setName("命令行工具");
-        // 方法名称
-        plugin.setFunction("openCmd");
-        // 方法说明
-        plugin.setDescription("提供一个命令行指令,比如<记事本>,指令使用中文,以function返回结果为准");
-
-        PluginAbstract.Arg arg = new PluginAbstract.Arg();
-        // 参数名称
-        arg.setName("cmd");
-        // 参数说明
-        arg.setDescription("命令行指令");
-        // 参数类型
-        arg.setType("string");
-        arg.setRequired(true);
-        plugin.setArgs(Collections.singletonList(arg));
-
-        Message message2 = Message.builder().role(Message.Role.USER).content("帮我打开计算器,结合上下文判断指令是否执行成功,只用回复成功或者失败").build();
-        List<Message> messages = new ArrayList<>();
-        messages.add(message2);
-        //有四个重载方法,都可以使用
-        ChatCompletionResponse response = openAiClient.chatCompletionWithPlugin(messages,"gpt-4o-mini",plugin);
-        log.info("自定义的方法返回值:{}", response.getChoices().get(0).getMessage().getContent());
-    }
-
-    /**
-     * 自定义返回数据格式
-     */
-    @Test
-    public void diyReturnDataModelChat() {
-        Message message = Message.builder().role(Message.Role.USER).content("随机输出10个单词,使用json输出").build();
-        ChatCompletion chatCompletion = ChatCompletion
-                .builder()
-                .messages(Collections.singletonList(message))
-                .responseFormat(ResponseFormat.builder().type(ResponseFormat.Type.JSON_OBJECT.getName()).build())
-                .model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
-                .build();
-        ChatCompletionResponse chatCompletionResponse = openAiClient.chatCompletion(chatCompletion);
-        chatCompletionResponse.getChoices().forEach(e -> System.out.println(e.getMessage()));
-    }
-
-    @Test
-    public void streamPlugin() {
-        WeatherPlugin plugin = new WeatherPlugin(WeatherReq.class);
-        plugin.setName("知心天气");
-        plugin.setFunction("getLocationWeather");
-        plugin.setDescription("提供一个地址,方法将会获取该地址的天气的实时温度信息。");
-        PluginAbstract.Arg arg = new PluginAbstract.Arg();
-        arg.setName("location");
-        arg.setDescription("地名");
-        arg.setType("string");
-        arg.setRequired(true);
-        plugin.setArgs(Collections.singletonList(arg));
-
-//        Message message1 = Message.builder().role(Message.Role.USER).content("秦始皇统一了哪六国。").build();
-        Message message2 = Message.builder().role(Message.Role.USER).content("获取上海市的天气现在多少度,然后再给出3个推荐的户外运动。").build();
-        List<Message> messages = new ArrayList<>();
-//        messages.add(message1);
-        messages.add(message2);
-        //默认模型:GPT_3_5_TURBO_16K_0613
-        //有四个重载方法,都可以使用
-        openAiStreamClient.streamChatCompletionWithPlugin(messages, ChatCompletion.Model.GPT_4_1106_PREVIEW.getName(), new ConsoleEventSourceListener(), plugin);
-        CountDownLatch countDownLatch = new CountDownLatch(1);
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * tools使用示例
-     */
-    @Test
-    public void toolsChat() {
-        Message message = Message.builder().role(Message.Role.USER).content("给我输出一个长度为2的中文词语,并解释下词语对应物品的用途").build();
-        //属性一
-        JSONObject wordLength = new JSONObject();
-        wordLength.put("type", "number");
-        wordLength.put("description", "词语的长度");
-        //属性二
-        JSONObject language = new JSONObject();
-        language.put("type", "string");
-        language.put("enum", Arrays.asList("zh", "en"));
-        language.put("description", "语言类型,例如:zh代表中文、en代表英语");
-        //参数
-        JSONObject properties = new JSONObject();
-        properties.put("wordLength", wordLength);
-        properties.put("language", language);
-        Parameters parameters = Parameters.builder()
-                .type("object")
-                .properties(properties)
-                .required(Collections.singletonList("wordLength")).build();
-        Tools tools = Tools.builder()
-                .type(Tools.Type.FUNCTION.getName())
-                .function(ToolsFunction.builder().name("getOneWord").description("获取一个指定长度和语言类型的词语").parameters(parameters).build())
-                .build();
-
-        ChatCompletion chatCompletion = ChatCompletion
-                .builder()
-                .messages(Collections.singletonList(message))
-                .tools(Collections.singletonList(tools))
-                .model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
-                .build();
-        ChatCompletionResponse chatCompletionResponse = openAiClient.chatCompletion(chatCompletion);
-
-        ChatChoice chatChoice = chatCompletionResponse.getChoices().get(0);
-        log.info("构造的方法值:{}", chatChoice.getMessage().getToolCalls());
-
-        ToolCalls openAiReturnToolCalls = chatChoice.getMessage().getToolCalls().get(0);
-        WordParam wordParam = JSONUtil.toBean(openAiReturnToolCalls.getFunction().getArguments(), WordParam.class);
-        String oneWord = getOneWord(wordParam);
-
-
-        ToolCallFunction tcf = ToolCallFunction.builder().name("getOneWord").arguments(openAiReturnToolCalls.getFunction().getArguments()).build();
-        ToolCalls tc = ToolCalls.builder().id(openAiReturnToolCalls.getId()).type(ToolCalls.Type.FUNCTION.getName()).function(tcf).build();
-        //构造tool call
-        Message message2 = Message.builder().role(Message.Role.ASSISTANT).content("方法参数").toolCalls(Collections.singletonList(tc)).build();
-        String content
-                = "{ " +
-                "\"wordLength\": \"3\", " +
-                "\"language\": \"zh\", " +
-                "\"word\": \"" + oneWord + "\"," +
-                "\"用途\": [\"直接吃\", \"做沙拉\", \"售卖\"]" +
-                "}";
-        Message message3 = Message.builder().toolCallId(openAiReturnToolCalls.getId()).role(Message.Role.TOOL).name("getOneWord").content(content).build();
-        List<Message> messageList = Arrays.asList(message, message2, message3);
-        ChatCompletion chatCompletionV2 = ChatCompletion
-                .builder()
-                .messages(messageList)
-                .model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
-                .build();
-        ChatCompletionResponse chatCompletionResponseV2 = openAiClient.chatCompletion(chatCompletionV2);
-        log.info("自定义的方法返回值:{}", chatCompletionResponseV2.getChoices().get(0).getMessage().getContent());
-
-    }
-
-    /**
-     * tools流式输出使用示例
-     */
-    @Test
-    public void streamToolsChat() {
-
-        CountDownLatch countDownLatch = new CountDownLatch(1);
-        ConsoleEventSourceListenerV3 eventSourceListener = new ConsoleEventSourceListenerV3(countDownLatch);
-
-        Message message = Message.builder().role(Message.Role.USER).content("给我输出一个长度为2的中文词语,并解释下词语对应物品的用途").build();
-        //属性一
-        JSONObject wordLength = new JSONObject();
-        wordLength.put("type", "number");
-        wordLength.put("description", "词语的长度");
-        //属性二
-        JSONObject language = new JSONObject();
-        language.put("type", "string");
-        language.put("enum", Arrays.asList("zh", "en"));
-        language.put("description", "语言类型,例如:zh代表中文、en代表英语");
-        //参数
-        JSONObject properties = new JSONObject();
-        properties.put("wordLength", wordLength);
-        properties.put("language", language);
-        Parameters parameters = Parameters.builder()
-                .type("object")
-                .properties(properties)
-                .required(Collections.singletonList("wordLength")).build();
-        Tools tools = Tools.builder()
-                .type(Tools.Type.FUNCTION.getName())
-                .function(ToolsFunction.builder().name("getOneWord").description("获取一个指定长度和语言类型的词语").parameters(parameters).build())
-                .build();
-
-        ChatCompletion chatCompletion = ChatCompletion
-                .builder()
-                .messages(Collections.singletonList(message))
-                .tools(Collections.singletonList(tools))
-                .model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
-                .build();
-        openAiStreamClient.streamChatCompletion(chatCompletion, eventSourceListener);
-
-        try {
-            countDownLatch.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-
-        ToolCalls openAiReturnToolCalls = eventSourceListener.getToolCalls();
-        WordParam wordParam = JSONUtil.toBean(openAiReturnToolCalls.getFunction().getArguments(), WordParam.class);
-        String oneWord = getOneWord(wordParam);
-
-
-        ToolCallFunction tcf = ToolCallFunction.builder().name("getOneWord").arguments(openAiReturnToolCalls.getFunction().getArguments()).build();
-        ToolCalls tc = ToolCalls.builder().id(openAiReturnToolCalls.getId()).type(ToolCalls.Type.FUNCTION.getName()).function(tcf).build();
-        //构造tool call
-        Message message2 = Message.builder().role(Message.Role.ASSISTANT).content("方法参数").toolCalls(Collections.singletonList(tc)).build();
-        String content
-                = "{ " +
-                "\"wordLength\": \"3\", " +
-                "\"language\": \"zh\", " +
-                "\"word\": \"" + oneWord + "\"," +
-                "\"用途\": [\"直接吃\", \"做沙拉\", \"售卖\"]" +
-                "}";
-        Message message3 = Message.builder().toolCallId(openAiReturnToolCalls.getId()).role(Message.Role.TOOL).name("getOneWord").content(content).build();
-        List<Message> messageList = Arrays.asList(message, message2, message3);
-        ChatCompletion chatCompletionV2 = ChatCompletion
-                .builder()
-                .messages(messageList)
-                .model(ChatCompletion.Model.GPT_4_1106_PREVIEW.getName())
-                .build();
-
-
-        CountDownLatch countDownLatch1 = new CountDownLatch(1);
-        openAiStreamClient.streamChatCompletion(chatCompletionV2, new ConsoleEventSourceListenerV3(countDownLatch));
-        try {
-            countDownLatch1.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        try {
-            countDownLatch1.await();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-
-    }
-
-
-    @Data
-    @Builder
-    static class WordParam {
-        private int wordLength;
-        @Builder.Default
-        private String language = "zh";
-    }
-
-
-    /**
-     * 获取一个词语(根据语言和字符长度查询)
-     * @param wordParam
-     * @return
-     */
-    public String getOneWord(WordParam wordParam) {
-
-        List<String> zh = Arrays.asList("大香蕉", "哈密瓜", "苹果");
-        List<String> en = Arrays.asList("apple", "banana", "cantaloupe");
-        if (wordParam.getLanguage().equals("zh")) {
-            for (String e : zh) {
-                if (e.length() == wordParam.getWordLength()) {
-                    return e;
-                }
-            }
-        }
-        if (wordParam.getLanguage().equals("en")) {
-            for (String e : en) {
-                if (e.length() == wordParam.getWordLength()) {
-                    return e;
-                }
-            }
-        }
-        return "西瓜";
-    }
-}

+ 0 - 24
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/WeatherPlugin.java

@@ -1,24 +0,0 @@
-package org.ruoyi.common.chat.demo;
-
-
-import org.ruoyi.common.chat.openai.plugin.PluginAbstract;
-
-public class WeatherPlugin extends PluginAbstract<WeatherReq, WeatherResp> {
-
-    public WeatherPlugin(Class<?> r) {
-        super(r);
-    }
-
-    @Override
-    public WeatherResp func(WeatherReq args) {
-        WeatherResp weatherResp = new WeatherResp();
-        weatherResp.setTemp("25到28摄氏度");
-        weatherResp.setLevel(3);
-        return weatherResp;
-    }
-
-    @Override
-    public String content(WeatherResp weatherResp) {
-        return "当前天气温度:" + weatherResp.getTemp() + ",风力等级:" + weatherResp.getLevel();
-    }
-}

+ 0 - 13
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/WeatherReq.java

@@ -1,13 +0,0 @@
-package org.ruoyi.common.chat.demo;
-
-
-import lombok.Data;
-import org.ruoyi.common.chat.openai.plugin.PluginParam;
-
-@Data
-public class WeatherReq extends PluginParam {
-    /**
-     * 城市
-     */
-    private String location;
-}

+ 0 - 15
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/WeatherResp.java

@@ -1,15 +0,0 @@
-package org.ruoyi.common.chat.demo;
-
-import lombok.Data;
-
-@Data
-public class WeatherResp {
-    /**
-     * 温度
-     */
-    private String temp;
-    /**
-     * 风力等级
-     */
-    private Integer level;
-}

+ 0 - 223
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/demo/WebSearchToolsTest.java

@@ -1,223 +0,0 @@
-package org.ruoyi.common.chat.demo;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.zhipu.oapi.ClientV4;
-import com.zhipu.oapi.Constants;
-import com.zhipu.oapi.service.v4.tools.*;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-
-
-import com.zhipu.oapi.service.v4.model.*;
-import io.reactivex.Flowable;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-public class WebSearchToolsTest {
-
-    private final static Logger logger = LoggerFactory.getLogger(WebSearchToolsTest.class);
-    private static final String API_SECRET_KEY = "xx";
-
-    private static final ClientV4 client = new ClientV4.Builder(API_SECRET_KEY)
-            .networkConfig(300, 100, 100, 100, TimeUnit.SECONDS)
-            .connectionPool(new okhttp3.ConnectionPool(8, 1, TimeUnit.SECONDS))
-            .build();
-    private static final ObjectMapper mapper = new ObjectMapper();
-    // 请自定义自己的业务id
-    private static final String requestIdTemplate = "mycompany-%d";
-
-
-    @Test
-    public void test1() throws JsonProcessingException {
-
-//        json 转换  ArrayList<SearchChatMessage>
-        String jsonString = "[\n" +
-                "                {\n" +
-                "                    \"content\": \"今天武汉天气怎么样\",\n" +
-                "                    \"role\": \"user\"\n" +
-                "                }\n" +
-                "            ]";
-
-        ArrayList<SearchChatMessage> messages = new ObjectMapper().readValue(jsonString, new TypeReference<ArrayList<SearchChatMessage>>() {
-        });
-
-
-        String requestId = String.format(requestIdTemplate, System.currentTimeMillis());
-        WebSearchParamsRequest chatCompletionRequest = WebSearchParamsRequest.builder()
-                .model("web-search-pro")
-                .stream(Boolean.TRUE)
-                .messages(messages)
-                .requestId(requestId)
-                .build();
-        WebSearchApiResponse webSearchApiResponse = client.webSearchProStreamingInvoke(chatCompletionRequest);
-        if (webSearchApiResponse.isSuccess()) {
-            AtomicBoolean isFirst = new AtomicBoolean(true);
-            List<ChoiceDelta> choices = new ArrayList<>();
-            AtomicReference<WebSearchPro> lastAccumulator = new AtomicReference<>();
-
-            webSearchApiResponse.getFlowable().map(result -> result)
-                    .doOnNext(accumulator -> {
-                        {
-                            if (isFirst.getAndSet(false)) {
-                                logger.info("Response: ");
-                            }
-                            ChoiceDelta delta = accumulator.getChoices().get(0).getDelta();
-                            if (delta != null && delta.getToolCalls() != null) {
-                                logger.info("tool_calls: {}", mapper.writeValueAsString(delta.getToolCalls()));
-                            }
-                            choices.add(delta);
-                            lastAccumulator.set(accumulator);
-
-                        }
-                    })
-                    .doOnComplete(() -> System.out.println("Stream completed."))
-                    .doOnError(throwable -> System.err.println("Error: " + throwable)) // Handle errors
-                    .blockingSubscribe();// Use blockingSubscribe instead of blockingGet()
-
-            WebSearchPro chatMessageAccumulator = lastAccumulator.get();
-
-            webSearchApiResponse.setFlowable(null);// 打印前置空
-            webSearchApiResponse.setData(chatMessageAccumulator);
-        }
-        logger.info("model output: {}", mapper.writeValueAsString(webSearchApiResponse));
-        client.getConfig().getHttpClient().dispatcher().executorService().shutdown();
-
-        client.getConfig().getHttpClient().connectionPool().evictAll();
-        // List all active threads
-        for (Thread t : Thread.getAllStackTraces().keySet()) {
-            logger.info("Thread: " + t.getName() + " State: " + t.getState());
-        }
-
-    }
-
-
-    @Test
-    public void test2() throws JsonProcessingException {
-
-//        json 转换  ArrayList<SearchChatMessage>
-        String jsonString = "[\n" +
-                "                {\n" +
-                "                    \"content\": \"今天天气怎么样\",\n" +
-                "                    \"role\": \"user\"\n" +
-                "                }\n" +
-                "            ]";
-
-        ArrayList<SearchChatMessage> messages = new ObjectMapper().readValue(jsonString, new TypeReference<ArrayList<SearchChatMessage>>() {
-        });
-
-
-        String requestId = String.format(requestIdTemplate, System.currentTimeMillis());
-        WebSearchParamsRequest chatCompletionRequest = WebSearchParamsRequest.builder()
-                .model("web-search-pro")
-                .stream(Boolean.FALSE)
-                .messages(messages)
-                .requestId(requestId)
-                .build();
-        WebSearchApiResponse webSearchApiResponse = client.invokeWebSearchPro(chatCompletionRequest);
-
-        logger.info("model output: {}", mapper.writeValueAsString(webSearchApiResponse));
-
-    }
-
-
-    @Test
-    public void testFunctionSSE() throws JsonProcessingException {
-        List<ChatMessage> messages = new ArrayList<>();
-        ChatMessage chatMessage = new ChatMessage(ChatMessageRole.USER.value(), "成都到北京要多久,天气如何");
-        messages.add(chatMessage);
-        String requestId = String.format(requestIdTemplate, System.currentTimeMillis());
-        // 函数调用参数构建部分
-        List<ChatTool> chatToolList = new ArrayList<>();
-        ChatTool chatTool = new ChatTool();
-
-        chatTool.setType(ChatToolType.FUNCTION.value());
-        ChatFunctionParameters chatFunctionParameters = new ChatFunctionParameters();
-        chatFunctionParameters.setType("object");
-        Map<String, Object> properties = new HashMap<>();
-        properties.put("location", new HashMap<String, Object>() {{
-            put("type", "string");
-            put("description", "城市,如:北京");
-        }});
-        properties.put("unit", new HashMap<String, Object>() {{
-            put("type", "string");
-            put("enum", new ArrayList<String>() {{
-                add("celsius");
-                add("fahrenheit");
-            }});
-        }});
-        chatFunctionParameters.setProperties(properties);
-        ChatFunction chatFunction = ChatFunction.builder()
-                .name("get_weather")
-                .description("Get the current weather of a location")
-                .parameters(chatFunctionParameters)
-                .build();
-        chatTool.setFunction(chatFunction);
-        chatToolList.add(chatTool);
-        HashMap<String, Object> extraJson = new HashMap<>();
-        extraJson.put("temperature", 0.5);
-        extraJson.put("max_tokens", 50);
-
-        ChatCompletionRequest chatCompletionRequest = ChatCompletionRequest.builder()
-                .model(Constants.ModelChatGLM4)
-                .stream(Boolean.TRUE)
-                .messages(messages)
-                .requestId(requestId)
-                .tools(chatToolList)
-                .toolChoice("auto")
-                .extraJson(extraJson)
-                .build();
-        ModelApiResponse sseModelApiResp = client.invokeModelApi(chatCompletionRequest);
-        if (sseModelApiResp.isSuccess()) {
-            AtomicBoolean isFirst = new AtomicBoolean(true);
-            List<Choice> choices = new ArrayList<>();
-            ChatMessageAccumulator chatMessageAccumulator = mapStreamToAccumulator(sseModelApiResp.getFlowable())
-                    .doOnNext(accumulator -> {
-                        {
-                            if (isFirst.getAndSet(false)) {
-                                logger.info("Response: ");
-                            }
-                            if (accumulator.getDelta() != null && accumulator.getDelta().getTool_calls() != null) {
-                                String jsonString = mapper.writeValueAsString(accumulator.getDelta().getTool_calls());
-                                logger.info("tool_calls: {}", jsonString);
-                            }
-                            if (accumulator.getDelta() != null && accumulator.getDelta().getContent() != null) {
-                                logger.info(accumulator.getDelta().getContent());
-                            }
-                            choices.add(accumulator.getChoice());
-                        }
-                    })
-                    .doOnComplete(System.out::println)
-                    .lastElement()
-                    .blockingGet();
-
-
-            ModelData data = new ModelData();
-            data.setChoices(choices);
-            data.setUsage(chatMessageAccumulator.getUsage());
-            data.setId(chatMessageAccumulator.getId());
-            data.setCreated(chatMessageAccumulator.getCreated());
-            data.setRequestId(chatCompletionRequest.getRequestId());
-            sseModelApiResp.setFlowable(null);// 打印前置空
-            sseModelApiResp.setData(data);
-        }
-        logger.info("model output: {}", mapper.writeValueAsString(sseModelApiResp));
-    }
-
-    public static Flowable<ChatMessageAccumulator> mapStreamToAccumulator(Flowable<ModelData> flowable) {
-        return flowable.map(chunk -> {
-            return new ChatMessageAccumulator(chunk.getChoices().get(0).getDelta(), null, chunk.getChoices().get(0), chunk.getUsage(), chunk.getCreated(), chunk.getId());
-        });
-    }
-
-}

+ 0 - 75
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/domain/request/ChatRequest.java

@@ -1,75 +0,0 @@
-package org.ruoyi.common.chat.domain.request;
-
-import org.ruoyi.common.chat.entity.chat.Message;
-import jakarta.validation.constraints.NotEmpty;
-import lombok.Data;
-
-import java.util.List;
-
-/**
- * 描述:
- *
- * @author https:www.unfbx.com
- * @sine 2023-04-08
- */
-@Data
-public class ChatRequest {
-
-
-    private String frequency_penalty;
-
-    private String max_tokens;
-
-    @NotEmpty(message = "对话消息不能为空")
-    List<Message> messages;
-
-    @NotEmpty(message = "传入的模型不能为空")
-    private String model;
-
-    private String presence_penalty;
-
-    private String stream;
-
-    private double temperature;
-
-    private double top_p = 1;
-
-    /**
-     * 知识库id
-     */
-    private String kid;
-
-    private String userId;
-
-    /**
-     * 1 联网搜索
-     */
-    private int chat_type;
-
-    /**
-     * 应用ID
-     */
-    private String appId;
-//
-
-//
-//    /**
-//     * gpt的默认设置
-//     */
-//    private String systemMessage = "";
-//
-//
-//
-//    private double temperature = 0.2;
-//
-//    /**
-//     * 上下文的条数
-//     */
-//    private Integer contentNumber = 10;
-//
-//    /**
-//     * 是否携带上下文
-//     */
-//    private Boolean usingContext = Boolean.TRUE;
-
-}

+ 0 - 33
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/domain/request/Dall3Request.java

@@ -1,33 +0,0 @@
-package org.ruoyi.common.chat.domain.request;
-
-import jakarta.validation.constraints.NotEmpty;
-import lombok.Data;
-
-/**
- * 描述:
- *
- * @author https:www.unfbx.com
- * @sine 2023-04-08
- */
-@Data
-public class Dall3Request {
-
-    @NotEmpty(message = "传入的模型不能为空")
-    private String model;
-
-    @NotEmpty(message = "提示词不能为空")
-    private String prompt;
-
-    /** 图片大小 */
-    @NotEmpty(message = "图片大小不能为空")
-    private String size ;
-
-    /** 图片质量 */
-    @NotEmpty(message = "图片质量不能为空")
-    private String quality;
-
-    /** 图片风格 */
-    @NotEmpty(message = "图片风格不能为空")
-    private String style;
-
-}

+ 0 - 2
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/handler/PlusWebSocketHandler.java

@@ -2,7 +2,6 @@ package org.ruoyi.common.chat.handler;
 
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
-import com.alibaba.fastjson2.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.ruoyi.common.chat.config.LocalCache;
 import org.ruoyi.common.chat.entity.chat.ChatCompletion;
@@ -12,7 +11,6 @@ import org.ruoyi.common.chat.listener.WebSocketEventListener;
 import org.ruoyi.common.chat.openai.OpenAiStreamClient;
 import org.ruoyi.common.chat.utils.WebSocketUtils;
 import org.ruoyi.common.core.utils.SpringUtils;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.socket.*;
 import org.springframework.web.socket.handler.AbstractWebSocketHandler;
 

+ 0 - 198
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/localModels/LocalModelsofitClient.java

@@ -1,198 +0,0 @@
-package org.ruoyi.common.chat.localModels;
-
-import io.micrometer.common.util.StringUtils;
-import lombok.extern.slf4j.Slf4j;
-import okhttp3.OkHttpClient;
-import org.ruoyi.common.chat.entity.models.LocalModelsSearchRequest;
-import org.ruoyi.common.chat.entity.models.LocalModelsSearchResponse;
-import org.springframework.stereotype.Service;
-import retrofit2.Call;
-import retrofit2.Callback;
-import retrofit2.Response;
-import retrofit2.Retrofit;
-import retrofit2.converter.jackson.JacksonConverterFactory;
-
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-
-@Slf4j
-@Service
-public class LocalModelsofitClient {
-    private static final String BASE_URL = "http://127.0.0.1:5000"; // Flask 服务的 URL
-    private static Retrofit retrofit = null;
-
-    // 获取 Retrofit 实例
-    public static Retrofit getRetrofitInstance() {
-        if (retrofit == null) {
-            OkHttpClient client = new OkHttpClient.Builder()
-                    .build();
-
-            retrofit = new Retrofit.Builder()
-                    .baseUrl(BASE_URL)
-                    .client(client)
-                    .addConverterFactory(JacksonConverterFactory.create()) // 使用 Jackson 处理 JSON 转换
-                    .build();
-        }
-        return retrofit;
-    }
-
-    /**
-     * 向 Flask 服务发送文本向量化请求
-     *
-     * @param queries 查询文本列表
-     * @param modelName 模型名称
-     * @param delimiter 文本分隔符
-     * @param topK 返回的结果数
-     * @param blockSize 文本块大小
-     * @param overlapChars 重叠字符数
-     * @return 返回计算得到的 Top K 嵌入向量列表
-     */
-
-    public static List<List<Double>> getTopKEmbeddings(
-            List<String> queries,
-            String modelName,
-            String delimiter,
-            int topK,
-            int blockSize,
-            int overlapChars) {
-
-        modelName = (!StringUtils.isEmpty(modelName)) ? modelName : "msmarco-distilbert-base-tas-b"; // 默认模型名称
-        delimiter = (!StringUtils.isEmpty(delimiter) ) ? delimiter : ".";                             // 默认分隔符
-        topK = (topK > 0) ? topK : 3;                                                  // 默认返回 3 个结果
-        blockSize = (blockSize > 0) ? blockSize : 500;                                 // 默认文本块大小为 500
-        overlapChars = (overlapChars > 0) ? overlapChars : 50;                         // 默认重叠字符数为 50
-
-        // 创建 Retrofit 实例
-        Retrofit retrofit = getRetrofitInstance();
-
-        // 创建 SearchService 接口
-        SearchService service = retrofit.create(SearchService.class);
-
-        // 创建请求对象 LocalModelsSearchRequest
-        LocalModelsSearchRequest request = new LocalModelsSearchRequest(
-                queries,            // 查询文本列表
-                modelName,          // 模型名称
-                delimiter,          // 文本分隔符
-                topK,               // 返回的结果数
-                blockSize,          // 文本块大小
-                overlapChars        // 重叠字符数
-        );
-
-        final CountDownLatch latch = new CountDownLatch(1);  // 创建一个 CountDownLatch
-        final List<List<Double>>[] topKEmbeddings = new List[]{null}; // 使用数组来存储结果(因为 Java 不支持直接修改 List)
-
-        // 发起异步请求
-        service.vectorize(request).enqueue(new Callback<LocalModelsSearchResponse>() {
-            @Override
-            public void onResponse(Call<LocalModelsSearchResponse> call, Response<LocalModelsSearchResponse> response) {
-                if (response.isSuccessful()) {
-                    LocalModelsSearchResponse searchResponse = response.body();
-                    if (searchResponse != null) {
-                        topKEmbeddings[0] = searchResponse.getTopKEmbeddings().get(0);  // 获取结果
-                        log.info("Successfully retrieved embeddings");
-                    } else {
-                        log.error("Response body is null");
-                    }
-                } else {
-                    log.error("Request failed. HTTP error code: " + response.code());
-                }
-                latch.countDown();  // 请求完成,减少计数
-            }
-
-            @Override
-            public void onFailure(Call<LocalModelsSearchResponse> call, Throwable t) {
-                t.printStackTrace();
-                log.error("Request failed: ", t);
-                latch.countDown();  // 请求失败,减少计数
-            }
-        });
-
-        try {
-            latch.await();  // 等待请求完成
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-
-        return topKEmbeddings[0];  // 返回结果
-    }
-
-//    public static void main(String[] args) {
-//        // 示例调用
-//        List<String> queries = Arrays.asList("What is artificial intelligence?", "AI is transforming industries.");
-//        String modelName = "msmarco-distilbert-base-tas-b";
-//        String delimiter = ".";
-//        int topK = 3;
-//        int blockSize = 500;
-//        int overlapChars = 50;
-//
-//        List<List<Double>> topKEmbeddings = getTopKEmbeddings(queries, modelName, delimiter, topK, blockSize, overlapChars);
-//
-//        // 打印结果
-//        if (topKEmbeddings != null) {
-//            System.out.println("Top K embeddings: ");
-//            for (List<Double> embedding : topKEmbeddings) {
-//                System.out.println(embedding);
-//            }
-//        } else {
-//            System.out.println("No embeddings returned.");
-//        }
-//    }
-
-
-//    public static void main(String[] args) {
-//        // 创建 Retrofit 实例
-//        Retrofit retrofit = LocalModelsofitClient.getRetrofitInstance();
-//
-//        // 创建 SearchService 接口
-//        SearchService service = retrofit.create(SearchService.class);
-//
-//        // 创建请求对象 LocalModelsSearchRequest
-//        LocalModelsSearchRequest request = new LocalModelsSearchRequest(
-//                Arrays.asList("What is artificial intelligence?", "AI is transforming industries."), // 查询文本列表
-//                "msmarco-distilbert-base-tas-b",  // 模型名称
-//                ".",  // 分隔符
-//                3,  // 返回的结果数
-//                500,  // 文本块大小
-//                50  // 重叠字符数
-//        );
-//
-//        // 发起请求
-//        service.vectorize(request).enqueue(new Callback<LocalModelsSearchResponse>() {
-//            @Override
-//            public void onResponse(Call<LocalModelsSearchResponse> call, Response<LocalModelsSearchResponse> response) {
-//                if (response.isSuccessful()) {
-//                    LocalModelsSearchResponse searchResponse = response.body();
-//                    System.out.println("Response Body: " + response.body());  // Print the whole response body for debugging
-//
-//                    if (searchResponse != null) {
-//                        // If the response is not null, process it.
-//                        // Example: Extract the embeddings and print them
-//                        List<List<List<Double>>> topKEmbeddings = searchResponse.getTopKEmbeddings();
-//                        if (topKEmbeddings != null) {
-//                            // Print the Top K embeddings
-//
-//                        } else {
-//                            System.err.println("Top K embeddings are null");
-//                        }
-//
-//                        // If there is more information you want to process, handle it here
-//
-//                    } else {
-//                        System.err.println("Response body is null");
-//                    }
-//                } else {
-//                    System.err.println("Request failed. HTTP error code: " + response.code());
-//                    log.error("Failed to retrieve data. HTTP error code: " + response.code());
-//                }
-//            }
-//
-//            @Override
-//            public void onFailure(Call<LocalModelsSearchResponse> call, Throwable t) {
-//                // 请求失败,打印错误
-//                t.printStackTrace();
-//                log.error("Request failed: ", t);
-//            }
-//        });
-//    }
-
-}

+ 0 - 25
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/localModels/SearchService.java

@@ -1,25 +0,0 @@
-package org.ruoyi.common.chat.localModels;
-
-
-
-import org.ruoyi.common.chat.entity.models.LocalModelsSearchRequest;
-import org.ruoyi.common.chat.entity.models.LocalModelsSearchResponse;
-import retrofit2.Call;
-import retrofit2.http.Body;
-import retrofit2.http.POST;
-/**
- * @program: RUOYIAI
- * @ClassName SearchService
- * @description: 请求模型
- * @author: hejh
- * @create: 2025-03-15 17:27
- * @Version 1.0
- **/
-
-
-public interface SearchService {
-    @POST("/vectorize") // 与 Flask 服务中的路由匹配
-    Call<LocalModelsSearchResponse> vectorize(@Body LocalModelsSearchRequest request);
-}
-
-

+ 0 - 36
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/plugin/CmdPlugin.java

@@ -1,36 +0,0 @@
-package org.ruoyi.common.chat.plugin;
-
-import org.ruoyi.common.chat.openai.plugin.PluginAbstract;
-
-import java.io.IOException;
-
-public class CmdPlugin extends PluginAbstract<CmdReq, CmdResp> {
-
-    public CmdPlugin(Class<?> r) {
-        super(r);
-    }
-
-    @Override
-    public CmdResp func(CmdReq args) {
-        try {
-            if("计算器".equals(args.getCmd())){
-                Runtime.getRuntime().exec("calc");
-            }else if("记事本".equals(args.getCmd())){
-                Runtime.getRuntime().exec("notepad");
-            }else if("命令行".equals(args.getCmd())){
-                String [] cmd={"cmd","/C","start copy exel exe2"};
-                Runtime.getRuntime().exec(cmd);
-            }
-        } catch (IOException e) {
-           throw new RuntimeException("指令执行失败");
-        }
-        CmdResp resp = new CmdResp();
-        resp.setResult(args.getCmd()+"指令执行成功!");
-        return resp;
-    }
-
-    @Override
-    public String content(CmdResp resp) {
-        return resp.getResult();
-    }
-}

+ 23 - 13
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/request/ChatRequest.java

@@ -2,31 +2,39 @@ package org.ruoyi.common.chat.request;
 
 import jakarta.validation.constraints.NotEmpty;
 import lombok.Data;
-import org.ruoyi.common.chat.entity.chat.Content;
 import org.ruoyi.common.chat.entity.chat.Message;
 
 import java.util.List;
 
 /**
- * 描述:
+ * 描述:对话请求对象
  *
- * @author https:www.unfbx.com
+ * @author ageerle
  * @sine 2023-04-08
  */
 @Data
 public class ChatRequest {
 
-    @NotEmpty(message = "传入的模型不能为空")
-    private String model;
-
     @NotEmpty(message = "对话消息不能为空")
     List<Message> messages;
 
-    List<Content> imageContent;
+    @NotEmpty(message = "传入的模型不能为空")
+    private String model;
 
+    /**
+     * 提示词
+     */
     private String prompt;
 
-    private String userId;
+    /**
+     * 是否开启流式对话
+     */
+    private Boolean stream = Boolean.TRUE;
+
+    /**
+     *  是否开启联网搜索(0关闭 1开启)
+     */
+    private Boolean search = Boolean.FALSE;
 
     /**
      * 知识库id
@@ -34,13 +42,14 @@ public class ChatRequest {
     private String kid;
 
     /**
-     * gpt的默认设置
+     * 用户id
      */
-    private String systemMessage = "";
-
-    private double top_p = 1;
+    private String userId;
 
-    private double temperature = 0.2;
+    /**
+     * 应用ID
+     */
+    private String appId;
 
     /**
      * 上下文的条数
@@ -52,4 +61,5 @@ public class ChatRequest {
      */
     private Boolean usingContext = Boolean.TRUE;
 
+
 }

+ 0 - 1
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/sse/ConsoleEventSourceListener.java

@@ -28,7 +28,6 @@ public class ConsoleEventSourceListener extends EventSourceListener {
         log.info("OpenAI返回数据:{}", data);
         if ("[DONE]".equals(data)) {
             log.info("OpenAI返回数据结束了");
-            return;
         }
     }
 

+ 0 - 1
ruoyi-common/ruoyi-common-chat/src/main/java/org/ruoyi/common/chat/sse/PluginListener.java

@@ -8,7 +8,6 @@ import okhttp3.ResponseBody;
 import okhttp3.sse.EventSource;
 import okhttp3.sse.EventSourceListener;
 import org.jetbrains.annotations.NotNull;
-import org.ruoyi.common.chat.constant.OpenAIConst;
 import org.ruoyi.common.chat.entity.chat.ChatCompletion;
 import org.ruoyi.common.chat.entity.chat.ChatCompletionResponse;
 import org.ruoyi.common.chat.entity.chat.FunctionCall;

+ 6 - 13
ruoyi-common/ruoyi-common-core/pom.xml

@@ -51,7 +51,7 @@
         <dependency>
             <groupId>cn.hutool</groupId>
             <artifactId>hutool-all</artifactId>
-            <version>5.8.24</version>
+            <version>${hutool.version}</version>
         </dependency>
 
         <dependency>
@@ -59,18 +59,6 @@
             <artifactId>lombok</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>com.github.binarywang</groupId>
-            <artifactId>weixin-java-cp</artifactId>
-            <version>${weixin-java-miniapp.version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>com.github.binarywang</groupId>
-            <artifactId>weixin-java-cp</artifactId>
-            <version>${weixin-java-cp.version}</version>
-        </dependency>
-
         <!--  自动生成YML配置关联JSON文件  -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -94,6 +82,11 @@
             <artifactId>ip2region</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.github.binarywang</groupId>
+            <artifactId>weixin-java-cp</artifactId>
+            <version>${weixin-java-cp.version}</version>
+        </dependency>
 
         <dependency>
             <groupId>com.github.binarywang</groupId>

+ 0 - 49
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/pom.xml

@@ -1,49 +0,0 @@
-<!--
-  ~ MIT License
-  ~
-  ~ Copyright (c) 2023 OrdinaryRoad
-  ~
-  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
-  ~ of this software and associated documentation files (the "Software"), to deal
-  ~ in the Software without restriction, including without limitation the rights
-  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-  ~ copies of the Software, and to permit persons to whom the Software is
-  ~ furnished to do so, subject to the following conditions:
-  ~
-  ~ The above copyright notice and this permission notice shall be included in all
-  ~ copies or substantial portions of the Software.
-  ~
-  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-  ~ SOFTWARE.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.ruoyi</groupId>
-        <artifactId>live-chat-client-commons</artifactId>
-        <version>${revision}</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>live-chat-client-commons-base</artifactId>
-    <name>ordinaryroad-live-chat-client-commons-base</name>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-databind</artifactId>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 32
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/constant/Constants.java

@@ -1,32 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.constant;
-
-/**
- * @author mjz
- * @date 2023/8/26
- */
-public class Constants {
-}

+ 0 - 51
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/exception/BaseException.java

@@ -1,51 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.exception;
-
-/**
- * @author mjz
- * @date 2023/9/5
- */
-public class BaseException extends RuntimeException {
-
-    public BaseException() {
-    }
-
-    public BaseException(String message) {
-        super(message);
-    }
-
-    public BaseException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    public BaseException(Throwable cause) {
-        super(cause);
-    }
-
-    public BaseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
-        super(message, cause, enableSuppression, writableStackTrace);
-    }
-}

+ 0 - 60
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/IBaseConnectionListener.java

@@ -1,60 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.listener;
-
-
-/**
- * 连接回调
- *
- * @author mjz
- * @date 2023/8/26
- */
-public interface IBaseConnectionListener<T> {
-
-    /**
-     * 连接建立成功
-     */
-    default void onConnected(T t) {
-        // ignore
-    }
-
-    /**
-     * 连接建立失败
-     *
-     * @param t
-     */
-    default void onConnectFailed(T t) {
-        // ignore
-    }
-
-    /**
-     * 连接断开
-     *
-     * @param t
-     */
-    default void onDisconnected(T t) {
-        // ignore
-    }
-}

+ 0 - 149
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/IBaseMsgListener.java

@@ -1,149 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.listener;
-
-
-import tech.ordinaryroad.live.chat.client.commons.base.msg.BaseCmdMsg;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.BaseMsg;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.ICmdMsg;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.IMsg;
-
-/**
- * Base消息回调
- *
- * @author mjz
- * @date 2023/8/26
- */
-public interface IBaseMsgListener<T, CmdEnum extends Enum<CmdEnum>> {
-
-    /**
-     * 收到消息(所有消息)
-     *
-     * @param msg IMsg
-     */
-    default void onMsg(T t, IMsg msg) {
-        this.onMsg(msg);
-    }
-
-    default void onMsg(IMsg msg) {
-        // ignore
-    }
-
-    /**
-     * 收到cmd消息(所有cmd)
-     *
-     * @param cmd    CmdEnum
-     * @param cmdMsg BaseCmdMsg
-     */
-    default void onCmdMsg(T t, CmdEnum cmd, ICmdMsg<CmdEnum> cmdMsg) {
-        this.onCmdMsg(cmd, cmdMsg);
-    }
-
-    default void onCmdMsg(CmdEnum cmd, ICmdMsg<CmdEnum> cmdMsg) {
-        // ignore
-    }
-
-    /**
-     * 收到其他cmd消息(存在Enum,但Listener没有对应的回调)
-     *
-     * @param cmd    CmdEnum
-     * @param cmdMsg BaseCmdMsg
-     */
-    default void onOtherCmdMsg(T t, CmdEnum cmd, ICmdMsg<CmdEnum> cmdMsg) {
-        this.onOtherCmdMsg(cmd, cmdMsg);
-    }
-
-    default void onOtherCmdMsg(CmdEnum cmd, ICmdMsg<CmdEnum> cmdMsg) {
-        // ignore
-    }
-
-    /**
-     * 收到未知cmd消息
-     *
-     * @param cmdString 实际收到的cmd字符串
-     * @param msg       BaseMsg
-     */
-    default void onUnknownCmd(T t, String cmdString, IMsg msg) {
-        this.onUnknownCmd(cmdString, msg);
-    }
-
-    default void onUnknownCmd(String cmdString, IMsg msg) {
-        // ignore
-    }
-
-    /**
-     * 收到cmd消息(所有cmd)
-     *
-     * @param cmd    CmdEnum
-     * @param cmdMsg BaseCmdMsg
-     * @deprecated use {@link #onCmdMsg(T, Enum, ICmdMsg)}
-     */
-    default void onCmdMsg(T t, CmdEnum cmd, BaseCmdMsg<CmdEnum> cmdMsg) {
-        this.onCmdMsg(cmd, cmdMsg);
-    }
-
-    /**
-     * @deprecated use {@link #onCmdMsg(Enum, ICmdMsg)}
-     */
-    default void onCmdMsg(CmdEnum cmd, BaseCmdMsg<CmdEnum> cmdMsg) {
-        // ignore
-    }
-
-    /**
-     * 收到其他cmd消息(存在Enum,但Listener没有对应的回调)
-     *
-     * @param cmd    CmdEnum
-     * @param cmdMsg BaseCmdMsg
-     * @deprecated use {@link #onOtherCmdMsg(T, Enum, ICmdMsg)}
-     */
-    default void onOtherCmdMsg(T t, CmdEnum cmd, BaseCmdMsg<CmdEnum> cmdMsg) {
-        this.onOtherCmdMsg(cmd, cmdMsg);
-    }
-
-    /**
-     * @deprecated use {@link #onOtherCmdMsg(Enum, ICmdMsg)}
-     */
-    default void onOtherCmdMsg(CmdEnum cmd, BaseCmdMsg<CmdEnum> cmdMsg) {
-        // ignore
-    }
-
-    /**
-     * 收到未知cmd消息
-     *
-     * @param cmdString 实际收到的cmd字符串
-     * @param msg       BaseMsg
-     * @deprecated use {@link #onUnknownCmd(T, String, IMsg)}
-     */
-    default void onUnknownCmd(T t, String cmdString, BaseMsg msg) {
-        this.onUnknownCmd(cmdString, msg);
-    }
-
-    /**
-     * @deprecated use {@link #onUnknownCmd(String, IMsg)}
-     */
-    default void onUnknownCmd(String cmdString, BaseMsg msg) {
-        // ignore
-    }
-}

+ 0 - 46
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/IDanmuMsgListener.java

@@ -1,46 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.listener;
-
-
-/**
- * 弹幕消息回调
- *
- * @author mjz
- * @since 0.0.6
- */
-public interface IDanmuMsgListener<T, DanmuMsg> {
-
-    /**
-     * 收到弹幕
-     */
-    default void onDanmuMsg(T t, DanmuMsg msg) {
-        this.onDanmuMsg(msg);
-    }
-
-    default void onDanmuMsg(DanmuMsg msg) {
-        // ignore
-    }
-}

+ 0 - 47
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/IEnterRoomMsgListener.java

@@ -1,47 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.listener;
-
-
-/**
- * 进入房间消息回调
- *
- * @author mjz
- * @date 2023/12/14
- * @since 0.0.16
- */
-public interface IEnterRoomMsgListener<T, EnterRoomMsg> {
-
-    /**
-     * 用户进入房间
-     */
-    default void onEnterRoomMsg(T t, EnterRoomMsg msg) {
-        this.onEnterRoomMsg(msg);
-    }
-
-    default void onEnterRoomMsg(EnterRoomMsg msg) {
-        // ignore
-    }
-}

+ 0 - 47
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/IGiftMsgListener.java

@@ -1,47 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.listener;
-
-
-/**
- * 礼物消息回调
- *
- * @author mjz
- * @since 0.0.8
- */
-public interface IGiftMsgListener<T, GiftMsg> {
-
-
-    /**
-     * 收到礼物
-     */
-    default void onGiftMsg(T t, GiftMsg msg) {
-        this.onGiftMsg(msg);
-    }
-
-    default void onGiftMsg(GiftMsg msg) {
-        // ignore
-    }
-}

+ 0 - 46
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/ILikeMsgListener.java

@@ -1,46 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.listener;
-
-
-/**
- * 点赞消息回调
- *
- * @author mjz
- * @since 0.2.0
- */
-public interface ILikeMsgListener<T, LikeMsg> {
-
-    /**
-     * 收到点赞
-     */
-    default void onLikeMsg(T t, LikeMsg msg) {
-        this.onLikeMsg(msg);
-    }
-
-    default void onLikeMsg(LikeMsg msg) {
-        // ignore
-    }
-}

+ 0 - 47
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/listener/ISuperChatMsgListener.java

@@ -1,47 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.listener;
-
-
-/**
- * 醒目留言消息回调
- *
- * @author mjz
- * @date 2023/9/24
- * @since 0.0.11
- */
-public interface ISuperChatMsgListener<T, SuperChatMsg> {
-
-    /**
-     * 收到醒目留言
-     */
-    default void onSuperChatMsg(T t, SuperChatMsg msg) {
-        this.onSuperChatMsg(msg);
-    }
-
-    default void onSuperChatMsg(SuperChatMsg msg) {
-        // ignore
-    }
-}

+ 0 - 33
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/BaseCmdMsg.java

@@ -1,33 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.msg;
-
-/**
- * @author mjz
- * @date 2023/8/26
- */
-public abstract class BaseCmdMsg<CmdEnum extends Enum<CmdEnum>> extends BaseMsg
-        implements ICmdMsg<CmdEnum> {
-}

+ 0 - 74
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/BaseMsg.java

@@ -1,74 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.msg;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import tech.ordinaryroad.live.chat.client.commons.base.exception.BaseException;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author mjz
- * @date 2023/8/26
- */
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public abstract class BaseMsg implements IMsg {
-
-    public static final ObjectMapper OBJECT_MAPPER = new ObjectMapper()
-            .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
-            .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
-
-    /**
-     * 未知属性都放在这
-     */
-    private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-    @JsonAnyGetter
-    public Map<String, JsonNode> getUnknownProperties() {
-        return unknownProperties;
-    }
-
-    @JsonAnySetter
-    public void setOther(String key, JsonNode value) {
-        this.unknownProperties.put(key, value);
-    }
-
-    @Override
-    public String toString() {
-        try {
-            return OBJECT_MAPPER.writeValueAsString(this);
-        } catch (JsonProcessingException e) {
-            throw new BaseException(e);
-        }
-    }
-}

+ 0 - 38
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/ICmdMsg.java

@@ -1,38 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.msg;
-
-/**
- * @author mjz
- * @date 2023/10/2
- */
-public interface ICmdMsg<CmdEnum extends Enum<CmdEnum>> extends IMsg {
-
-    String getCmd();
-
-    void setCmd(String cmd);
-
-    CmdEnum getCmdEnum();
-}

+ 0 - 67
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/IDanmuMsg.java

@@ -1,67 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.msg;
-
-/**
- * @author mjz
- * @date 2023/9/8
- */
-public interface IDanmuMsg extends IMsg {
-
-    /**
-     * 粉丝牌名称
-     */
-    String getBadgeName();
-
-    /**
-     * 粉丝牌等级
-     */
-    byte getBadgeLevel();
-
-    /**
-     * 弹幕发送者id
-     */
-    String getUid();
-
-    /**
-     * 弹幕发送者用户名
-     */
-    String getUsername();
-
-    /**
-     * 弹幕发送者头像地址
-     *
-     * @since 0.0.11
-     */
-    default String getUserAvatar() {
-        return null;
-    }
-
-    /**
-     * 弹幕内容
-     */
-    String getContent();
-
-}

+ 0 - 62
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/IEnterRoomMsg.java

@@ -1,62 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.msg;
-
-/**
- * 入房消息
- *
- * @author mjz
- * @date 2023/12/26
- * @since 0.0.16
- */
-public interface IEnterRoomMsg extends IMsg {
-
-    /**
-     * 粉丝牌名称
-     */
-    String getBadgeName();
-
-    /**
-     * 粉丝牌等级
-     */
-    byte getBadgeLevel();
-
-    /**
-     * 用户id
-     */
-    String getUid();
-
-    /**
-     * 用户名
-     */
-    String getUsername();
-
-    /**
-     * 头像地址
-     */
-    default String getUserAvatar() {
-        return null;
-    }
-}

+ 0 - 100
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/IGiftMsg.java

@@ -1,100 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.msg;
-
-/**
- * @author mjz
- * @date 2023/9/8
- */
-public interface IGiftMsg extends IMsg {
-
-    /**
-     * 粉丝牌名称
-     */
-    default String getBadgeName() {
-        return "";
-    }
-
-    /**
-     * 粉丝牌等级
-     */
-    default byte getBadgeLevel() {
-        return 0;
-    }
-
-    /**
-     * 发送方id
-     */
-    String getUid();
-
-    /**
-     * 发送方用户名
-     */
-    String getUsername();
-
-    /**
-     * 发送方头像地址
-     *
-     * @since 0.0.11
-     */
-    default String getUserAvatar() {
-        return null;
-    }
-
-    /**
-     * 礼物名称
-     */
-    String getGiftName();
-
-    /**
-     * 礼物图像地址
-     */
-    String getGiftImg();
-
-    /**
-     * 礼物id
-     */
-    String getGiftId();
-
-    /**
-     * 礼物数量
-     */
-    int getGiftCount();
-
-    /**
-     * 单个礼物价格
-     */
-    int getGiftPrice();
-
-    /**
-     * 接收方id
-     */
-    String getReceiveUid();
-
-    /**
-     * 接收方用户名
-     */
-    String getReceiveUsername();
-}

+ 0 - 71
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/ILikeMsg.java

@@ -1,71 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.msg;
-
-/**
- * @author mjz
- * @date 2024/1/31
- * @since 0.2.0
- */
-public interface ILikeMsg extends IMsg {
-
-    /**
-     * 粉丝牌名称
-     */
-    default String getBadgeName(){
-        return "";
-    }
-
-    /**
-     * 粉丝牌等级
-     */
-    default byte getBadgeLevel(){
-        return 0;
-    }
-
-    /**
-     * 点赞者id
-     */
-    String getUid();
-
-    /**
-     * 点赞者用户名
-     */
-    String getUsername();
-
-    /**
-     * 点赞者头像地址
-     */
-    default String getUserAvatar() {
-        return null;
-    }
-
-    /**
-     * 点赞数
-     */
-    default int getClickCount() {
-        return 1;
-    }
-}

+ 0 - 34
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/IMsg.java

@@ -1,34 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.msg;
-
-import java.io.Serializable;
-
-/**
- * @author mjz
- * @date 2023/8/26
- */
-public interface IMsg extends Serializable {
-}

+ 0 - 49
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-base/src/main/java/tech/ordinaryroad/live/chat/client/commons/base/msg/ISuperChatMsg.java

@@ -1,49 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.base.msg;
-
-/**
- * 醒目留言
- *
- * @author mjz
- * @date 2023/9/22
- */
-public interface ISuperChatMsg extends IDanmuMsg {
-
-    /**
-     * 醒目留言持续时间,单位秒
-     */
-    int getDuration();
-
-    @Override
-    default String getBadgeName() {
-        return "";
-    }
-
-    @Override
-    default byte getBadgeLevel() {
-        return 0;
-    }
-}

+ 0 - 55
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-client/pom.xml

@@ -1,55 +0,0 @@
-<!--
-  ~ MIT License
-  ~
-  ~ Copyright (c) 2023 OrdinaryRoad
-  ~
-  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
-  ~ of this software and associated documentation files (the "Software"), to deal
-  ~ in the Software without restriction, including without limitation the rights
-  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-  ~ copies of the Software, and to permit persons to whom the Software is
-  ~ furnished to do so, subject to the following conditions:
-  ~
-  ~ The above copyright notice and this permission notice shall be included in all
-  ~ copies or substantial portions of the Software.
-  ~
-  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-  ~ SOFTWARE.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.ruoyi</groupId>
-        <artifactId>live-chat-client-commons</artifactId>
-        <version>${revision}</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-    <packaging>jar</packaging>
-
-    <artifactId>live-chat-client-commons-client</artifactId>
-    <name>live-chat-client-commons-client</name>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.ruoyi</groupId>
-            <artifactId>live-chat-client-commons-base</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.ruoyi</groupId>
-            <artifactId>live-chat-client-commons-util</artifactId>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 200
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-client/src/main/java/tech/ordinaryroad/live/chat/client/commons/client/BaseLiveChatClient.java

@@ -1,200 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.client;
-
-import lombok.Getter;
-import tech.ordinaryroad.live.chat.client.commons.base.listener.IBaseMsgListener;
-import tech.ordinaryroad.live.chat.client.commons.client.config.BaseLiveChatClientConfig;
-import tech.ordinaryroad.live.chat.client.commons.client.enums.ClientStatusEnums;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.function.Consumer;
-
-/**
- * @author mjz
- * @date 2023/8/26
- */
-public abstract class BaseLiveChatClient<
-        Config extends BaseLiveChatClientConfig,
-        MsgListener extends IBaseMsgListener<?, ?>
-        > implements IBaseLiveChatClient<MsgListener> {
-
-    private final Config config;
-    @Getter
-    private volatile ClientStatusEnums status = ClientStatusEnums.NEW;
-    protected PropertyChangeSupport statusChangeSupport = new PropertyChangeSupport(status);
-    protected volatile boolean cancelReconnect = false;
-    protected final List<MsgListener> msgListeners = Collections.synchronizedList(new ArrayList<>());
-
-    protected BaseLiveChatClient(Config config) {
-        this.config = config;
-    }
-
-    public Config getConfig() {
-        return config;
-    }
-
-    @Override
-    public void connect(Runnable success) {
-        this.connect(success, null);
-    }
-
-    @Override
-    public void connect() {
-        this.connect(null, null);
-    }
-
-    @Override
-    public void disconnect(boolean cancelReconnect) {
-        this.cancelReconnect = cancelReconnect;
-        this.disconnect();
-    }
-
-    @Override
-    public void send(Object msg) {
-        this.send(msg, null, null);
-    }
-
-    @Override
-    public void send(Object msg, Runnable success) {
-        this.send(msg, success, null);
-    }
-
-    @Override
-    public void send(Object msg, Consumer<Throwable> failed) {
-        this.send(msg, null, failed);
-    }
-
-    @Override
-    public void sendDanmu(Object danmu) {
-        this.sendDanmu(danmu, null, null);
-    }
-
-    @Override
-    public void sendDanmu(Object danmu, Runnable success) {
-        this.sendDanmu(danmu, success, null);
-    }
-
-    @Override
-    public void sendDanmu(Object danmu, Consumer<Throwable> failed) {
-        this.sendDanmu(danmu, null, failed);
-    }
-
-    @Override
-    public void clickLike(int count) {
-        this.clickLike(count, null, null);
-    }
-
-    @Override
-    public void clickLike(int count, Runnable success) {
-        this.clickLike(count, success, null);
-    }
-
-    @Override
-    public void clickLike(int count, Consumer<Throwable> failed) {
-        this.clickLike(count, null, failed);
-    }
-
-    protected abstract void tryReconnect();
-
-    protected abstract String getWebSocketUriString();
-
-    /**
-     * 判断是否处于某个状态,或者处于后续状态
-     *
-     * @param status {@link ClientStatusEnums}
-     * @return false: 还没有到达该状态
-     */
-    protected boolean checkStatus(ClientStatusEnums status) {
-        return this.status.getCode() >= Objects.requireNonNull(status).getCode();
-    }
-
-    protected void setStatus(ClientStatusEnums status) {
-        ClientStatusEnums oldStatus = this.status;
-        if (oldStatus != status) {
-            this.status = status;
-            this.statusChangeSupport.firePropertyChange("status", oldStatus, status);
-        }
-    }
-
-    public void addStatusChangeListener(PropertyChangeListener listener) {
-        this.statusChangeSupport.addPropertyChangeListener(listener);
-    }
-
-    public void removeStatusChangeListener(PropertyChangeListener listener) {
-        this.statusChangeSupport.removePropertyChangeListener(listener);
-    }
-
-    @Override
-    public void destroy() {
-        for (PropertyChangeListener propertyChangeListener : this.statusChangeSupport.getPropertyChangeListeners()) {
-            this.statusChangeSupport.removePropertyChangeListener(propertyChangeListener);
-        }
-        this.msgListeners.clear();
-    }
-
-    @Override
-    public boolean addMsgListener(MsgListener msgListener) {
-        if (msgListener == null) {
-            return false;
-        }
-        return this.msgListeners.add(msgListener);
-    }
-
-    @Override
-    public boolean addMsgListeners(List<MsgListener> msgListeners) {
-        if (msgListeners == null || msgListeners.isEmpty()) {
-            return false;
-        }
-        return this.msgListeners.addAll(msgListeners);
-    }
-
-    @Override
-    public boolean removeMsgListener(MsgListener msgListener) {
-        if (msgListener == null) {
-            return false;
-        }
-        return this.msgListeners.remove(msgListener);
-    }
-
-    @Override
-    public boolean removeMsgListeners(List<MsgListener> msgListeners) {
-        if (msgListeners == null || msgListeners.isEmpty()) {
-            return false;
-        }
-        return this.msgListeners.removeAll(msgListeners);
-    }
-
-    @Override
-    public void removeAllMsgListeners() {
-        this.msgListeners.clear();
-    }
-
-}

+ 0 - 135
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-client/src/main/java/tech/ordinaryroad/live/chat/client/commons/client/IBaseLiveChatClient.java

@@ -1,135 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.client;
-
-import tech.ordinaryroad.live.chat.client.commons.base.listener.IBaseMsgListener;
-
-import java.util.List;
-import java.util.function.Consumer;
-
-/**
- * @author mjz
- * @date 2023/9/5
- */
-public interface IBaseLiveChatClient<MsgListener extends IBaseMsgListener<?, ?>> {
-
-    void init();
-
-    boolean addMsgListener(MsgListener msgListener);
-
-    boolean addMsgListeners(List<MsgListener> msgListeners);
-
-    boolean removeMsgListener(MsgListener msgListener);
-
-    boolean removeMsgListeners(List<MsgListener> msgListeners);
-
-    void removeAllMsgListeners();
-
-    void connect(Runnable success, Consumer<Throwable> failed);
-
-    void connect(Runnable success);
-
-    void connect();
-
-    /**
-     * 手动断开连接
-     *
-     * @param cancelReconnect 取消本次的自动重连(如果启用自动重连)
-     */
-    void disconnect(boolean cancelReconnect);
-
-    void disconnect();
-
-    void destroy();
-
-    void send(Object msg);
-
-    void send(Object msg, Runnable success, Consumer<Throwable> failed);
-
-    void send(Object msg, Runnable success);
-
-    void send(Object msg, Consumer<Throwable> failed);
-
-    /**
-     * 发送弹幕
-     *
-     * @param danmu 弹幕内容
-     * @since 0.0.6
-     */
-    void sendDanmu(Object danmu);
-
-    /**
-     * 发送弹幕
-     *
-     * @param danmu 弹幕内容
-     * @since 0.0.6
-     */
-    void sendDanmu(Object danmu, Runnable success, Consumer<Throwable> failed);
-
-    /**
-     * 发送弹幕
-     *
-     * @param danmu 弹幕内容
-     * @since 0.0.6
-     */
-    void sendDanmu(Object danmu, Runnable success);
-
-    /**
-     * 发送弹幕
-     *
-     * @param danmu 弹幕内容
-     * @since 0.0.6
-     */
-    void sendDanmu(Object danmu, Consumer<Throwable> failed);
-
-    /**
-     * 为直播间点赞
-     *
-     * @since 0.2.0
-     */
-    void clickLike(int count);
-
-    /**
-     * 为直播间点赞
-     *
-     * @since 0.2.0
-     */
-    void clickLike(int count, Runnable success, Consumer<Throwable> failed);
-
-    /**
-     * 为直播间点赞
-     *
-     * @since 0.2.0
-     */
-    void clickLike(int count, Runnable success);
-
-    /**
-     * 为直播间点赞
-     *
-     * @since 0.2.0
-     */
-    void clickLike(int count, Consumer<Throwable> failed);
-
-}

+ 0 - 139
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-client/src/main/java/tech/ordinaryroad/live/chat/client/commons/client/config/BaseLiveChatClientConfig.java

@@ -1,139 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.client.config;
-
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-import tech.ordinaryroad.live.chat.client.commons.base.exception.BaseException;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-
-/**
- * 直播间弹幕客户端配置
- *
- * @author mjz
- * @date 2023/8/26
- */
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder(toBuilder = true)
-public abstract class BaseLiveChatClientConfig {
-
-    protected PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
-    public static final long DEFAULT_HEARTBEAT_INITIAL_DELAY = 15;
-    public static final long DEFAULT_HEARTBEAT_PERIOD = 25;
-    public static final long DEFAULT_MIN_SEND_DANMU_PERIOD = 3000L;
-
-    private String websocketUri;
-
-    /**
-     * 浏览器中的Cookie
-     */
-    private String cookie;
-
-    /**
-     * 直播间id
-     */
-    private Object roomId;
-
-    /**
-     * 是否启用自动重连
-     */
-    @Builder.Default
-    private boolean autoReconnect = Boolean.TRUE;
-
-    /**
-     * 重试延迟时间(秒),默认5s后重试
-     */
-    @Builder.Default
-    private int reconnectDelay = 5;
-
-    /**
-     * 首次发送心跳包的延迟时间(秒)
-     */
-    @Builder.Default
-    private long heartbeatInitialDelay = DEFAULT_HEARTBEAT_INITIAL_DELAY;
-
-    /**
-     * 心跳包发送周期(秒)
-     */
-    @Builder.Default
-    private long heartbeatPeriod = DEFAULT_HEARTBEAT_PERIOD;
-
-    /**
-     * 最小发送弹幕时间间隔(毫秒)
-     */
-    @Builder.Default
-    private long minSendDanmuPeriod = DEFAULT_MIN_SEND_DANMU_PERIOD;
-
-    public void setCookie(String cookie) {
-        String oldValue = this.cookie;
-        this.cookie = cookie;
-        this.propertyChangeSupport.firePropertyChange("cookie", oldValue, cookie);
-    }
-
-    public void setRoomId(Object roomId) {
-        if (!(roomId instanceof Number || roomId instanceof String)) {
-            throw new BaseException("房间ID仅支持数字或字符串,所传参数类型:" + roomId.getClass() + "值:" + roomId);
-        }
-        Object oldValue = this.roomId;
-        this.roomId = roomId;
-        this.propertyChangeSupport.firePropertyChange("roomId", oldValue, roomId);
-    }
-
-    public void setWebsocketUri(String websocketUri) {
-        String oldValue = this.websocketUri;
-        this.websocketUri = websocketUri;
-        this.propertyChangeSupport.firePropertyChange("websocketUri", oldValue, websocketUri);
-    }
-
-    public void setMinSendDanmuPeriod(long minSendDanmuPeriod) {
-        long oldValue = this.minSendDanmuPeriod;
-        this.minSendDanmuPeriod = minSendDanmuPeriod;
-        this.propertyChangeSupport.firePropertyChange("minSendDanmuPeriod", oldValue, minSendDanmuPeriod);
-    }
-
-    public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
-        this.propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
-    }
-
-    public void addPropertyChangeListener(PropertyChangeListener listener) {
-        this.propertyChangeSupport.addPropertyChangeListener(listener);
-    }
-
-    public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
-        this.propertyChangeSupport.removePropertyChangeListener(propertyName, listener);
-    }
-
-    public void removePropertyChangeListener(PropertyChangeListener listener) {
-        this.propertyChangeSupport.removePropertyChangeListener(listener);
-    }
-}

+ 0 - 83
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-client/src/main/java/tech/ordinaryroad/live/chat/client/commons/client/enums/ClientStatusEnums.java

@@ -1,83 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.client.enums;
-
-/**
- * @author mjz
- * @date 2023/8/26
- */
-public enum ClientStatusEnums {
-    /**
-     * 新创建
-     */
-    NEW(0),
-
-    /**
-     * 已初始化
-     */
-    INITIALIZED(1),
-
-    /**
-     * 连接中
-     */
-    CONNECTING(100),
-
-    /**
-     * 重新连接中
-     */
-    RECONNECTING(101),
-
-    /**
-     * 已连接
-     */
-    CONNECTED(200),
-
-    /**
-     * 连接失败
-     */
-    CONNECT_FAILED(401),
-
-    /**
-     * 已断开连接
-     */
-    DISCONNECTED(400),
-
-    /**
-     * 已销毁
-     */
-    DESTROYED(-1),
-    ;
-
-    public int getCode() {
-        return code;
-    }
-
-    ClientStatusEnums(int order) {
-        this.code = order;
-    }
-
-    private final int code;
-
-}

+ 0 - 25
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-util/pom.xml

@@ -1,25 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.ruoyi</groupId>
-        <artifactId>live-chat-client-commons</artifactId>
-        <version>${revision}</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-    <packaging>jar</packaging>
-
-    <artifactId>live-chat-client-commons-util</artifactId>
-    <name>live-chat-client-commons-util</name>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>cn.hutool</groupId>
-            <artifactId>hutool-all</artifactId>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 80
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-util/src/main/java/tech/ordinaryroad/live/chat/client/commons/util/OrLiveChatCookieUtil.java

@@ -1,80 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.util;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.map.MapUtil;
-import cn.hutool.core.util.StrUtil;
-
-import java.net.HttpCookie;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-
-/**
- * @author mjz
- * @date 2023/8/27
- */
-public class OrLiveChatCookieUtil {
-
-    public static String toString(List<HttpCookie> cookies) {
-        if (CollUtil.isEmpty(cookies)) {
-            return StrUtil.EMPTY;
-        }
-
-        return cookies.stream().map(httpCookie -> {
-            httpCookie.setVersion(0);
-            return httpCookie.toString();
-        }).collect(Collectors.joining("; "));
-    }
-
-    public static Map<String, String> parseCookieString(String cookies) {
-        Map<String, String> map = new HashMap<>();
-        if (StrUtil.isNotBlank(cookies) && !StrUtil.isNullOrUndefined(cookies)) {
-            try {
-                String[] split = cookies.split("; ");
-                for (String s : split) {
-                    String[] split1 = s.split("=");
-                    map.put(split1[0], split1[1]);
-                }
-            } catch (Exception e) {
-                throw new RuntimeException("cookie解析失败 " + cookies, e);
-            }
-        }
-        return map;
-    }
-
-    public static String getCookieByName(Map<String, String> cookieMap, String name, Supplier<String> supplier) {
-        String str = MapUtil.getStr(cookieMap, name);
-        return str == null ? supplier.get() : str;
-    }
-
-    public static String getCookieByName(String cookie, String name, Supplier<String> supplier) {
-        String str = MapUtil.getStr(parseCookieString(cookie), name);
-        return str == null ? supplier.get() : str;
-    }
-}

+ 0 - 40
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-util/src/main/java/tech/ordinaryroad/live/chat/client/commons/util/OrLiveChatNumberUtil.java

@@ -1,40 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.util;
-
-import cn.hutool.core.util.NumberUtil;
-import cn.hutool.core.util.StrUtil;
-
-/**
- * @author mjz
- * @date 2023/12/2
- */
-public class OrLiveChatNumberUtil extends NumberUtil {
-
-    public static long parseLong(Object object){
-        return NumberUtil.parseLong(StrUtil.toStringOrNull(object));
-    }
-
-}

+ 0 - 50
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-util/src/main/java/tech/ordinaryroad/live/chat/client/commons/util/OrLiveChatReflectUtil.java

@@ -1,50 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.util;
-
-import cn.hutool.core.util.ReflectUtil;
-
-import java.lang.reflect.Method;
-
-/**
- * @author mjz
- * @date 2023/8/28
- */
-public class OrLiveChatReflectUtil extends ReflectUtil {
-
-    public static Method getGetterMethod(Class<?> objectClass, String key) {
-        Method method;
-        if (key.startsWith("is")) {
-            method = ReflectUtil.getMethodByNameIgnoreCase(objectClass, key);
-            if (method == null) {
-                ReflectUtil.getMethodByNameIgnoreCase(objectClass, "get" + key);
-            }
-        } else {
-            method = ReflectUtil.getMethodByNameIgnoreCase(objectClass, "get" + key);
-        }
-        return method;
-    }
-
-}

+ 0 - 54
ruoyi-common/ruoyi-common-live/live-chat-client-commons/live-chat-client-commons-util/src/main/java/tech/ordinaryroad/live/chat/client/commons/util/OrLocalDateTimeUtil.java

@@ -1,54 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.commons.util;
-
-import cn.hutool.core.date.LocalDateTimeUtil;
-
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
-
-/**
- * @author mjz
- * @date 2023/9/7
- */
-public class OrLocalDateTimeUtil extends LocalDateTimeUtil {
-
-    public static ZoneId ZONE_ID_CTT = ZoneId.of(ZoneId.SHORT_IDS.get("CTT"));
-
-    /**
-     * 获取中国标准时间的当前时间戳(毫秒)
-     */
-    public static long zonedCurrentTimeMillis() {
-        ZonedDateTime now = ZonedDateTime.now(ZONE_ID_CTT);
-        return now.toEpochSecond() * 1000 + now.getNano() / 1_000_000;
-    }
-
-    /**
-     * 获取中国标准时间的当前时间戳(秒)
-     */
-    public static long zonedCurrentTimeSecs() {
-        return ZonedDateTime.now(ZONE_ID_CTT).toEpochSecond();
-    }
-}

+ 0 - 44
ruoyi-common/ruoyi-common-live/live-chat-client-commons/pom.xml

@@ -1,44 +0,0 @@
-<!--
-  ~ MIT License
-  ~
-  ~ Copyright (c) 2023 OrdinaryRoad
-  ~
-  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
-  ~ of this software and associated documentation files (the "Software"), to deal
-  ~ in the Software without restriction, including without limitation the rights
-  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-  ~ copies of the Software, and to permit persons to whom the Software is
-  ~ furnished to do so, subject to the following conditions:
-  ~
-  ~ The above copyright notice and this permission notice shall be included in all
-  ~ copies or substantial portions of the Software.
-  ~
-  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-  ~ SOFTWARE.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.ruoyi</groupId>
-        <artifactId>ruoyi-common-live</artifactId>
-        <version>${revision}</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <packaging>pom</packaging>
-
-    <artifactId>live-chat-client-commons</artifactId>
-
-    <modules>
-        <module>live-chat-client-commons-base</module>
-        <module>live-chat-client-commons-util</module>
-        <module>live-chat-client-commons-client</module>
-    </modules>
-</project>

+ 0 - 55
ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty-client/pom.xml

@@ -1,55 +0,0 @@
-<!--
-  ~ MIT License
-  ~
-  ~ Copyright (c) 2023 OrdinaryRoad
-  ~
-  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
-  ~ of this software and associated documentation files (the "Software"), to deal
-  ~ in the Software without restriction, including without limitation the rights
-  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-  ~ copies of the Software, and to permit persons to whom the Software is
-  ~ furnished to do so, subject to the following conditions:
-  ~
-  ~ The above copyright notice and this permission notice shall be included in all
-  ~ copies or substantial portions of the Software.
-  ~
-  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-  ~ SOFTWARE.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.ruoyi</groupId>
-        <artifactId>live-chat-client-servers</artifactId>
-        <version>${revision}</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <packaging>jar</packaging>
-
-    <artifactId>live-chat-client-servers-netty-client</artifactId>
-    <name>live-chat-client-servers-netty</name>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.ruoyi</groupId>
-            <artifactId>live-chat-client-commons-client</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.ruoyi</groupId>
-            <artifactId>live-chat-client-servers-netty</artifactId>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 349
ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty-client/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/client/base/BaseNettyClient.java

@@ -1,349 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.servers.netty.client.base;
-
-import io.netty.bootstrap.Bootstrap;
-import io.netty.channel.*;
-import io.netty.channel.socket.SocketChannel;
-import io.netty.channel.socket.nio.NioSocketChannel;
-import io.netty.handler.codec.http.HttpClientCodec;
-import io.netty.handler.codec.http.HttpObjectAggregator;
-import io.netty.handler.ssl.SslContext;
-import io.netty.handler.ssl.SslContextBuilder;
-import io.netty.handler.stream.ChunkedWriteHandler;
-import lombok.Getter;
-import lombok.extern.slf4j.Slf4j;
-import tech.ordinaryroad.live.chat.client.commons.base.exception.BaseException;
-import tech.ordinaryroad.live.chat.client.commons.base.listener.IBaseConnectionListener;
-import tech.ordinaryroad.live.chat.client.commons.base.listener.IBaseMsgListener;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.IMsg;
-import tech.ordinaryroad.live.chat.client.commons.client.BaseLiveChatClient;
-import tech.ordinaryroad.live.chat.client.commons.client.enums.ClientStatusEnums;
-import tech.ordinaryroad.live.chat.client.servers.netty.client.config.BaseNettyClientConfig;
-import tech.ordinaryroad.live.chat.client.servers.netty.handler.base.BaseBinaryFrameHandler;
-import tech.ordinaryroad.live.chat.client.servers.netty.handler.base.BaseConnectionHandler;
-
-import javax.net.ssl.SSLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Consumer;
-
-/**
- * @author mjz
- * @date 2023/8/26
- */
-@Slf4j
-public abstract class BaseNettyClient
-        <Config extends BaseNettyClientConfig,
-                CmdEnum extends Enum<CmdEnum>,
-                Msg extends IMsg,
-                MsgListener extends IBaseMsgListener<BinaryFrameHandler, CmdEnum>,
-                ConnectionHandler extends BaseConnectionHandler<ConnectionHandler>,
-                BinaryFrameHandler extends BaseBinaryFrameHandler<BinaryFrameHandler, CmdEnum, Msg, MsgListener>
-                >
-        extends BaseLiveChatClient<Config, MsgListener> {
-
-    @Getter
-    private final EventLoopGroup workerGroup;
-    @Getter
-    private final Bootstrap bootstrap = new Bootstrap();
-    private BinaryFrameHandler binaryFrameHandler;
-    private ConnectionHandler connectionHandler;
-    private IBaseConnectionListener<ConnectionHandler> connectionListener;
-    private Channel channel;
-    @Getter
-    private URI websocketUri;
-    protected IBaseConnectionListener<ConnectionHandler> clientConnectionListener;
-    /**
-     * 控制弹幕发送频率
-     */
-    private volatile long lastSendDanmuTimeInMillis;
-
-    public abstract ConnectionHandler initConnectionHandler(IBaseConnectionListener<ConnectionHandler> clientConnectionListener);
-
-    public abstract BinaryFrameHandler initBinaryFrameHandler();
-
-    protected BaseNettyClient(Config config, EventLoopGroup workerGroup, IBaseConnectionListener<ConnectionHandler> connectionListener) {
-        super(config);
-        this.workerGroup = workerGroup;
-        this.connectionListener = connectionListener;
-    }
-
-    public void onConnected(ConnectionHandler connectionHandler) {
-        this.setStatus(ClientStatusEnums.CONNECTED);
-        if (this.connectionListener != null) {
-            this.connectionListener.onConnected(connectionHandler);
-        }
-    }
-
-    public void onConnectFailed(ConnectionHandler connectionHandler) {
-        this.setStatus(ClientStatusEnums.CONNECT_FAILED);
-        tryReconnect();
-        if (this.connectionListener != null) {
-            this.connectionListener.onConnectFailed(connectionHandler);
-        }
-    }
-
-    public void onDisconnected(ConnectionHandler connectionHandler) {
-        this.setStatus(ClientStatusEnums.DISCONNECTED);
-        tryReconnect();
-        if (this.connectionListener != null) {
-            this.connectionListener.onDisconnected(connectionHandler);
-        }
-    }
-
-    @Override
-    public void init() {
-        if (checkStatus(ClientStatusEnums.INITIALIZED)) {
-            return;
-        }
-        try {
-            this.websocketUri = new URI(getWebSocketUriString());
-            SslContext sslCtx = SslContextBuilder.forClient().build();
-
-            this.clientConnectionListener = new IBaseConnectionListener<ConnectionHandler>() {
-                @Override
-                public void onConnected(ConnectionHandler connectionHandler) {
-                    BaseNettyClient.this.onConnected(connectionHandler);
-                }
-
-                @Override
-                public void onConnectFailed(ConnectionHandler connectionHandler) {
-                    BaseNettyClient.this.onConnectFailed(connectionHandler);
-                }
-
-                @Override
-                public void onDisconnected(ConnectionHandler connectionHandler) {
-                    BaseNettyClient.this.onDisconnected(connectionHandler);
-                }
-            };
-            this.binaryFrameHandler = this.initBinaryFrameHandler();
-            this.connectionHandler = this.initConnectionHandler(this.clientConnectionListener);
-
-            this.bootstrap.group(this.workerGroup)
-                    // 创建Channel
-                    .channel(NioSocketChannel.class)
-                    .remoteAddress(this.websocketUri.getHost(), getInetPort())
-                    .option(ChannelOption.TCP_NODELAY, true)
-                    .option(ChannelOption.SO_KEEPALIVE, true)
-                    // Channel配置
-                    .handler(new ChannelInitializer<SocketChannel>() {
-                        @Override
-                        protected void initChannel(SocketChannel ch) {
-                            // 责任链
-                            ChannelPipeline pipeline = ch.pipeline();
-
-                            // 放到第一位 addFirst 支持wss链接服务端
-                            pipeline.addFirst(sslCtx.newHandler(ch.alloc(), BaseNettyClient.this.websocketUri.getHost(), getInetPort()));
-
-                            // 添加一个http的编解码器
-                            pipeline.addLast(new HttpClientCodec());
-                            // 添加一个用于支持大数据流的支持
-                            pipeline.addLast(new ChunkedWriteHandler());
-                            // 添加一个聚合器,这个聚合器主要是将HttpMessage聚合成FullHttpRequest/Response
-                            pipeline.addLast(new HttpObjectAggregator(BaseNettyClient.this.getConfig().getAggregatorMaxContentLength()));
-
-                            // 连接处理器
-                            pipeline.addLast(BaseNettyClient.this.connectionHandler);
-                            // 弹幕处理器
-                            pipeline.addLast(BaseNettyClient.this.binaryFrameHandler);
-                        }
-                    });
-            this.setStatus(ClientStatusEnums.INITIALIZED);
-        } catch (URISyntaxException e) {
-            throw new BaseException(e);
-        } catch (SSLException e) {
-            throw new BaseException(e);
-        }
-    }
-
-    private int getInetPort() {
-        int port = this.websocketUri.getPort();
-        return port == -1 ? "wss".equalsIgnoreCase(websocketUri.getScheme()) ? 443 : 80 : port;
-    }
-
-    @Override
-    public void connect(Runnable success, Consumer<Throwable> failed) {
-        if (this.cancelReconnect) {
-            this.cancelReconnect = false;
-        }
-        if (!checkStatus(ClientStatusEnums.INITIALIZED)) {
-            return;
-        }
-        if (getStatus() == ClientStatusEnums.CONNECTED) {
-            return;
-        }
-        if (getStatus() != ClientStatusEnums.RECONNECTING) {
-            this.setStatus(ClientStatusEnums.CONNECTING);
-        }
-        this.bootstrap.connect().addListener((ChannelFutureListener) connectFuture -> {
-            if (connectFuture.isSuccess()) {
-                if (log.isDebugEnabled()) {
-                    log.debug("连接建立成功!");
-                }
-                this.channel = connectFuture.channel();
-                // 监听是否握手成功
-                this.connectionHandler.getHandshakeFuture().addListener((ChannelFutureListener) handshakeFuture -> {
-                    try {
-                        connectionHandler.sendAuthRequest(channel);
-                        if (success != null) {
-                            success.run();
-                        }
-                    } catch (Exception e) {
-                        log.error("认证包发送失败,断开连接", e);
-                        this.disconnect();
-                    }
-                });
-            } else {
-                log.error("连接建立失败", connectFuture.cause());
-                this.onConnectFailed(this.connectionHandler);
-                if (failed != null) {
-                    failed.accept(connectFuture.cause());
-                }
-            }
-        });
-    }
-
-    @Override
-    public void disconnect() {
-        if (this.channel == null) {
-            return;
-        }
-        this.channel.close();
-    }
-
-    @Override
-    protected void tryReconnect() {
-        if (this.cancelReconnect) {
-            this.cancelReconnect = false;
-            return;
-        }
-        if (!getConfig().isAutoReconnect()) {
-            return;
-        }
-        if (log.isWarnEnabled()) {
-            log.warn("{}s后将重新连接 {}", getConfig().getReconnectDelay(), getConfig().getRoomId());
-        }
-        workerGroup.schedule(() -> {
-            this.setStatus(ClientStatusEnums.RECONNECTING);
-            this.connect();
-        }, getConfig().getReconnectDelay(), TimeUnit.SECONDS);
-    }
-
-    @Override
-    public void send(Object msg, Runnable success, Consumer<Throwable> failed) {
-        ChannelFuture future = this.channel.writeAndFlush(msg);
-        if (success != null || failed != null) {
-            future.addListener((ChannelFutureListener) channelFuture -> {
-                if (channelFuture.isSuccess()) {
-                    if (success != null) {
-                        success.run();
-                    }
-                } else {
-                    if (failed != null) {
-                        failed.accept(channelFuture.cause());
-                    }
-                }
-            });
-        }
-    }
-
-    @Override
-    public void destroy() {
-        super.destroy();
-
-        // 销毁时不需要重连
-        this.cancelReconnect = true;
-        workerGroup.shutdownGracefully().addListener(future -> {
-            if (future.isSuccess()) {
-                this.setStatus(ClientStatusEnums.DESTROYED);
-            } else {
-                throw new BaseException("client销毁失败", future.cause());
-            }
-        });
-    }
-
-    @Override
-    protected String getWebSocketUriString() {
-        return getConfig().getWebsocketUri();
-    }
-
-    @Override
-    protected void setStatus(ClientStatusEnums status) {
-        if (log.isDebugEnabled()) {
-            if (getStatus() != status) {
-                log.debug("{} 状态变化 {} => {}\n", getClass().getSimpleName(), getStatus(), status);
-            }
-        }
-        super.setStatus(status);
-    }
-
-    @Override
-    public void sendDanmu(Object danmu, Runnable success, Consumer<Throwable> failed) {
-        throw new BaseException("暂未支持该功能");
-    }
-
-    @Override
-    public void clickLike(int count, Runnable success, Consumer<Throwable> failed) {
-        throw new BaseException("暂未支持该功能");
-    }
-
-    /**
-     * 发送弹幕前判断是否可以发送
-     *
-     * @param checkConnected 是否检查Client连接状态
-     */
-    protected boolean checkCanSendDanmu(boolean checkConnected) {
-        if (checkConnected && getStatus() != ClientStatusEnums.CONNECTED) {
-            throw new BaseException("连接未建立,无法发送弹幕");
-        }
-        if (System.currentTimeMillis() - this.lastSendDanmuTimeInMillis <= getConfig().getMinSendDanmuPeriod()) {
-            if (log.isWarnEnabled()) {
-                log.warn("发送弹幕频率过快,忽略该次发送");
-            }
-            return false;
-        }
-        return true;
-    }
-
-    protected boolean checkCanSendDanmu() {
-        return checkCanSendDanmu(true);
-    }
-
-    /**
-     * 发送弹幕后调用该方法
-     */
-    protected void finishSendDanmu() {
-        this.lastSendDanmuTimeInMillis = System.currentTimeMillis();
-        if (log.isDebugEnabled()) {
-            log.debug("弹幕发送完成");
-        }
-    }
-
-    public void iteratorMsgListeners(Consumer<MsgListener> consumer) {
-        binaryFrameHandler.iteratorMsgListeners(consumer);
-    }
-}

+ 0 - 65
ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty-client/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/client/config/BaseNettyClientConfig.java

@@ -1,65 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.servers.netty.client.config;
-
-import io.netty.handler.codec.http.HttpHeaders;
-import io.netty.handler.codec.http.HttpObjectAggregator;
-import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakerFactory;
-import io.netty.handler.codec.http.websocketx.WebSocketVersion;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-import tech.ordinaryroad.live.chat.client.commons.client.config.BaseLiveChatClientConfig;
-
-import java.net.URI;
-
-/**
- * @author mjz
- * @date 2023/8/26
- */
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder(toBuilder = true)
-public abstract class BaseNettyClientConfig extends BaseLiveChatClientConfig {
-
-    /**
-     * 聚合器允许的最大消息体长度,默认 64*1024 byte
-     *
-     * @see HttpObjectAggregator#HttpObjectAggregator(int)
-     */
-    @Builder.Default
-    private int aggregatorMaxContentLength = 64 * 1024;
-
-    /**
-     * WebSocketClientHandshaker最大消息体长度,默认 64*1024 byte
-     *
-     * @see WebSocketClientHandshakerFactory#newHandshaker(URI, WebSocketVersion, String, boolean, HttpHeaders, int)
-     */
-    @Builder.Default
-    private int maxFramePayloadLength = 64 * 1024;
-}

+ 0 - 66
ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty-client/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/client/handler/BaseNettyClientBinaryFrameHandler.java

@@ -1,66 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.servers.netty.client.handler;
-
-import lombok.Getter;
-import tech.ordinaryroad.live.chat.client.commons.base.listener.IBaseMsgListener;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.IMsg;
-import tech.ordinaryroad.live.chat.client.servers.netty.client.base.BaseNettyClient;
-import tech.ordinaryroad.live.chat.client.servers.netty.handler.base.BaseBinaryFrameHandler;
-
-import java.util.List;
-
-/**
- * BaseClientBinaryFrameHandler
- *
- * @author mjz
- * @date 2023/8/30
- */
-public abstract class BaseNettyClientBinaryFrameHandler<
-        Client extends BaseNettyClient<?, ?, ?, ?, ?, ?>,
-        BinaryFrameHandler extends BaseBinaryFrameHandler<BinaryFrameHandler, CmdEnum, Msg, MsgListener>,
-        CmdEnum extends Enum<CmdEnum>,
-        Msg extends IMsg,
-        MsgListener extends IBaseMsgListener<BinaryFrameHandler, CmdEnum>>
-        extends BaseBinaryFrameHandler<BinaryFrameHandler, CmdEnum, Msg, MsgListener> {
-
-    @Getter
-    protected final Client client;
-
-    public BaseNettyClientBinaryFrameHandler(List<MsgListener> msgListeners, Client client, long roomId) {
-        super(msgListeners, roomId);
-        this.client = client;
-    }
-
-    public BaseNettyClientBinaryFrameHandler(List<MsgListener> msgListeners, Client client) {
-        super(msgListeners, client.getConfig().getRoomId());
-        this.client = client;
-    }
-
-    public BaseNettyClientBinaryFrameHandler(List<MsgListener> msgListeners, long roomId) {
-        super(msgListeners, roomId);
-        this.client = null;
-    }
-}

+ 0 - 65
ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty-client/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/client/handler/BaseNettyClientConnectionHandler.java

@@ -1,65 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.servers.netty.client.handler;
-
-import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker;
-import lombok.Getter;
-import tech.ordinaryroad.live.chat.client.commons.base.listener.IBaseConnectionListener;
-import tech.ordinaryroad.live.chat.client.servers.netty.client.base.BaseNettyClient;
-import tech.ordinaryroad.live.chat.client.servers.netty.handler.base.BaseConnectionHandler;
-
-/**
- * BaseClientConnectionHandler
- *
- * @author mjz
- * @date 2023/8/27
- */
-public abstract class BaseNettyClientConnectionHandler<
-        Client extends BaseNettyClient<?, ?, ?, ?, ?, ?>,
-        ConnectionHandler extends BaseConnectionHandler<ConnectionHandler>>
-        extends BaseConnectionHandler<ConnectionHandler> {
-
-    @Getter
-    protected final Client client;
-
-    public BaseNettyClientConnectionHandler(WebSocketClientHandshaker handshaker, Client client, IBaseConnectionListener<ConnectionHandler> listener) {
-        super(handshaker, listener);
-        this.client = client;
-    }
-
-    public BaseNettyClientConnectionHandler(WebSocketClientHandshaker handshaker, Client client) {
-        this(handshaker, client, null);
-    }
-
-    public BaseNettyClientConnectionHandler(WebSocketClientHandshaker handshaker, IBaseConnectionListener<ConnectionHandler> listener) {
-        super(handshaker, listener);
-        this.client = null;
-    }
-
-    public BaseNettyClientConnectionHandler(WebSocketClientHandshaker handshaker, long roomId) {
-        super(handshaker, null);
-        this.client = null;
-    }
-}

+ 0 - 59
ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty/pom.xml

@@ -1,59 +0,0 @@
-<!--
-  ~ MIT License
-  ~
-  ~ Copyright (c) 2023 OrdinaryRoad
-  ~
-  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
-  ~ of this software and associated documentation files (the "Software"), to deal
-  ~ in the Software without restriction, including without limitation the rights
-  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-  ~ copies of the Software, and to permit persons to whom the Software is
-  ~ furnished to do so, subject to the following conditions:
-  ~
-  ~ The above copyright notice and this permission notice shall be included in all
-  ~ copies or substantial portions of the Software.
-  ~
-  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-  ~ SOFTWARE.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.ruoyi</groupId>
-        <artifactId>live-chat-client-servers</artifactId>
-        <version>${revision}</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-    <packaging>jar</packaging>
-
-    <artifactId>live-chat-client-servers-netty</artifactId>
-    <name>live-chat-client-servers-netty</name>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.ruoyi</groupId>
-            <artifactId>live-chat-client-commons-base</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>io.netty</groupId>
-            <artifactId>netty-all</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-classic</artifactId>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 39
ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/frame/base/BaseBinaryWebSocketFrame.java

@@ -1,39 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.servers.netty.frame.base;
-
-import io.netty.buffer.ByteBuf;
-import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
-
-/**
- * @author mjz
- * @date 2023/1/5
- */
-public abstract class BaseBinaryWebSocketFrame extends BinaryWebSocketFrame {
-
-    public BaseBinaryWebSocketFrame(ByteBuf byteBuf) {
-        super(byteBuf);
-    }
-}

+ 0 - 184
ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/handler/base/BaseBinaryFrameHandler.java

@@ -1,184 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.servers.netty.handler.base;
-
-import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;
-import io.netty.buffer.ByteBuf;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.SimpleChannelInboundHandler;
-import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
-import lombok.Getter;
-import lombok.extern.slf4j.Slf4j;
-import tech.ordinaryroad.live.chat.client.commons.base.listener.IBaseMsgListener;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.BaseCmdMsg;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.BaseMsg;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.ICmdMsg;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.IMsg;
-
-import java.util.List;
-import java.util.function.Consumer;
-
-
-/**
- * 消息处理器
- *
- * @author mjz
- * @date 2023/1/4
- */
-@Slf4j
-public abstract class BaseBinaryFrameHandler<
-        T extends BaseBinaryFrameHandler<?, ?, ?, ?>,
-        CmdEnum extends Enum<CmdEnum>,
-        Msg extends IMsg,
-        MsgListener extends IBaseMsgListener<T, CmdEnum>
-        > extends SimpleChannelInboundHandler<BinaryWebSocketFrame>
-        implements IBaseMsgListener<T, CmdEnum> {
-
-    @Getter
-    private final Object roomId;
-    protected final List<MsgListener> msgListeners;
-
-    public BaseBinaryFrameHandler(List<MsgListener> msgListeners, Object roomId) {
-        this.msgListeners = msgListeners;
-        this.roomId = roomId;
-        if (this.msgListeners == null || this.msgListeners.isEmpty()) {
-            if (log.isDebugEnabled()) {
-                log.debug("listener not set");
-            }
-        }
-    }
-
-    /**
-     * 解码收到的二进制流
-     *
-     * @param byteBuf ByteBuf
-     * @return List<Msg>
-     */
-    protected abstract List<Msg> decode(ByteBuf byteBuf);
-
-    @SuppressWarnings("unchecked")
-    protected void channelRead0(ChannelHandlerContext ctx, BinaryWebSocketFrame message) {
-        ByteBuf byteBuf = message.content();
-        List<Msg> msgList = this.decode(byteBuf);
-        if (msgList == null || msgList.isEmpty()) {
-            if (log.isDebugEnabled()) {
-                log.debug("msgList is empty");
-            }
-            return;
-        }
-        for (Msg msg : msgList) {
-            this.onMsg((T) BaseBinaryFrameHandler.this, msg);
-            if (msg instanceof ICmdMsg<?>) {
-                ICmdMsg<?> cmdMsg = (ICmdMsg<?>) msg;
-                Enum<?> cmdEnum = cmdMsg.getCmdEnum();
-                if (cmdEnum == null) {
-                    this.onUnknownCmd((T) BaseBinaryFrameHandler.this, cmdMsg.getCmd(), cmdMsg);
-                } else {
-                    this.onCmdMsg((T) BaseBinaryFrameHandler.this, (CmdEnum) cmdEnum, (ICmdMsg<CmdEnum>) cmdMsg);
-                }
-            }
-            if (msg instanceof BaseCmdMsg<?>) {
-                BaseCmdMsg<?> cmdMsg = (BaseCmdMsg<?>) msg;
-                Enum<?> cmdEnum = cmdMsg.getCmdEnum();
-                if (cmdEnum == null) {
-                    this.onUnknownCmd((T) BaseBinaryFrameHandler.this, cmdMsg.getCmd(), cmdMsg);
-                } else {
-                    this.onCmdMsg((T) BaseBinaryFrameHandler.this, (CmdEnum) cmdEnum, (BaseCmdMsg<CmdEnum>) cmdMsg);
-                }
-            }
-        }
-    }
-
-    @Override
-    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
-        if (cause.getCause() instanceof UnrecognizedPropertyException) {
-            log.error("缺少字段:{}", cause.getMessage());
-        } else {
-            super.exceptionCaught(ctx, cause);
-        }
-    }
-
-    @Override
-    public void onMsg(T t, IMsg msg) {
-        IBaseMsgListener.super.onMsg(t, msg);
-        iteratorMsgListeners(msgListener -> msgListener.onMsg(t, msg));
-    }
-
-    /**
-     * 重写该方法,判断CMD,或者调用{@link IBaseMsgListener#onOtherCmdMsg(Object, Enum, ICmdMsg)}
-     *
-     * @param t      BaseBinaryFrameHandler
-     * @param cmd    CmdEnum
-     * @param cmdMsg BaseMsg
-     */
-    @Override
-    public void onCmdMsg(T t, CmdEnum cmd, ICmdMsg<CmdEnum> cmdMsg) {
-        IBaseMsgListener.super.onCmdMsg(t, cmd, cmdMsg);
-        iteratorMsgListeners(msgListener -> msgListener.onCmdMsg(t, cmd, cmdMsg));
-    }
-
-    @Override
-    public void onUnknownCmd(T t, String cmdString, IMsg msg) {
-        IBaseMsgListener.super.onUnknownCmd(t, cmdString, msg);
-        iteratorMsgListeners(msgListener -> msgListener.onUnknownCmd(t, cmdString, msg));
-    }
-
-    @SuppressWarnings("ForLoopReplaceableByForEach")
-    public void iteratorMsgListeners(Consumer<MsgListener> consumer) {
-        if (msgListeners.isEmpty()) {
-            return;
-        }
-        for (int i = 0; i < msgListeners.size(); i++) {
-            consumer.accept(msgListeners.get(i));
-        }
-    }
-
-    @Override
-    public void onCmdMsg(T t, CmdEnum cmd, BaseCmdMsg<CmdEnum> cmdMsg) {
-        IBaseMsgListener.super.onCmdMsg(t, cmd, cmdMsg);
-        iteratorMsgListeners(msgListener -> msgListener.onCmdMsg(t, cmd, cmdMsg));
-    }
-
-    @Override
-    public void onUnknownCmd(T t, String cmdString, BaseMsg msg) {
-        IBaseMsgListener.super.onUnknownCmd(t, cmdString, msg);
-        iteratorMsgListeners(msgListener -> msgListener.onUnknownCmd(t, cmdString, msg));
-    }
-
-    public String getRoomIdAsString() {
-        if (this.roomId == null) {
-            return "";
-        }
-        return this.roomId.toString();
-    }
-
-    public long getRoomIdAsLong() {
-        String roomIdAsString = this.getRoomIdAsString();
-        if (roomIdAsString.trim().isEmpty()) {
-            return 0L;
-        }
-        return Long.parseLong(roomIdAsString);
-    }
-}

+ 0 - 168
ruoyi-common/ruoyi-common-live/live-chat-client-servers/live-chat-client-servers-netty/src/main/java/tech/ordinaryroad/live/chat/client/servers/netty/handler/base/BaseConnectionHandler.java

@@ -1,168 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.servers.netty.handler.base;
-
-import io.netty.channel.Channel;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.ChannelPromise;
-import io.netty.channel.SimpleChannelInboundHandler;
-import io.netty.handler.codec.http.FullHttpResponse;
-import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker;
-import io.netty.handler.codec.http.websocketx.WebSocketHandshakeException;
-import io.netty.handler.ssl.SslCloseCompletionEvent;
-import io.netty.handler.ssl.SslHandshakeCompletionEvent;
-import io.netty.util.concurrent.ScheduledFuture;
-import lombok.Getter;
-import lombok.extern.slf4j.Slf4j;
-import tech.ordinaryroad.live.chat.client.commons.base.listener.IBaseConnectionListener;
-
-import java.util.concurrent.TimeUnit;
-
-
-/**
- * 连接处理器
- *
- * @author mjz
- * @date 2023/8/21
- */
-@Slf4j
-public abstract class BaseConnectionHandler<ConnectionHandler extends BaseConnectionHandler<?>> extends SimpleChannelInboundHandler<FullHttpResponse> {
-
-    private final WebSocketClientHandshaker handshaker;
-    @Getter
-    private ChannelPromise handshakeFuture;
-    private final IBaseConnectionListener<ConnectionHandler> listener;
-    /**
-     * 客户端发送心跳包
-     */
-    private ScheduledFuture<?> scheduledFuture = null;
-
-    public BaseConnectionHandler(WebSocketClientHandshaker handshaker, IBaseConnectionListener<ConnectionHandler> listener) {
-        this.handshaker = handshaker;
-        this.listener = listener;
-    }
-
-    public BaseConnectionHandler(WebSocketClientHandshaker handshaker) {
-        this(handshaker, null);
-    }
-
-
-    @Override
-    public void handlerAdded(ChannelHandlerContext ctx) {
-        this.handshakeFuture = ctx.newPromise();
-    }
-
-    @Override
-    public void channelActive(ChannelHandlerContext ctx) {
-        this.handshaker.handshake(ctx.channel());
-    }
-
-    protected void channelRead0(ChannelHandlerContext ctx, FullHttpResponse msg) throws Exception {
-        // 判断是否正确握手
-        if (this.handshaker.isHandshakeComplete()) {
-            handshakeSuccessfully(ctx, msg);
-        } else {
-            try {
-                handshakeSuccessfully(ctx, msg);
-            } catch (WebSocketHandshakeException e) {
-                handshakeFailed(msg, e);
-            }
-        }
-    }
-
-    @Override
-    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
-        if (log.isDebugEnabled()) {
-            log.debug("userEventTriggered {}", evt.getClass());
-        }
-        if (evt instanceof SslHandshakeCompletionEvent) {
-            heartbeatCancel();
-            heartbeatStart(ctx);
-            if (this.listener != null) {
-                listener.onConnected((ConnectionHandler) BaseConnectionHandler.this);
-            }
-        } else if (evt instanceof SslCloseCompletionEvent) {
-            heartbeatCancel();
-            if (this.listener != null) {
-                listener.onDisconnected((ConnectionHandler) BaseConnectionHandler.this);
-            }
-        } else {
-            log.error("待处理 {}", evt.getClass());
-        }
-        super.userEventTriggered(ctx, evt);
-    }
-
-    /**
-     * 开始发送心跳包
-     */
-    private void heartbeatStart(ChannelHandlerContext ctx) {
-        scheduledFuture = ctx.executor().scheduleAtFixedRate(() -> {
-            sendHeartbeat(ctx);
-        }, getHeartbeatInitialDelay(), getHeartbeatPeriod(), TimeUnit.SECONDS);
-    }
-
-    /**
-     * 取消发送心跳包
-     */
-    private void heartbeatCancel() {
-        if (null != scheduledFuture && !scheduledFuture.isCancelled()) {
-            scheduledFuture.cancel(true);
-            scheduledFuture = null;
-        }
-    }
-
-    protected abstract void sendHeartbeat(ChannelHandlerContext ctx);
-
-    public abstract void sendAuthRequest(Channel channel);
-
-    protected abstract long getHeartbeatPeriod();
-
-    protected abstract long getHeartbeatInitialDelay();
-
-    private void handshakeSuccessfully(ChannelHandlerContext ctx, FullHttpResponse msg) {
-        if (log.isDebugEnabled()) {
-            log.debug("握手完成!");
-        }
-        this.handshaker.finishHandshake(ctx.channel(), msg);
-        this.handshakeFuture.setSuccess();
-    }
-
-    private void handshakeFailed(FullHttpResponse msg, WebSocketHandshakeException e) {
-        log.error("握手失败!status:" + msg.status(), e);
-        this.handshakeFuture.setFailure(e);
-        if (listener != null) {
-            this.listener.onConnectFailed((ConnectionHandler) this);
-        }
-    }
-
-    @Override
-    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
-        log.error("exceptionCaught", cause);
-        if (!this.handshakeFuture.isDone()) {
-            this.handshakeFuture.setFailure(cause);
-        }
-        ctx.close();
-    }
-}

+ 0 - 47
ruoyi-common/ruoyi-common-live/live-chat-client-servers/pom.xml

@@ -1,47 +0,0 @@
-<!--
-  ~ MIT License
-  ~
-  ~ Copyright (c) 2023 OrdinaryRoad
-  ~
-  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
-  ~ of this software and associated documentation files (the "Software"), to deal
-  ~ in the Software without restriction, including without limitation the rights
-  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-  ~ copies of the Software, and to permit persons to whom the Software is
-  ~ furnished to do so, subject to the following conditions:
-  ~
-  ~ The above copyright notice and this permission notice shall be included in all
-  ~ copies or substantial portions of the Software.
-  ~
-  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-  ~ SOFTWARE.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.ruoyi</groupId>
-        <artifactId>ruoyi-common-live</artifactId>
-        <version>${revision}</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-    <packaging>pom</packaging>
-
-    <artifactId>live-chat-client-servers</artifactId>
-    <name>live-chat-client-servers</name>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    </properties>
-
-    <modules>
-        <module>live-chat-client-servers-netty</module>
-        <module>live-chat-client-servers-netty-client</module>
-    </modules>
-</project>

+ 0 - 71
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/pom.xml

@@ -1,71 +0,0 @@
-<!--
-  ~ MIT License
-  ~
-  ~ Copyright (c) 2023 OrdinaryRoad
-  ~
-  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
-  ~ of this software and associated documentation files (the "Software"), to deal
-  ~ in the Software without restriction, including without limitation the rights
-  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-  ~ copies of the Software, and to permit persons to whom the Software is
-  ~ furnished to do so, subject to the following conditions:
-  ~
-  ~ The above copyright notice and this permission notice shall be included in all
-  ~ copies or substantial portions of the Software.
-  ~
-  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-  ~ SOFTWARE.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.ruoyi</groupId>
-        <artifactId>live-chat-clients</artifactId>
-        <version>${revision}</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-    <packaging>jar</packaging>
-
-    <artifactId>live-chat-client-bilibili</artifactId>
-    <name>live-chat-client-bilibili</name>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.ruoyi</groupId>
-            <artifactId>live-chat-client-servers-netty-client</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>com.aayushatharva.brotli4j</groupId>
-            <artifactId>brotli4j</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>com.google.protobuf</groupId>
-            <artifactId>protobuf-java-util</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-classic</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter</artifactId>
-            <version>${junit-jupiter.version}</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 247
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/api/BilibiliApis.java

@@ -1,247 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.api;
-
-import cn.hutool.cache.impl.TimedCache;
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.thread.ThreadUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.http.HttpRequest;
-import cn.hutool.http.HttpResponse;
-import cn.hutool.http.HttpUtil;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import lombok.*;
-import lombok.extern.slf4j.Slf4j;
-import tech.ordinaryroad.live.chat.client.bilibili.api.request.BilibiliLikeReportV3Request;
-import tech.ordinaryroad.live.chat.client.bilibili.api.request.BilibiliSendMsgRequest;
-import tech.ordinaryroad.live.chat.client.commons.base.exception.BaseException;
-import tech.ordinaryroad.live.chat.client.commons.util.OrLiveChatCookieUtil;
-
-import java.time.ZoneId;
-import java.time.ZonedDateTime;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import static tech.ordinaryroad.live.chat.client.commons.base.msg.BaseMsg.OBJECT_MAPPER;
-
-/**
- * B站API简易版
- *
- * @author mjz
- * @date 2023/5/5
- */
-@Slf4j
-public class BilibiliApis {
-
-    public static final TimedCache<Long, String> GIFT_IMG_CACHE = new TimedCache<>(TimeUnit.DAYS.toMillis(1));
-    public static final String KEY_COOKIE_CSRF = "bili_jct";
-    public static final String KEY_UID = "DedeUserID";
-
-    @SneakyThrows
-    public static RoomInitResult roomInit(long roomId, String cookie) {
-        @Cleanup
-        HttpResponse response = createGetRequest("https://api.live.bilibili.com/room/v1/Room/room_init?id=" + roomId, cookie).execute();
-        JsonNode dataJsonNode = responseInterceptor(response.body());
-        return OBJECT_MAPPER.readValue(dataJsonNode.toString(), RoomInitResult.class);
-    }
-
-    public static JsonNode roomGiftConfig(long roomId, String cookie) {
-        @Cleanup
-        HttpResponse response = createGetRequest("https://api.live.bilibili.com/xlive/web-room/v1/giftPanel/roomGiftConfig?platform=pc&source=live&build=0&global_version=0&room_id=" + roomId, cookie).execute();
-        return responseInterceptor(response.body());
-    }
-
-    /**
-     * @param roomId
-     * @param type   直播间用0
-     * @return <pre>{@code
-     * {
-     * 	"group": "live",
-     * 	"business_id": 0,
-     * 	"refresh_row_factor": 0.125,
-     * 	"refresh_rate": 100,
-     * 	"max_delay": 5000,
-     * 	"token": "-wm5-Qo4BBAztd1qp5ZJpgyTMRBhCc7yikz5d9rAd63PV46G9BMwl0R10kMM8Ilb-UieZGjLtipPrz4Cvi0DdhGFwOi8PJpFN9K-LoXh6Z_4yjEIwgRerDiMIstHzJ80J3B7wnRisAYkWA==",
-     * 	"host_list": [{
-     * 		"host": "ali-bj-live-comet-09.chat.bilibili.com",
-     * 		"port": 2243,
-     * 		"wss_port": 443,
-     * 		"ws_port": 2244
-     *        }, {
-     * 		"host": "ali-gz-live-comet-02.chat.bilibili.com",
-     * 		"port": 2243,
-     * 		"wss_port": 443,
-     * 		"ws_port": 2244
-     *    }, {
-     * 		"host": "broadcastlv.chat.bilibili.com",
-     * 		"port": 2243,
-     * 		"wss_port": 443,
-     * 		"ws_port": 2244
-     *    }]
-     * }
-     * }</pre>
-     */
-    public static JsonNode getDanmuInfo(long roomId, int type, String cookie) {
-        @Cleanup
-        HttpResponse response = createGetRequest("https://api.live.bilibili.com/xlive/web-room/v1/index/getDanmuInfo?id=" + roomId + "&type=" + type, cookie).execute();
-        return responseInterceptor(response.body());
-    }
-
-    public static String getGiftImgById(long giftId, long roomId) {
-        if (!GIFT_IMG_CACHE.containsKey(giftId)) {
-            ThreadUtil.execAsync(() -> {
-                updateGiftImgCache(roomId, null);
-            });
-        }
-
-        return GIFT_IMG_CACHE.get(giftId);
-    }
-
-    /**
-     * 更新礼物图片缓存
-     */
-    public static void updateGiftImgCache(long roomId, String cookie) {
-        JsonNode jsonNode = roomGiftConfig(roomId, cookie);
-        for (JsonNode node : jsonNode.get("global_gift").get("list")) {
-            long giftId = node.get("id").asLong();
-            String giftImgUrl = node.get("webp").asText();
-            GIFT_IMG_CACHE.put(giftId, giftImgUrl);
-        }
-    }
-
-    /**
-     * 发送弹幕
-     *
-     * @param request {@link BilibiliSendMsgRequest}
-     * @param cookie  Cookie
-     */
-    public static void sendMsg(BilibiliSendMsgRequest request, String cookie) {
-        if (StrUtil.isBlank(cookie)) {
-            throw new BaseException("发送弹幕接口cookie不能为空");
-        }
-        Map<String, Object> stringObjectMap = BeanUtil.beanToMap(request);
-        @Cleanup HttpResponse execute = HttpUtil.createPost("https://api.live.bilibili.com/msg/send")
-                .cookie(cookie)
-                .form(stringObjectMap)
-                .execute();
-        responseInterceptor(execute.body());
-    }
-
-    /**
-     * 发送弹幕
-     *
-     * @param msg        内容
-     * @param realRoomId 真实房间id
-     * @param cookie     Cookie
-     */
-    public static void sendMsg(String msg, long realRoomId, String cookie) {
-        String biliJct = OrLiveChatCookieUtil.getCookieByName(cookie, KEY_COOKIE_CSRF, () -> {
-            throw new BaseException("cookie中缺少参数" + KEY_COOKIE_CSRF);
-        });
-        BilibiliSendMsgRequest request = new BilibiliSendMsgRequest(msg, StrUtil.toString(ZonedDateTime.now(ZoneId.of("Asia/Shanghai")).toEpochSecond()), realRoomId, biliJct, biliJct);
-        sendMsg(request, cookie);
-    }
-
-    /**
-     * 为主播点赞
-     *
-     * @param request {@link BilibiliLikeReportV3Request}
-     * @param cookie  Cookie
-     */
-    public static void likeReportV3(BilibiliLikeReportV3Request request, String cookie) {
-        if (StrUtil.isBlank(cookie)) {
-            throw new BaseException("为主播点赞接口cookie不能为空");
-        }
-        Map<String, Object> stringObjectMap = BeanUtil.beanToMap(request);
-        @Cleanup HttpResponse execute = HttpUtil.createPost("https://api.live.bilibili.com/xlive/app-ucenter/v1/like_info_v3/like/likeReportV3")
-                .cookie(cookie)
-                .form(stringObjectMap)
-                .execute();
-        responseInterceptor(execute.body());
-    }
-
-    /**
-     * 为主播点赞
-     *
-     * @param anchor_id  主播Uid {@link RoomInitResult#uid}
-     * @param realRoomId 真实房间Id {@link RoomInitResult#room_id}
-     * @param cookie     Cookie
-     */
-    public static void likeReportV3(long anchor_id, long realRoomId, String cookie) {
-        String uid = OrLiveChatCookieUtil.getCookieByName(cookie, KEY_UID, () -> {
-            throw new BaseException("cookie中缺少参数" + KEY_UID);
-        });
-        String biliJct = OrLiveChatCookieUtil.getCookieByName(cookie, KEY_COOKIE_CSRF, () -> {
-            throw new BaseException("cookie中缺少参数" + KEY_COOKIE_CSRF);
-        });
-        BilibiliLikeReportV3Request request = new BilibiliLikeReportV3Request(realRoomId, uid, anchor_id, biliJct, biliJct);
-        likeReportV3(request, cookie);
-    }
-
-    public static HttpRequest createGetRequest(String url, String cookies) {
-        return HttpUtil.createGet(url)
-                .cookie(cookies);
-    }
-
-    private static JsonNode responseInterceptor(String responseString) {
-        try {
-            JsonNode jsonNode = OBJECT_MAPPER.readTree(responseString);
-            int code = jsonNode.get("code").asInt();
-            if (code == 0) {
-                // 成功
-                return jsonNode.get("data");
-            } else {
-                throw new BaseException(jsonNode.get("message").asText());
-            }
-        } catch (JsonProcessingException e) {
-            throw new BaseException(e);
-        }
-    }
-
-    @Data
-    @AllArgsConstructor
-    @NoArgsConstructor
-    @Builder
-    public static class RoomInitResult {
-        private long room_id;
-        private int short_id;
-        private long uid;
-        private int need_p2p;
-        private boolean is_hidden;
-        private boolean is_locked;
-        private boolean is_portrait;
-        private int live_status;
-        private int hidden_till;
-        private int lock_till;
-        private boolean encrypted;
-        private boolean pwd_verified;
-        private long live_time;
-        private int room_shield;
-        private int is_sp;
-        private int special_type;
-    }
-
-}

+ 0 - 74
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/api/request/BilibiliLikeReportV3Request.java

@@ -1,74 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.api.request;
-
-import cn.hutool.core.util.StrUtil;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-/**
- * @author mjz
- * @date 2024/1/31
- */
-@Data
-@NoArgsConstructor
-public class BilibiliLikeReportV3Request {
-    /**
-     * 本次点赞次数
-     */
-    private int click_time = 1;
-    /**
-     * 房间真实ID
-     */
-    private long room_id;
-    /**
-     * Cookie中的DedeUserID
-     */
-    private String uid;
-    /**
-     * RoomInitResult中的uid
-     */
-    private long anchor_id;
-    /**
-     * Cookie中的bili_jct
-     */
-    private String csrf;
-    /**
-     * Cookie中的bili_jct
-     */
-    private String csrf_token;
-    /**
-     * 暂时留空
-     */
-    private String visit_id = StrUtil.EMPTY;
-
-    public BilibiliLikeReportV3Request(long room_id, String uid, long anchor_id, String csrf, String csrf_token) {
-        this.room_id = room_id;
-        this.uid = uid;
-        this.anchor_id = anchor_id;
-        this.csrf = csrf;
-        this.csrf_token = csrf_token;
-    }
-}

+ 0 - 77
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/api/request/BilibiliSendMsgRequest.java

@@ -1,77 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.api.request;
-
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-/**
- * @author mjz
- * @date 2023/9/7
- */
-@Data
-@NoArgsConstructor
-public class BilibiliSendMsgRequest {
-    private String bubble = "0";
-    /**
-     * 弹幕内容
-     */
-    private String msg;
-    /**
-     * 弹幕颜色
-     */
-    private String color = "16777215";
-    private String mode = "1";
-    private String room_type = "0";
-    private String jumpfrom = "0";
-    /**
-     * 字体大小
-     */
-    private String fontsize = "25";
-    /**
-     * 时间戳(秒)
-     */
-    private String rnd;
-    /**
-     * 房间真实ID
-     */
-    private long roomid;
-    /**
-     * Cookie中的bili_jct
-     */
-    private String csrf;
-    /**
-     * Cookie中的bili_jct
-     */
-    private String csrf_token;
-
-    public BilibiliSendMsgRequest(String msg, String rnd, long roomid, String csrf, String csrf_token) {
-        this.msg = msg;
-        this.rnd = rnd;
-        this.roomid = roomid;
-        this.csrf = csrf;
-        this.csrf_token = csrf_token;
-    }
-}

+ 0 - 184
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/client/BilibiliLiveChatClient.java

@@ -1,184 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.client;
-
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.handler.codec.http.DefaultHttpHeaders;
-import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakerFactory;
-import io.netty.handler.codec.http.websocketx.WebSocketVersion;
-import lombok.extern.slf4j.Slf4j;
-import tech.ordinaryroad.live.chat.client.bilibili.api.BilibiliApis;
-import tech.ordinaryroad.live.chat.client.bilibili.config.BilibiliLiveChatClientConfig;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.BilibiliCmdEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.listener.IBilibiliConnectionListener;
-import tech.ordinaryroad.live.chat.client.bilibili.listener.IBilibiliMsgListener;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.IBilibiliMsg;
-import tech.ordinaryroad.live.chat.client.bilibili.netty.handler.BilibiliBinaryFrameHandler;
-import tech.ordinaryroad.live.chat.client.bilibili.netty.handler.BilibiliConnectionHandler;
-import tech.ordinaryroad.live.chat.client.commons.base.exception.BaseException;
-import tech.ordinaryroad.live.chat.client.commons.base.listener.IBaseConnectionListener;
-import tech.ordinaryroad.live.chat.client.servers.netty.client.base.BaseNettyClient;
-
-import java.util.List;
-import java.util.function.Consumer;
-
-/**
- * B站直播间弹幕客户端
- *
- * @author mjz
- * @date 2023/8/20
- */
-@Slf4j
-public class BilibiliLiveChatClient extends BaseNettyClient<
-        BilibiliLiveChatClientConfig,
-        BilibiliCmdEnum,
-        IBilibiliMsg,
-        IBilibiliMsgListener,
-        BilibiliConnectionHandler,
-        BilibiliBinaryFrameHandler
-        > {
-
-    private BilibiliApis.RoomInitResult roomInitResult = new BilibiliApis.RoomInitResult();
-
-    public BilibiliLiveChatClient(BilibiliLiveChatClientConfig config, List<IBilibiliMsgListener> msgListeners, IBilibiliConnectionListener connectionListener, EventLoopGroup workerGroup) {
-        super(config, workerGroup, connectionListener);
-        addMsgListeners(msgListeners);
-
-        // 初始化
-        this.init();
-    }
-
-    public BilibiliLiveChatClient(BilibiliLiveChatClientConfig config, IBilibiliMsgListener msgListener, IBilibiliConnectionListener connectionListener, EventLoopGroup workerGroup) {
-        super(config, workerGroup, connectionListener);
-        addMsgListener(msgListener);
-
-        // 初始化
-        this.init();
-    }
-
-    public BilibiliLiveChatClient(BilibiliLiveChatClientConfig config, IBilibiliMsgListener msgListener, IBilibiliConnectionListener connectionListener) {
-        this(config, msgListener, connectionListener, new NioEventLoopGroup());
-    }
-
-    public BilibiliLiveChatClient(BilibiliLiveChatClientConfig config, IBilibiliMsgListener msgListener) {
-        this(config, msgListener, null, new NioEventLoopGroup());
-    }
-
-    public BilibiliLiveChatClient(BilibiliLiveChatClientConfig config) {
-        this(config, null);
-    }
-
-    @Override
-    public void init() {
-        roomInitResult = BilibiliApis.roomInit(getConfig().getRoomId(), getConfig().getCookie());
-        super.init();
-    }
-
-    @Override
-    public BilibiliConnectionHandler initConnectionHandler(IBaseConnectionListener<BilibiliConnectionHandler> clientConnectionListener) {
-        return new BilibiliConnectionHandler(
-                WebSocketClientHandshakerFactory.newHandshaker(getWebsocketUri(), WebSocketVersion.V13, null, true, new DefaultHttpHeaders(), getConfig().getMaxFramePayloadLength()),
-                BilibiliLiveChatClient.this, clientConnectionListener
-        );
-    }
-
-    @Override
-    public BilibiliBinaryFrameHandler initBinaryFrameHandler() {
-        return new BilibiliBinaryFrameHandler(super.msgListeners, BilibiliLiveChatClient.this);
-    }
-
-    @Override
-    public void sendDanmu(Object danmu, Runnable success, Consumer<Throwable> failed) {
-        if (!checkCanSendDanmu(false)) {
-            return;
-        }
-        if (danmu instanceof String) {
-            String msg = (String) danmu;
-            try {
-                if (log.isDebugEnabled()) {
-                    log.debug("{} bilibili发送弹幕 {}", getConfig().getRoomId(), danmu);
-                }
-
-                boolean sendSuccess = false;
-                try {
-                    BilibiliApis.sendMsg(msg, roomInitResult.getRoom_id(), getConfig().getCookie());
-                    sendSuccess = true;
-                } catch (Exception e) {
-                    log.error("bilibili弹幕发送失败", e);
-                    if (failed != null) {
-                        failed.accept(e);
-                    }
-                }
-                if (!sendSuccess) {
-                    return;
-                }
-
-                if (log.isDebugEnabled()) {
-                    log.debug("bilibili弹幕发送成功 {}", danmu);
-                }
-                if (success != null) {
-                    success.run();
-                }
-                finishSendDanmu();
-            } catch (Exception e) {
-                log.error("bilibili弹幕发送失败", e);
-                if (failed != null) {
-                    failed.accept(e);
-                }
-            }
-        } else {
-            super.sendDanmu(danmu, success, failed);
-        }
-    }
-
-    @Override
-    public void clickLike(int count, Runnable success, Consumer<Throwable> failed) {
-        if (count <= 0) {
-            throw new BaseException("点赞次数必须大于0");
-        }
-
-        boolean successfullyClicked = false;
-        try {
-            BilibiliApis.likeReportV3(roomInitResult.getUid(), roomInitResult.getRoom_id(), getConfig().getCookie());
-            successfullyClicked = true;
-        } catch (Exception e) {
-            log.error("Bilibili为直播间点赞失败", e);
-            if (failed != null) {
-                failed.accept(e);
-            }
-        }
-        if (!successfullyClicked) {
-            return;
-        }
-
-        if (log.isDebugEnabled()) {
-            log.debug("Bilibili为直播间点赞成功");
-        }
-        if (success != null) {
-            success.run();
-        }
-    }
-}

+ 0 - 67
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/config/BilibiliLiveChatClientConfig.java

@@ -1,67 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.config;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.experimental.SuperBuilder;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.ProtoverEnum;
-import tech.ordinaryroad.live.chat.client.commons.util.OrLiveChatNumberUtil;
-import tech.ordinaryroad.live.chat.client.servers.netty.client.config.BaseNettyClientConfig;
-
-/**
- * B站直播间弹幕客户端配置
- *
- * @author mjz
- * @date 2023/8/21
- */
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@SuperBuilder(toBuilder = true)
-public class BilibiliLiveChatClientConfig extends BaseNettyClientConfig {
-
-    /**
-     * @see ProtoverEnum
-     */
-    @Builder.Default
-    private ProtoverEnum protover = ProtoverEnum.NORMAL_ZLIB;
-
-    @Builder.Default
-    private String websocketUri = "wss://broadcastlv.chat.bilibili.com:443/sub";
-
-    @Override
-    public Long getRoomId() {
-        return OrLiveChatNumberUtil.parseLong(super.getRoomId());
-    }
-
-    public void setProtover(ProtoverEnum protover) {
-        ProtoverEnum oldValue = this.protover;
-        this.protover = protover;
-        super.propertyChangeSupport.firePropertyChange("protover", oldValue, protover);
-    }
-}

+ 0 - 143
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/constant/BilibiliCmdEnum.java

@@ -1,143 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.constant;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * @author mjz
- * @date 2023/1/6
- */
-@Getter
-@RequiredArgsConstructor
-public enum BilibiliCmdEnum {
-    /**
-     * 游客状态下,5分钟后会出现登录提示,弹幕中的用户名、用户id等信息将不再可见
-     */
-    LOG_IN_NOTICE,
-    /**
-     * 收到弹幕
-     */
-    DANMU_MSG,
-    /**
-     * 收到礼物
-     */
-    SEND_GIFT,
-    /**
-     * 有人上舰
-     */
-    GUARD_BUY,
-    /**
-     * 欢迎舰长
-     */
-    WELCOME_GUARD,
-    WELCOME,
-    /**
-     * 礼物连击
-     */
-    COMBO_SEND,
-    /**
-     * 欢迎高能用户、(舰长?待验证)特殊消息
-     */
-    ENTRY_EFFECT,
-    HOT_RANK_CHANGED,
-    HOT_RANK_CHANGED_V2,
-    INTERACT_WORD,
-    /**
-     * 开始直播
-     */
-    LIVE,
-    LIVE_INTERACTIVE_GAME,
-    NOTICE_MSG,
-    /**
-     * 高能榜数量更新
-     */
-    ONLINE_RANK_COUNT,
-    ONLINE_RANK_TOP3,
-    ONLINE_RANK_V2,
-    PK_BATTLE_END,
-    PK_BATTLE_FINAL_PROCESS,
-    PK_BATTLE_PROCESS,
-    PK_BATTLE_PROCESS_NEW,
-    PK_BATTLE_SETTLE,
-    PK_BATTLE_SETTLE_USER,
-    PK_BATTLE_SETTLE_V2,
-    /**
-     * 主播准备中
-     */
-    PREPARING,
-    ROOM_REAL_TIME_MESSAGE_UPDATE,
-    /**
-     * 停止直播的房间ID列表
-     */
-    STOP_LIVE_ROOM_LIST,
-    /**
-     * 醒目留言
-     */
-    SUPER_CHAT_MESSAGE,
-    SUPER_CHAT_MESSAGE_JPN,
-    /**
-     * 删除醒目留言
-     */
-    SUPER_CHAT_MESSAGE_DELETE,
-    WIDGET_BANNER,
-    /**
-     * 点赞数更新
-     */
-    LIKE_INFO_V3_UPDATE,
-    /**
-     * 为主播点赞
-     */
-    LIKE_INFO_V3_CLICK,
-    HOT_ROOM_NOTIFY,
-    /**
-     * 观看人数变化
-     */
-    WATCHED_CHANGE,
-    POPULAR_RANK_CHANGED,
-    COMMON_NOTICE_DANMAKU,
-    LIVE_MULTI_VIEW_CHANGE,
-    RECOMMEND_CARD,
-    PK_BATTLE_START_NEW,
-    PK_BATTLE_ENTRANCE,
-    AREA_RANK_CHANGED,
-    ROOM_BLOCK_MSG,
-    USER_TOAST_MSG,
-    PK_BATTLE_PRE_NEW,
-    PK_BATTLE_RANK_CHANGE,
-    PK_BATTLE_START,
-    PK_BATTLE_PRE,
-    PLAY_TAG,
-    ;
-
-    public static BilibiliCmdEnum getByString(String cmd) {
-        try {
-            return BilibiliCmdEnum.valueOf(cmd);
-        } catch (Exception e) {
-            return null;
-        }
-    }
-}

+ 0 - 86
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/constant/OperationEnum.java

@@ -1,86 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.constant;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * @author mjz
- * @date 2023/1/5
- */
-@Getter
-@RequiredArgsConstructor
-public enum OperationEnum {
-    HANDSHAKE(0),
-    HANDSHAKE_REPLY(1),
-    /**
-     * 心跳包
-     */
-    HEARTBEAT(2),
-    /**
-     * 心跳包回复(人气值)
-     */
-    HEARTBEAT_REPLY(3),
-    SEND_MSG(4),
-
-    /**
-     * 普通包(命令)
-     */
-    SEND_SMS_REPLY(5),
-    DISCONNECT_REPLY(6),
-
-    /**
-     * 认证包
-     */
-    AUTH(7),
-
-    /**
-     * 认证包回复
-     */
-    AUTH_REPLY(8),
-    RAW(9),
-    PROTO_READY(10),
-    PROTO_FINISH(11),
-    CHANGE_ROOM(12),
-    CHANGE_ROOM_REPLY(13),
-    REGISTER(14),
-    REGISTER_REPLY(15),
-    UNREGISTER(16),
-    UNREGISTER_REPLY(17),
-    ;
-
-    private final int code;
-
-    public static OperationEnum getByCode(int code) {
-        for (OperationEnum value : OperationEnum.values()) {
-            if (value.code == code) {
-                return value;
-            }
-        }
-        return null;
-    }
-
-}

+ 0 - 67
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/constant/ProtoverEnum.java

@@ -1,67 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.constant;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-/**
- * @author mjz
- * @date 2023/1/5
- */
-@Getter
-@RequiredArgsConstructor
-public enum ProtoverEnum {
-    /**
-     * 普通包正文不使用压缩
-     */
-    NORMAL_NO_COMPRESSION(0),
-    /**
-     * 心跳及认证包正文不使用压缩
-     */
-    HEARTBEAT_AUTH_NO_COMPRESSION(1),
-    /**
-     * 普通包正文使用zlib压缩
-     */
-    NORMAL_ZLIB(2),
-    /**
-     * 普通包正文使用brotli压缩,解压为一个带头部的协议0普通包
-     */
-    NORMAL_BROTLI(3),
-    ;
-
-    private final int code;
-
-
-    public static ProtoverEnum getByCode(int code) {
-        for (ProtoverEnum value : ProtoverEnum.values()) {
-            if (value.code == code) {
-                return value;
-            }
-        }
-        return null;
-    }
-
-}

+ 0 - 38
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/listener/IBilibiliConnectionListener.java

@@ -1,38 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.listener;
-
-
-import tech.ordinaryroad.live.chat.client.bilibili.netty.handler.BilibiliConnectionHandler;
-import tech.ordinaryroad.live.chat.client.commons.base.listener.IBaseConnectionListener;
-
-/**
- * 连接回调
- *
- * @author mjz
- * @date 2023/8/21
- */
-public interface IBilibiliConnectionListener extends IBaseConnectionListener<BilibiliConnectionHandler> {
-}

+ 0 - 138
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/listener/IBilibiliMsgListener.java

@@ -1,138 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.listener;
-
-import tech.ordinaryroad.live.chat.client.bilibili.constant.BilibiliCmdEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.*;
-import tech.ordinaryroad.live.chat.client.bilibili.netty.handler.BilibiliBinaryFrameHandler;
-import tech.ordinaryroad.live.chat.client.commons.base.listener.*;
-
-/**
- * @author mjz
- * @date 2023/1/7
- */
-public interface IBilibiliMsgListener extends IBaseMsgListener<BilibiliBinaryFrameHandler, BilibiliCmdEnum>,
-        IDanmuMsgListener<BilibiliBinaryFrameHandler, DanmuMsgMsg>,
-        IGiftMsgListener<BilibiliBinaryFrameHandler, SendGiftMsg>,
-        ISuperChatMsgListener<BilibiliBinaryFrameHandler, SuperChatMessageMsg>,
-        IEnterRoomMsgListener<BilibiliBinaryFrameHandler, InteractWordMsg>,
-        ILikeMsgListener<BilibiliBinaryFrameHandler, LikeInfoV3ClickMsg> {
-
-    /**
-     * 收到礼物
-     *
-     * @param binaryFrameHandler BilibiliBinaryFrameHandler
-     * @param msg                SendSmsReplyMsg
-     * @deprecated use {@link IGiftMsgListener#onGiftMsg(Object, Object)}
-     */
-    default void onSendGift(BilibiliBinaryFrameHandler binaryFrameHandler, SendSmsReplyMsg msg) {
-        this.onSendGift(msg);
-    }
-
-    /**
-     * @deprecated use {@link IGiftMsgListener#onGiftMsg(Object)}
-     */
-    default void onSendGift(SendSmsReplyMsg msg) {
-        // ignore
-    }
-
-    /**
-     * 普通用户进入直播间
-     *
-     * @param binaryFrameHandler BilibiliBinaryFrameHandler
-     * @param msg                SendSmsReplyMsg
-     * @deprecated use {@link IEnterRoomMsgListener#onEnterRoomMsg}
-     */
-    default void onEnterRoom(BilibiliBinaryFrameHandler binaryFrameHandler, SendSmsReplyMsg msg) {
-        this.onEnterRoom(msg);
-    }
-
-    /**
-     * @deprecated use {@link IEnterRoomMsgListener#onEnterRoomMsg}
-     */
-    default void onEnterRoom(SendSmsReplyMsg msg) {
-        // ignore
-    }
-
-    /**
-     * 入场效果(高能用户)
-     *
-     * @param binaryFrameHandler BilibiliBinaryFrameHandler
-     * @param sendSmsReplyMsg    SendSmsReplyMsg
-     */
-    default void onEntryEffect(BilibiliBinaryFrameHandler binaryFrameHandler, SendSmsReplyMsg sendSmsReplyMsg) {
-        this.onEntryEffect(sendSmsReplyMsg);
-    }
-
-    default void onEntryEffect(SendSmsReplyMsg sendSmsReplyMsg) {
-        // ignore
-    }
-
-    /**
-     * 观看人数变化
-     *
-     * @param binaryFrameHandler BilibiliBinaryFrameHandler
-     * @param msg                SendSmsReplyMsg
-     */
-    default void onWatchedChange(BilibiliBinaryFrameHandler binaryFrameHandler, SendSmsReplyMsg msg) {
-        this.onWatchedChange(msg);
-    }
-
-    default void onWatchedChange(SendSmsReplyMsg msg) {
-        // ignore
-    }
-
-    /**
-     * 为主播点赞
-     *
-     * @param binaryFrameHandler BilibiliBinaryFrameHandler
-     * @param msg                SendSmsReplyMsg
-     * @deprecated use {@link ILikeMsgListener#onLikeMsg}
-     */
-    default void onClickLike(BilibiliBinaryFrameHandler binaryFrameHandler, SendSmsReplyMsg msg) {
-        this.onClickLike(msg);
-    }
-
-    /**
-     * @deprecated use {@link ILikeMsgListener#onLikeMsg}
-     */
-    default void onClickLike(SendSmsReplyMsg msg) {
-        // ignore
-    }
-
-    /**
-     * 点赞数更新
-     *
-     * @param binaryFrameHandler BilibiliBinaryFrameHandler
-     * @param msg                SendSmsReplyMsg
-     */
-    default void onClickUpdate(BilibiliBinaryFrameHandler binaryFrameHandler, SendSmsReplyMsg msg) {
-        this.onClickUpdate(msg);
-    }
-
-    default void onClickUpdate(SendSmsReplyMsg msg) {
-        // ignore
-    }
-}

+ 0 - 92
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/AuthMsg.java

@@ -1,92 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.msg;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import lombok.Setter;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.OperationEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.ProtoverEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.BaseBilibiliMsg;
-
-/**
- * @author mjz
- * @date 2023/1/6
- */
-@Getter
-@Setter
-@RequiredArgsConstructor
-public class AuthMsg extends BaseBilibiliMsg {
-
-    /**
-     * 用户uid,0代表游客
-     */
-    private long uid;
-
-    /**
-     * 房间id room_id,不是短id short_id
-     * 可以通过将url参数id改为直播地址中的数字来查询房间真实id
-     * example: <a href="https://api.live.bilibili.com/room/v1/Room/room_init?id=6">https://api.live.bilibili.com/room/v1/Room/room_init?id=6</a>
-     */
-    private final long roomid;
-
-    /**
-     * 协议版本
-     *
-     * @see ProtoverEnum#getCode()
-     */
-    private final int protover;
-
-    /**
-     * 平台标识
-     */
-    private String platform = "web";
-    private int type = 2;
-
-    /**
-     * 必须字段
-     *
-     * @since 2023-08-19
-     */
-    private final String buvid;
-
-    /**
-     * 认证秘钥(必须字段)
-     *
-     * @since @since 2023-08-19
-     */
-    private final String key;
-
-    @Override
-    public ProtoverEnum getProtoverEnum() {
-        return ProtoverEnum.getByCode(this.protover);
-    }
-
-    @Override
-    public OperationEnum getOperationEnum() {
-        return OperationEnum.AUTH;
-    }
-
-}

+ 0 - 63
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/AuthReplyMsg.java

@@ -1,63 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.msg;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.OperationEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.ProtoverEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.BaseBilibiliMsg;
-
-/**
- * @author mjz
- * @date 2023/1/6
- */
-@Getter
-@Setter
-@AllArgsConstructor
-@NoArgsConstructor
-public class AuthReplyMsg extends BaseBilibiliMsg {
-
-    /**
-     * 0: OK,-101: TOKEN_ERROR
-     */
-    private int code;
-
-    @JsonIgnore
-    private int protover;
-
-    @Override
-    public ProtoverEnum getProtoverEnum() {
-        return ProtoverEnum.getByCode(protover);
-    }
-
-    @Override
-    public OperationEnum getOperationEnum() {
-        return OperationEnum.AUTH_REPLY;
-    }
-}

+ 0 - 102
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/DanmuMsgMsg.java

@@ -1,102 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.msg;
-
-import cn.hutool.core.codec.Base64;
-import com.fasterxml.jackson.databind.JsonNode;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.OperationEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.BaseBilibiliMsg;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.IDanmuMsg;
-
-/**
- * @author mjz
- * @date 2023/9/8
- */
-@Getter
-@Setter
-@AllArgsConstructor
-@NoArgsConstructor
-public class DanmuMsgMsg extends BaseBilibiliMsg implements IDanmuMsg {
-
-    private JsonNode info;
-    private String dm_v2;
-
-    @Override
-    public OperationEnum getOperationEnum() {
-        return OperationEnum.SEND_SMS_REPLY;
-    }
-
-    @Override
-    public String getBadgeName() {
-        JsonNode jsonNode3 = info.get(3);
-        if (jsonNode3.isEmpty()) {
-            return "";
-        }
-        return jsonNode3.get(1).asText();
-    }
-
-    @Override
-    public byte getBadgeLevel() {
-        JsonNode jsonNode3 = info.get(3);
-        if (jsonNode3.isEmpty()) {
-            return 0;
-        }
-        return (byte) jsonNode3.get(0).asInt();
-    }
-
-    @Override
-    public String getUid() {
-        JsonNode jsonNode2 = info.get(2);
-        return jsonNode2.get(0).asText();
-    }
-
-    @Override
-    public String getUsername() {
-        JsonNode jsonNode2 = info.get(2);
-        return jsonNode2.get(1).asText();
-    }
-
-    @Override
-    public String getUserAvatar() {
-        String avatar = null;
-        try {
-            tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2 dmV2 = tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2.parseFrom(Base64.decode(dm_v2));
-            avatar = dmV2.getDmV220().getAvatar();
-        } catch (Exception e) {
-            // ignore
-        }
-        return avatar;
-    }
-
-    @Override
-    public String getContent() {
-        JsonNode jsonNode1 = info.get(1);
-        return jsonNode1.asText();
-    }
-}

+ 0 - 58
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/HeartbeatMsg.java

@@ -1,58 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.msg;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.OperationEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.ProtoverEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.BaseBilibiliMsg;
-
-/**
- * @author mjz
- * @date 2023/1/6
- */
-@Getter
-@Setter
-@AllArgsConstructor
-@NoArgsConstructor
-public class HeartbeatMsg extends BaseBilibiliMsg {
-
-    @JsonIgnore
-    private int protover;
-
-    @Override
-    public ProtoverEnum getProtoverEnum() {
-        return ProtoverEnum.getByCode(protover);
-    }
-
-    @Override
-    public OperationEnum getOperationEnum() {
-        return OperationEnum.HEARTBEAT;
-    }
-}

+ 0 - 60
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/HeartbeatReplyMsg.java

@@ -1,60 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.msg;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.OperationEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.ProtoverEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.BaseBilibiliMsg;
-
-/**
- * @author mjz
- * @date 2023/1/6
- */
-@Getter
-@Setter
-@AllArgsConstructor
-@NoArgsConstructor
-public class HeartbeatReplyMsg extends BaseBilibiliMsg {
-
-    private int popularity;
-
-    @JsonIgnore
-    private int protover;
-
-    @Override
-    public ProtoverEnum getProtoverEnum() {
-        return ProtoverEnum.getByCode(protover);
-    }
-
-    @Override
-    public OperationEnum getOperationEnum() {
-        return OperationEnum.HEARTBEAT_REPLY;
-    }
-}

+ 0 - 396
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/InteractWordMsg.java

@@ -1,396 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.msg;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.databind.JsonNode;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.OperationEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.BaseBilibiliMsg;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.IEnterRoomMsg;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author mjz
- * @date 2023/12/26
- */
-@Getter
-@Setter
-@AllArgsConstructor
-@NoArgsConstructor
-public class InteractWordMsg extends BaseBilibiliMsg implements IEnterRoomMsg {
-
-    private Data data;
-
-    @Override
-    public OperationEnum getOperationEnum() {
-        return OperationEnum.SEND_SMS_REPLY;
-    }
-
-    @Override
-    public String getBadgeName() {
-        if (data == null || data.fans_medal == null) {
-            return null;
-        }
-        return data.fans_medal.medal_name;
-    }
-
-    @Override
-    public byte getBadgeLevel() {
-        if (data == null || data.fans_medal == null) {
-            return 0;
-        }
-        return data.fans_medal.medal_level;
-    }
-
-    @Override
-    public String getUid() {
-        if (data == null) {
-            return null;
-        }
-        return Long.toString(data.uid);
-    }
-
-    @Override
-    public String getUsername() {
-        if (data == null) {
-            return null;
-        }
-        return data.uname;
-    }
-
-    @Override
-    public String getUserAvatar() {
-        if (data == null || data.uinfo == null || data.uinfo.base == null) {
-            return null;
-        }
-        return data.uinfo.base.face;
-    }
-
-    @lombok.Data
-    public static class Data {
-
-        private Contribution contribution;
-        private Contribution_v2 contribution_v2;
-        private int core_user_type;
-        private int dmscore;
-        private Fans_medal fans_medal;
-        private String group_medal;
-        private List<Integer> identities;
-        private boolean is_mystery;
-        private int is_spread;
-        private int msg_type;
-        private int privilege_type;
-        private long roomid;
-        private long score;
-        private String spread_desc;
-        private String spread_info;
-        private int tail_icon;
-        private String tail_text;
-        private long timestamp;
-        private long trigger_time;
-        private long uid;
-        private Uinfo uinfo;
-        private String uname;
-        private String uname_color;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Contribution {
-
-        private int grade;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Contribution_v2 {
-
-        private int grade;
-        private String rank_type;
-        private String text;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Fans_medal {
-
-        private long anchor_roomid;
-        private int guard_level;
-        private int icon_id;
-        private int is_lighted;
-        private long medal_color;
-        private long medal_color_border;
-        private long medal_color_end;
-        private long medal_color_start;
-        private byte medal_level;
-        private String medal_name;
-        private long score;
-        private String special;
-        private long target_id;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Origin_info {
-
-        private String face;
-        private String name;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Risk_ctrl_info {
-
-        private String face;
-        private String name;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Official_info {
-
-        private int role;
-        private String title;
-        private String desc;
-        private int type;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Base {
-
-        private String face;
-        private boolean is_mystery;
-        private String name;
-        private int name_color;
-        private Origin_info origin_info;
-        private Risk_ctrl_info risk_ctrl_info;
-        private Official_info official_info;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Medal {
-
-        private String name;
-        private int level;
-        private long color_start;
-        private long color_end;
-        private long color_border;
-        private long color;
-        private int id;
-        private int typ;
-        private int is_light;
-        private long ruid;
-        private int guard_level;
-        private int score;
-        private String guard_icon;
-        private String honor_icon;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Guard {
-
-        private int level;
-        private String expired_str;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-
-    @lombok.Data
-    public static class Uinfo {
-
-        private long uid;
-        private Base base;
-        private Medal medal;
-        private String wealth;
-        private String title;
-        private Guard guard;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-}

+ 0 - 158
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/LikeInfoV3ClickMsg.java

@@ -1,158 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.msg;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.databind.JsonNode;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.OperationEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.BaseBilibiliMsg;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.ILikeMsg;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author mjz
- * @date 2024/1/31
- */
-@Getter
-@Setter
-@AllArgsConstructor
-@NoArgsConstructor
-public class LikeInfoV3ClickMsg extends BaseBilibiliMsg implements ILikeMsg {
-
-    private Data data;
-
-    @Override
-    public OperationEnum getOperationEnum() {
-        return OperationEnum.SEND_SMS_REPLY;
-    }
-
-    @Override
-    public String getBadgeName() {
-        if (this.data == null || this.data.getFans_medal() == null) {
-            return null;
-        }
-
-        return this.data.getFans_medal().getMedal_name();
-    }
-
-    @Override
-    public byte getBadgeLevel() {
-        if (this.data == null || this.data.getFans_medal() == null) {
-            return 0;
-        }
-
-        return this.data.getFans_medal().getMedal_level();
-    }
-
-    @Override
-    public String getUid() {
-        if (this.data == null) {
-            return null;
-        }
-
-        return Long.toString(this.data.getUid());
-    }
-
-    @Override
-    public String getUsername() {
-        if (this.data == null) {
-            return "";
-        }
-
-        return this.data.getUname();
-    }
-
-    @Override
-    public String getUserAvatar() {
-        if (this.data == null || this.data.getUinfo() == null || this.data.getUinfo().getBase() == null) {
-            return "";
-        }
-
-        return this.data.getUinfo().getBase().getFace();
-    }
-
-    @lombok.Data
-    public static class Data {
-
-        private int show_area;
-        private int msg_type;
-        private String like_icon;
-        private long uid;
-        private String like_text;
-        private String uname;
-        private String uname_color;
-        private List<Integer> identities;
-        private InteractWordMsg.Fans_medal fans_medal;
-        private Contribution_info contribution_info;
-        private int dmscore;
-        private String group_medal;
-        private boolean is_mystery;
-        private InteractWordMsg.Uinfo uinfo;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Contribution_info {
-
-        private int grade;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-}

+ 0 - 351
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/SendGiftMsg.java

@@ -1,351 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.msg;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.JsonNode;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import tech.ordinaryroad.live.chat.client.bilibili.api.BilibiliApis;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.OperationEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.BaseBilibiliMsg;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.dto.MedalInfo;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.IGiftMsg;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author mjz
- * @date 2023/9/8
- */
-@Getter
-@Setter
-@AllArgsConstructor
-@NoArgsConstructor
-public class SendGiftMsg extends BaseBilibiliMsg implements IGiftMsg {
-
-    private Data data;
-
-    /**
-     * 额外属性,获取礼物图片时可能会用到
-     */
-    private long roomId;
-
-    @Override
-    public String getBadgeName() {
-        if (data == null || data.medal_info == null) {
-            return IGiftMsg.super.getBadgeName();
-        }
-
-        return data.medal_info.getMedal_name();
-    }
-
-    @Override
-    public byte getBadgeLevel() {
-        if (data == null || data.medal_info == null) {
-            return IGiftMsg.super.getBadgeLevel();
-        }
-
-        return data.medal_info.getMedal_level();
-    }
-
-    @Override
-    public String getUid() {
-        if (this.data == null) {
-            return null;
-        }
-
-        return Long.toString(this.data.getUid());
-    }
-
-    @Override
-    public String getUsername() {
-        if (this.data == null) {
-            return "";
-        }
-
-        return this.data.getUname();
-    }
-
-    @Override
-    public String getUserAvatar() {
-        if (this.data == null) {
-            return "";
-        }
-
-        return this.data.getFace();
-    }
-
-    @Override
-    public String getGiftName() {
-        if (this.data == null) {
-            return "未知礼物";
-        }
-
-        return this.data.getGiftName();
-    }
-
-    @Override
-    public String getGiftImg() {
-        return BilibiliApis.getGiftImgById(this.data.giftId, this.roomId);
-    }
-
-    @Override
-    public String getGiftId() {
-        if (this.data == null) {
-            return null;
-        }
-
-        return Long.toString(data.getGiftId());
-    }
-
-    @Override
-    public int getGiftCount() {
-        if (this.data == null) {
-            return 0;
-        }
-
-        return data.getNum();
-    }
-
-    @Override
-    public int getGiftPrice() {
-        if (this.data == null) {
-            return -1;
-        }
-
-        return data.getPrice();
-    }
-
-    @Override
-    public String getReceiveUid() {
-        if (this.data == null || this.data.getReceive_user_info() == null) {
-            return null;
-        }
-
-        return Long.toString(data.getReceive_user_info().getUid());
-    }
-
-    @Override
-    public String getReceiveUsername() {
-        if (this.data == null || this.data.getReceive_user_info() == null) {
-            return "";
-        }
-
-        return data.getReceive_user_info().getUname();
-    }
-
-    @Override
-    public OperationEnum getOperationEnum() {
-        return OperationEnum.SEND_SMS_REPLY;
-    }
-
-    @lombok.Data
-    public static class Data {
-
-        private int draw;
-        private int gold;
-        private int silver;
-        private int num;
-        private int total_coin;
-        private int effect;
-        private int broadcast_id;
-        private int crit_prob;
-        private int guard_level;
-        private long rcost;
-        private long uid;
-        private long timestamp;
-        private int giftId;
-        private int giftType;
-        @JsonProperty("super")
-        private int _super;
-        private int super_gift_num;
-        private int super_batch_gift_num;
-        private int remain;
-        private int discount_price;
-        private int price;
-        private String beatId;
-        private String biz_source;
-        private String action;
-        private String coin_type;
-        private String uname;
-        private String face;
-        private String batch_combo_id;
-        private String rnd;
-        private String giftName;
-        private String original_gift_name;
-        private Combo_send combo_send;
-        private Batch_combo_send batch_combo_send;
-        private String tag_image;
-        private String top_list;
-        private String send_master;
-        private boolean is_first;
-        private int demarcation;
-        private int combo_stay_time;
-        private int combo_total_coin;
-        private String tid;
-        private int effect_block;
-        private int is_special_batch;
-        private int combo_resources_id;
-        private int magnification;
-        private String name_color;
-        private MedalInfo medal_info;
-        private int svga_block;
-        private JsonNode blind_gift;
-        private int float_sc_resource_id;
-        @JsonProperty("switch")
-        private boolean _switch;
-        private int face_effect_type;
-        private int face_effect_id;
-        private boolean is_naming;
-        private Receive_user_info receive_user_info;
-        private boolean is_join_receiver;
-        private Bag_gift bag_gift;
-        private int wealth_level;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Combo_send {
-
-        private long uid;
-        private int gift_num;
-        private int combo_num;
-        private int gift_id;
-        private String combo_id;
-        private String gift_name;
-        private String action;
-        private String uname;
-        private String send_master;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Receive_user_info {
-
-        private String uname;
-        private long uid;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Batch_combo_send {
-
-        private long uid;
-        private int gift_num;
-        private int batch_combo_num;
-        private int gift_id;
-        private String batch_combo_id;
-        private String gift_name;
-        private String action;
-        private String uname;
-        private String send_master;
-        private JsonNode blind_gift;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Bag_gift {
-
-        private int show_price;
-        private int price_for_show;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-}

+ 0 - 81
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/SendSmsReplyMsg.java

@@ -1,81 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.msg;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.OperationEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.BaseBilibiliCmdMsg;
-
-/**
- * @author mjz
- * @date 2023/1/6
- */
-@Getter
-@Setter
-@AllArgsConstructor
-@NoArgsConstructor
-public class SendSmsReplyMsg extends BaseBilibiliCmdMsg {
-
-    private Long id;
-
-    private String name;
-
-    private JsonNode full;
-
-    private JsonNode half;
-
-    private JsonNode side;
-
-    private JsonNode data;
-
-    private JsonNode info;
-
-    private JsonNode msg_common;
-
-    private JsonNode msg_self;
-
-    private JsonNode link_url;
-
-    private JsonNode msg_type;
-
-    private JsonNode shield_uid;
-
-    private JsonNode business_id;
-
-    private JsonNode scatter;
-
-    private long roomid;
-
-    private long real_roomid;
-
-    @Override
-    public OperationEnum getOperationEnum() {
-        return OperationEnum.SEND_SMS_REPLY;
-    }
-}

+ 0 - 202
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/SuperChatMessageMsg.java

@@ -1,202 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package tech.ordinaryroad.live.chat.client.bilibili.msg;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.databind.JsonNode;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.OperationEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.BaseBilibiliMsg;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.dto.MedalInfo;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.ISuperChatMsg;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author mjz
- * @date 2023/9/24
- */
-@Getter
-@Setter
-@AllArgsConstructor
-@NoArgsConstructor
-public class SuperChatMessageMsg extends BaseBilibiliMsg implements ISuperChatMsg {
-
-    private long roomid;
-    private Data data;
-
-    @Override
-    public OperationEnum getOperationEnum() {
-        return OperationEnum.SEND_SMS_REPLY;
-    }
-
-    @Override
-    public String getUid() {
-        if (this.data == null) {
-            return null;
-        }
-
-        return Long.toString(this.data.uid);
-    }
-
-    @Override
-    public String getUsername() {
-        if (this.data == null || this.data.getUser_info() == null) {
-            return "";
-        }
-
-        return this.data.user_info.uname;
-    }
-
-    @Override
-    public String getUserAvatar() {
-        if (this.data == null || this.data.getUser_info() == null) {
-            return "";
-        }
-
-        return this.data.user_info.face;
-    }
-
-    @Override
-    public String getContent() {
-        if (this.data == null) {
-            return "";
-        }
-
-        return this.data.message;
-    }
-
-    @Override
-    public int getDuration() {
-        if (this.data == null) {
-            return 0;
-        }
-
-        return this.data.time;
-    }
-
-    @lombok.Data
-    public static class Data {
-        private String background_bottom_color;
-        private String background_color;
-        private String background_color_end;
-        private String background_color_start;
-        private String background_icon;
-        private String background_image;
-        private String background_price_color;
-        private double color_point;
-        private int dmscore;
-        private long end_time;
-        private Gift gift;
-        private long id;
-        private int is_ranked;
-        private int is_send_audit;
-        private MedalInfo medal_info;
-        private String message;
-        private String message_font_color;
-        private String message_trans;
-        private int price;
-        private int rate;
-        private long start_time;
-        private int time;
-        private String token;
-        private int trans_mark;
-        private long ts;
-        private long uid;
-        private User_info user_info;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class Gift {
-        private int gift_id;
-        private String gift_name;
-        private int num;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-
-    @lombok.Data
-    public static class User_info {
-        private String face;
-        private String face_frame;
-        private int guard_level;
-        private int is_main_vip;
-        private int is_svip;
-        private int is_vip;
-        private String level_color;
-        private int manager;
-        private String name_color;
-        private String title;
-        private String uname;
-        private int user_level;
-
-        /**
-         * 未知属性都放在这
-         */
-        private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-        @JsonAnyGetter
-        public Map<String, JsonNode> getUnknownProperties() {
-            return unknownProperties;
-        }
-
-        @JsonAnySetter
-        public void setOther(String key, JsonNode value) {
-            this.unknownProperties.put(key, value);
-        }
-    }
-}

+ 0 - 68
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/base/BaseBilibiliCmdMsg.java

@@ -1,68 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.msg.base;
-
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.BilibiliCmdEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.ProtoverEnum;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.BaseCmdMsg;
-
-/**
- * @author mjz
- * @date 2023/1/6
- */
-@Getter
-@Setter
-@AllArgsConstructor
-@NoArgsConstructor
-public abstract class BaseBilibiliCmdMsg extends BaseCmdMsg<BilibiliCmdEnum> implements IBilibiliMsg {
-
-    private int protover;
-    private String cmd;
-
-    @Override
-    public String getCmd() {
-        return this.cmd;
-    }
-
-    @Override
-    public void setCmd(String cmd) {
-        this.cmd = cmd;
-    }
-
-    @Override
-    public BilibiliCmdEnum getCmdEnum() {
-        return BilibiliCmdEnum.getByString(getCmd());
-    }
-
-    @Override
-    public ProtoverEnum getProtoverEnum() {
-        return ProtoverEnum.getByCode(this.protover);
-    }
-}

+ 0 - 50
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/base/BaseBilibiliMsg.java

@@ -1,50 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.msg.base;
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.ProtoverEnum;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.BaseMsg;
-
-/**
- * @author mjz
- * @date 2023/1/6
- */
-@Getter
-@Setter
-@AllArgsConstructor
-@NoArgsConstructor
-public abstract class BaseBilibiliMsg extends BaseMsg implements IBilibiliMsg {
-
-    private int protover;
-
-    @Override
-    public ProtoverEnum getProtoverEnum() {
-        return ProtoverEnum.getByCode(protover);
-    }
-}

+ 0 - 44
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/base/IBilibiliMsg.java

@@ -1,44 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.msg.base;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.OperationEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.ProtoverEnum;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.IMsg;
-
-/**
- * @author mjz
- * @date 2023/8/26
- */
-public interface IBilibiliMsg extends IMsg {
-
-    @JsonIgnore
-    ProtoverEnum getProtoverEnum();
-
-    @JsonIgnore
-    OperationEnum getOperationEnum();
-
-}

+ 0 - 66
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/msg/dto/MedalInfo.java

@@ -1,66 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.msg.dto;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.databind.JsonNode;
-import lombok.Data;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@Data
-public class MedalInfo {
-
-    private long target_id;
-    private String special;
-    private int icon_id;
-    private String anchor_uname;
-    private int anchor_roomid;
-    private byte medal_level;
-    private String medal_name;
-    private String medal_color;
-    private long medal_color_start;
-    private long medal_color_end;
-    private long medal_color_border;
-    private int is_lighted;
-    private int guard_level;
-
-    /**
-     * 未知属性都放在这
-     */
-    private final Map<String, JsonNode> unknownProperties = new HashMap<>();
-
-    @JsonAnyGetter
-    public Map<String, JsonNode> getUnknownProperties() {
-        return unknownProperties;
-    }
-
-    @JsonAnySetter
-    public void setOther(String key, JsonNode value) {
-        this.unknownProperties.put(key, value);
-    }
-}

+ 0 - 40
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/netty/frame/AuthWebSocketFrame.java

@@ -1,40 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.netty.frame;
-
-import io.netty.buffer.ByteBuf;
-import tech.ordinaryroad.live.chat.client.bilibili.netty.frame.base.BaseBilibiliWebSocketFrame;
-
-/**
- * @author mjz
- * @date 2023/1/5
- */
-public class AuthWebSocketFrame extends BaseBilibiliWebSocketFrame {
-
-    public AuthWebSocketFrame(ByteBuf byteBuf) {
-        super(byteBuf);
-    }
-
-}

+ 0 - 40
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/netty/frame/HeartbeatWebSocketFrame.java

@@ -1,40 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.netty.frame;
-
-import io.netty.buffer.ByteBuf;
-import tech.ordinaryroad.live.chat.client.bilibili.netty.frame.base.BaseBilibiliWebSocketFrame;
-
-/**
- * @author mjz
- * @date 2023/1/5
- */
-public class HeartbeatWebSocketFrame extends BaseBilibiliWebSocketFrame {
-
-    public HeartbeatWebSocketFrame(ByteBuf byteBuf) {
-        super(byteBuf);
-    }
-
-}

+ 0 - 54
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/netty/frame/base/BaseBilibiliWebSocketFrame.java

@@ -1,54 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.netty.frame.base;
-
-import io.netty.buffer.ByteBuf;
-import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.OperationEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.ProtoverEnum;
-
-/**
- * 实现Bilibili协议的BinaryWebSocketFrame
- * <a href="https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/live/message_stream.md#数据包格式">数据包格式</a>
- *
- * @author mjz
- * @date 2023/1/5
- */
-public abstract class BaseBilibiliWebSocketFrame extends BinaryWebSocketFrame {
-
-    public static int sequence = 0;
-
-    public ProtoverEnum getProtoverEnum() {
-        return ProtoverEnum.getByCode(super.content().getShort(6));
-    }
-
-    public OperationEnum getOperationEnum() {
-        return OperationEnum.getByCode(super.content().getInt(8));
-    }
-
-    public BaseBilibiliWebSocketFrame(ByteBuf byteBuf) {
-        super(byteBuf);
-    }
-}

+ 0 - 113
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/netty/frame/factory/BilibiliWebSocketFrameFactory.java

@@ -1,113 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.netty.frame.factory;
-
-import cn.hutool.core.lang.UUID;
-import cn.hutool.core.util.NumberUtil;
-import com.fasterxml.jackson.databind.JsonNode;
-import tech.ordinaryroad.live.chat.client.bilibili.api.BilibiliApis;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.ProtoverEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.AuthMsg;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.HeartbeatMsg;
-import tech.ordinaryroad.live.chat.client.bilibili.netty.frame.AuthWebSocketFrame;
-import tech.ordinaryroad.live.chat.client.bilibili.netty.frame.HeartbeatWebSocketFrame;
-import tech.ordinaryroad.live.chat.client.bilibili.util.BilibiliCodecUtil;
-import tech.ordinaryroad.live.chat.client.commons.base.exception.BaseException;
-import tech.ordinaryroad.live.chat.client.commons.util.OrLiveChatCookieUtil;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * @author mjz
- * @date 2023/1/5
- */
-public class BilibiliWebSocketFrameFactory {
-
-    private static final ConcurrentHashMap<Long, BilibiliWebSocketFrameFactory> CACHE = new ConcurrentHashMap<>();
-
-    /**
-     * 浏览器地址中的房间id,支持短id
-     */
-    private final long roomId;
-    private volatile static HeartbeatMsg heartbeatMsg;
-
-    public BilibiliWebSocketFrameFactory(long roomId) {
-        this.roomId = roomId;
-    }
-
-    public synchronized static BilibiliWebSocketFrameFactory getInstance(long roomId) {
-        return CACHE.computeIfAbsent(roomId, aLong -> new BilibiliWebSocketFrameFactory(roomId));
-    }
-
-    /**
-     * 创建认证包
-     *
-     * @param protover {@link ProtoverEnum}
-     * @param cookie   浏览器cookie,仅用来维持登录状态
-     * @return AuthWebSocketFrame
-     */
-    public AuthWebSocketFrame createAuth(ProtoverEnum protover, String cookie) {
-        try {
-            Map<String, String> cookieMap = OrLiveChatCookieUtil.parseCookieString(cookie);
-            String buvid3 = OrLiveChatCookieUtil.getCookieByName(cookieMap, "buvid3", () -> UUID.randomUUID().toString());
-            String uid = OrLiveChatCookieUtil.getCookieByName(cookieMap, "DedeUserID", () -> "0");
-            BilibiliApis.RoomInitResult data = BilibiliApis.roomInit(roomId, cookie);
-            JsonNode danmuInfo = BilibiliApis.getDanmuInfo(roomId, 0, cookie);
-            long realRoomId = data.getRoom_id();
-            AuthMsg authMsg = new AuthMsg(realRoomId, protover.getCode(), buvid3, danmuInfo.get("token").asText());
-            authMsg.setUid(NumberUtil.parseLong(uid));
-            return new AuthWebSocketFrame(BilibiliCodecUtil.encode(authMsg));
-        } catch (Exception e) {
-            throw new BaseException(String.format("认证包创建失败,请检查房间号是否正确。roomId: %d, msg: %s", roomId, e.getMessage()));
-        }
-    }
-
-    public AuthWebSocketFrame createAuth(ProtoverEnum protover) {
-        return this.createAuth(protover, null);
-    }
-
-    public HeartbeatWebSocketFrame createHeartbeat(ProtoverEnum protover) {
-        return new HeartbeatWebSocketFrame(BilibiliCodecUtil.encode(this.getHeartbeatMsg(protover)));
-    }
-
-    /**
-     * 心跳包单例模式
-     *
-     * @param protover {@link ProtoverEnum}
-     * @return HeartbeatWebSocketFrame
-     */
-    public HeartbeatMsg getHeartbeatMsg(ProtoverEnum protover) {
-        if (heartbeatMsg == null) {
-            synchronized (BilibiliWebSocketFrameFactory.this) {
-                if (heartbeatMsg == null) {
-                    heartbeatMsg = new HeartbeatMsg(protover.getCode());
-                }
-            }
-        }
-        return heartbeatMsg;
-    }
-
-}

+ 0 - 153
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/netty/handler/BilibiliBinaryFrameHandler.java

@@ -1,153 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.netty.handler;
-
-import cn.hutool.core.util.StrUtil;
-import io.netty.buffer.ByteBuf;
-import io.netty.channel.ChannelHandler;
-import lombok.SneakyThrows;
-import lombok.extern.slf4j.Slf4j;
-import tech.ordinaryroad.live.chat.client.bilibili.client.BilibiliLiveChatClient;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.BilibiliCmdEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.listener.IBilibiliMsgListener;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.*;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.BaseBilibiliMsg;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.IBilibiliMsg;
-import tech.ordinaryroad.live.chat.client.bilibili.util.BilibiliCodecUtil;
-import tech.ordinaryroad.live.chat.client.commons.base.msg.ICmdMsg;
-import tech.ordinaryroad.live.chat.client.servers.netty.client.handler.BaseNettyClientBinaryFrameHandler;
-
-import java.util.List;
-
-
-/**
- * 消息处理器
- *
- * @author mjz
- * @date 2023/1/4
- */
-@Slf4j
-@ChannelHandler.Sharable
-public class BilibiliBinaryFrameHandler extends BaseNettyClientBinaryFrameHandler<BilibiliLiveChatClient, BilibiliBinaryFrameHandler, BilibiliCmdEnum, IBilibiliMsg, IBilibiliMsgListener> {
-
-    public BilibiliBinaryFrameHandler(List<IBilibiliMsgListener> msgListeners, BilibiliLiveChatClient client) {
-        super(msgListeners, client);
-    }
-
-    public BilibiliBinaryFrameHandler(List<IBilibiliMsgListener> msgListeners, long roomId) {
-        super(msgListeners, roomId);
-    }
-
-    @SneakyThrows
-    @Override
-    public void onCmdMsg(BilibiliCmdEnum cmd, ICmdMsg<BilibiliCmdEnum> cmdMsg) {
-        if (super.msgListeners.isEmpty()) {
-            return;
-        }
-
-        SendSmsReplyMsg sendSmsReplyMsg = (SendSmsReplyMsg) cmdMsg;
-        switch (cmd) {
-            case DANMU_MSG: {
-                DanmuMsgMsg danmuMsgMsg = new DanmuMsgMsg();
-                danmuMsgMsg.setProtover(sendSmsReplyMsg.getProtover());
-                danmuMsgMsg.setInfo(sendSmsReplyMsg.getInfo());
-                danmuMsgMsg.setDm_v2(StrUtil.toStringOrNull(sendSmsReplyMsg.getUnknownProperties().get("dm_v2")));
-                iteratorMsgListeners(msgListener -> msgListener.onDanmuMsg(BilibiliBinaryFrameHandler.this, danmuMsgMsg));
-                break;
-            }
-
-            case SEND_GIFT: {
-                SendGiftMsg sendGiftMsg = new SendGiftMsg();
-                sendGiftMsg.setRoomId(getRoomIdAsLong());
-                sendGiftMsg.setProtover(sendSmsReplyMsg.getProtover());
-                SendGiftMsg.Data data = BaseBilibiliMsg.OBJECT_MAPPER.treeToValue(sendSmsReplyMsg.getData(), SendGiftMsg.Data.class);
-                sendGiftMsg.setData(data);
-                iteratorMsgListeners(msgListener -> {
-                    msgListener.onGiftMsg(BilibiliBinaryFrameHandler.this, sendGiftMsg);
-                    msgListener.onSendGift(BilibiliBinaryFrameHandler.this, sendSmsReplyMsg);
-                });
-                break;
-            }
-
-            case SUPER_CHAT_MESSAGE: {
-                SuperChatMessageMsg superChatMessageMsg = new SuperChatMessageMsg();
-                superChatMessageMsg.setProtover(sendSmsReplyMsg.getProtover());
-                superChatMessageMsg.setRoomid(sendSmsReplyMsg.getRoomid());
-                SuperChatMessageMsg.Data data = BaseBilibiliMsg.OBJECT_MAPPER.treeToValue(sendSmsReplyMsg.getData(), SuperChatMessageMsg.Data.class);
-                superChatMessageMsg.setData(data);
-                iteratorMsgListeners(msgListener -> msgListener.onSuperChatMsg(BilibiliBinaryFrameHandler.this, superChatMessageMsg));
-                break;
-            }
-
-            case INTERACT_WORD: {
-                InteractWordMsg interactWordMsg = new InteractWordMsg();
-                interactWordMsg.setProtover(sendSmsReplyMsg.getProtover());
-                InteractWordMsg.Data data = BaseBilibiliMsg.OBJECT_MAPPER.treeToValue(sendSmsReplyMsg.getData(), InteractWordMsg.Data.class);
-                interactWordMsg.setData(data);
-                iteratorMsgListeners(msgListener -> {
-                    msgListener.onEnterRoomMsg(BilibiliBinaryFrameHandler.this, interactWordMsg);
-                    msgListener.onEnterRoom(BilibiliBinaryFrameHandler.this, sendSmsReplyMsg);
-                });
-                break;
-            }
-
-            case ENTRY_EFFECT: {
-                iteratorMsgListeners(msgListener -> msgListener.onEntryEffect(BilibiliBinaryFrameHandler.this, sendSmsReplyMsg));
-                break;
-            }
-
-            case WATCHED_CHANGE: {
-                iteratorMsgListeners(msgListener -> msgListener.onWatchedChange(BilibiliBinaryFrameHandler.this, sendSmsReplyMsg));
-                break;
-            }
-
-            case LIKE_INFO_V3_CLICK: {
-                LikeInfoV3ClickMsg likeInfoV3ClickMsg = new LikeInfoV3ClickMsg();
-                likeInfoV3ClickMsg.setProtover(sendSmsReplyMsg.getProtover());
-                LikeInfoV3ClickMsg.Data data = BaseBilibiliMsg.OBJECT_MAPPER.treeToValue(sendSmsReplyMsg.getData(), LikeInfoV3ClickMsg.Data.class);
-                likeInfoV3ClickMsg.setData(data);
-                iteratorMsgListeners(msgListener -> {
-                    msgListener.onLikeMsg(BilibiliBinaryFrameHandler.this, likeInfoV3ClickMsg);
-                    msgListener.onClickLike(BilibiliBinaryFrameHandler.this, sendSmsReplyMsg);
-                });
-                break;
-            }
-
-            case LIKE_INFO_V3_UPDATE: {
-                iteratorMsgListeners(msgListener -> msgListener.onClickUpdate(BilibiliBinaryFrameHandler.this, sendSmsReplyMsg));
-                break;
-            }
-
-            default: {
-                iteratorMsgListeners(msgListener -> msgListener.onOtherCmdMsg(BilibiliBinaryFrameHandler.this, cmd, cmdMsg));
-            }
-        }
-    }
-
-    @Override
-    protected List<IBilibiliMsg> decode(ByteBuf byteBuf) {
-        return BilibiliCodecUtil.decode(byteBuf);
-    }
-}

+ 0 - 154
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/netty/handler/BilibiliConnectionHandler.java

@@ -1,154 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.netty.handler;
-
-import io.netty.channel.Channel;
-import io.netty.channel.ChannelFutureListener;
-import io.netty.channel.ChannelHandler;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker;
-import lombok.extern.slf4j.Slf4j;
-import tech.ordinaryroad.live.chat.client.bilibili.client.BilibiliLiveChatClient;
-import tech.ordinaryroad.live.chat.client.bilibili.config.BilibiliLiveChatClientConfig;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.ProtoverEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.netty.frame.factory.BilibiliWebSocketFrameFactory;
-import tech.ordinaryroad.live.chat.client.commons.base.listener.IBaseConnectionListener;
-import tech.ordinaryroad.live.chat.client.servers.netty.client.handler.BaseNettyClientConnectionHandler;
-
-
-/**
- * 连接处理器
- *
- * @author mjz
- * @date 2023/8/21
- */
-@Slf4j
-@ChannelHandler.Sharable
-public class BilibiliConnectionHandler extends BaseNettyClientConnectionHandler<BilibiliLiveChatClient, BilibiliConnectionHandler> {
-
-    /**
-     * 以ClientConfig为主
-     */
-    private final long roomId;
-    /**
-     * 以ClientConfig为主
-     */
-    private final ProtoverEnum protover;
-    /**
-     * 以ClientConfig为主
-     */
-    private String cookie;
-
-    public BilibiliConnectionHandler(WebSocketClientHandshaker handshaker, BilibiliLiveChatClient client, IBaseConnectionListener<BilibiliConnectionHandler> listener) {
-        super(handshaker, client, listener);
-        this.roomId = client.getConfig().getRoomId();
-        this.protover = client.getConfig().getProtover();
-        this.cookie = client.getConfig().getCookie();
-    }
-
-    public BilibiliConnectionHandler(WebSocketClientHandshaker handshaker, BilibiliLiveChatClient client) {
-        this(handshaker, client, null);
-    }
-
-    public BilibiliConnectionHandler(WebSocketClientHandshaker handshaker, long roomId, ProtoverEnum protover, IBaseConnectionListener<BilibiliConnectionHandler> listener, String cookie) {
-        super(handshaker, listener);
-        this.roomId = roomId;
-        this.protover = protover;
-        this.cookie = cookie;
-    }
-
-    public BilibiliConnectionHandler(WebSocketClientHandshaker handshaker, long roomId, ProtoverEnum protover, IBaseConnectionListener<BilibiliConnectionHandler> listener) {
-        this(handshaker, roomId, protover, listener, null);
-    }
-
-    public BilibiliConnectionHandler(WebSocketClientHandshaker handshaker, long roomId, ProtoverEnum protover, String cookie) {
-        this(handshaker, roomId, protover, null, cookie);
-    }
-
-    public BilibiliConnectionHandler(WebSocketClientHandshaker handshaker, long roomId, ProtoverEnum protover) {
-        this(handshaker, roomId, protover, null, null);
-    }
-
-    @Override
-    protected void sendHeartbeat(ChannelHandlerContext ctx) {
-        if (log.isDebugEnabled()) {
-            log.debug("发送心跳包");
-        }
-        ctx.writeAndFlush(
-                getWebSocketFrameFactory(getRoomId()).createHeartbeat(getProtover())
-        ).addListener((ChannelFutureListener) future -> {
-            if (future.isSuccess()) {
-                if (log.isDebugEnabled()) {
-                    log.debug("心跳包发送完成");
-                }
-            } else {
-                log.error("心跳包发送失败", future.cause());
-            }
-        });
-    }
-
-    private static BilibiliWebSocketFrameFactory getWebSocketFrameFactory(long roomId) {
-        return BilibiliWebSocketFrameFactory.getInstance(roomId);
-    }
-
-    @Override
-    public void sendAuthRequest(Channel channel) {
-        // 5s内认证
-        if (log.isDebugEnabled()) {
-            log.debug("发送认证包");
-        }
-        channel.writeAndFlush(getWebSocketFrameFactory(getRoomId()).createAuth(getProtover(), getCookie()));
-    }
-
-    public long getRoomId() {
-        return client != null ? client.getConfig().getRoomId() : roomId;
-    }
-
-    private ProtoverEnum getProtover() {
-        return client != null ? client.getConfig().getProtover() : protover;
-    }
-
-    private String getCookie() {
-        return client != null ? client.getConfig().getCookie() : cookie;
-    }
-
-    @Override
-    protected long getHeartbeatPeriod() {
-        if (client == null) {
-            return BilibiliLiveChatClientConfig.DEFAULT_HEARTBEAT_PERIOD;
-        } else {
-            return client.getConfig().getHeartbeatPeriod();
-        }
-    }
-
-    @Override
-    protected long getHeartbeatInitialDelay() {
-        if (client == null) {
-            return BilibiliLiveChatClientConfig.DEFAULT_HEARTBEAT_INITIAL_DELAY;
-        } else {
-            return client.getConfig().getHeartbeatInitialDelay();
-        }
-    }
-}

+ 0 - 78
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/protobuf/Dm_v2Proto.java

@@ -1,78 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: dm_v2.proto
-
-package tech.ordinaryroad.live.chat.client.bilibili.protobuf;
-
-public final class Dm_v2Proto {
-  private Dm_v2Proto() {}
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistryLite registry) {
-  }
-
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistry registry) {
-    registerAllExtensions(
-        (com.google.protobuf.ExtensionRegistryLite) registry);
-  }
-  static final com.google.protobuf.Descriptors.Descriptor
-    internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_descriptor;
-  static final 
-    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-      internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_fieldAccessorTable;
-
-  public static com.google.protobuf.Descriptors.FileDescriptor
-      getDescriptor() {
-    return descriptor;
-  }
-  private static  com.google.protobuf.Descriptors.FileDescriptor
-      descriptor;
-  static {
-    String[] descriptorData = {
-      "\n\013dm_v2.proto\0224tech.ordinaryroad.live.ch" +
-      "at.client.bilibili.protobuf\032\016dm_v2_20.pr" +
-      "oto\"Y\n\005dm_v2\022P\n\010dm_v2_20\030\024 \001(\0132>.tech.or" +
-      "dinaryroad.live.chat.client.bilibili.pro" +
-      "tobuf.dm_v2_20BJ\n4tech.ordinaryroad.live" +
-      ".chat.client.bilibili.protobufB\nDm_v2Pro" +
-      "toP\001\242\002\003GPBb\006proto3"
-    };
-    descriptor = com.google.protobuf.Descriptors.FileDescriptor
-      .internalBuildGeneratedFileFrom(descriptorData,
-        new com.google.protobuf.Descriptors.FileDescriptor[] {
-          Dm_v2_20Proto.getDescriptor(),
-        });
-    internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_descriptor =
-      getDescriptor().getMessageTypes().get(0);
-    internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_fieldAccessorTable = new
-      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
-        internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_descriptor,
-        new String[] { "DmV220", });
-    Dm_v2_20Proto.getDescriptor();
-  }
-
-  // @@protoc_insertion_point(outer_class_scope)
-}

+ 0 - 74
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/protobuf/Dm_v2_20Proto.java

@@ -1,74 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: dm_v2_20.proto
-
-package tech.ordinaryroad.live.chat.client.bilibili.protobuf;
-
-public final class Dm_v2_20Proto {
-  private Dm_v2_20Proto() {}
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistryLite registry) {
-  }
-
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistry registry) {
-    registerAllExtensions(
-        (com.google.protobuf.ExtensionRegistryLite) registry);
-  }
-  static final com.google.protobuf.Descriptors.Descriptor
-    internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_20_descriptor;
-  static final 
-    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-      internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_20_fieldAccessorTable;
-
-  public static com.google.protobuf.Descriptors.FileDescriptor
-      getDescriptor() {
-    return descriptor;
-  }
-  private static  com.google.protobuf.Descriptors.FileDescriptor
-      descriptor;
-  static {
-    String[] descriptorData = {
-      "\n\016dm_v2_20.proto\0224tech.ordinaryroad.live" +
-      ".chat.client.bilibili.protobuf\"\032\n\010dm_v2_" +
-      "20\022\016\n\006avatar\030\004 \001(\tBM\n4tech.ordinaryroad." +
-      "live.chat.client.bilibili.protobufB\rDm_v" +
-      "2_20ProtoP\001\242\002\003GPBb\006proto3"
-    };
-    descriptor = com.google.protobuf.Descriptors.FileDescriptor
-      .internalBuildGeneratedFileFrom(descriptorData,
-        new com.google.protobuf.Descriptors.FileDescriptor[] {
-        });
-    internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_20_descriptor =
-      getDescriptor().getMessageTypes().get(0);
-    internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_20_fieldAccessorTable = new
-      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
-        internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_20_descriptor,
-        new String[] { "Avatar", });
-  }
-
-  // @@protoc_insertion_point(outer_class_scope)
-}

+ 0 - 610
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/protobuf/dm_v2.java

@@ -1,610 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: dm_v2.proto
-
-package tech.ordinaryroad.live.chat.client.bilibili.protobuf;
-
-/**
- * Protobuf type {@code tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2}
- */
-public final class dm_v2 extends
-    com.google.protobuf.GeneratedMessageV3 implements
-    // @@protoc_insertion_point(message_implements:tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2)
-    dm_v2OrBuilder {
-private static final long serialVersionUID = 0L;
-  // Use dm_v2.newBuilder() to construct.
-  private dm_v2(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
-    super(builder);
-  }
-  private dm_v2() {
-  }
-
-  @Override
-  @SuppressWarnings({"unused"})
-  protected Object newInstance(
-      UnusedPrivateParameter unused) {
-    return new dm_v2();
-  }
-
-  public static final com.google.protobuf.Descriptors.Descriptor
-      getDescriptor() {
-    return Dm_v2Proto.internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_descriptor;
-  }
-
-  @Override
-  protected FieldAccessorTable
-      internalGetFieldAccessorTable() {
-    return Dm_v2Proto.internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_fieldAccessorTable
-        .ensureFieldAccessorsInitialized(
-            dm_v2.class, Builder.class);
-  }
-
-  public static final int DM_V2_20_FIELD_NUMBER = 20;
-  private dm_v2_20 dmV220_;
-  /**
-   * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-   * @return Whether the dmV220 field is set.
-   */
-  @Override
-  public boolean hasDmV220() {
-    return dmV220_ != null;
-  }
-  /**
-   * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-   * @return The dmV220.
-   */
-  @Override
-  public dm_v2_20 getDmV220() {
-    return dmV220_ == null ? dm_v2_20.getDefaultInstance() : dmV220_;
-  }
-  /**
-   * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-   */
-  @Override
-  public dm_v2_20OrBuilder getDmV220OrBuilder() {
-    return dmV220_ == null ? dm_v2_20.getDefaultInstance() : dmV220_;
-  }
-
-  private byte memoizedIsInitialized = -1;
-  @Override
-  public final boolean isInitialized() {
-    byte isInitialized = memoizedIsInitialized;
-    if (isInitialized == 1) return true;
-    if (isInitialized == 0) return false;
-
-    memoizedIsInitialized = 1;
-    return true;
-  }
-
-  @Override
-  public void writeTo(com.google.protobuf.CodedOutputStream output)
-                      throws java.io.IOException {
-    if (dmV220_ != null) {
-      output.writeMessage(20, getDmV220());
-    }
-    getUnknownFields().writeTo(output);
-  }
-
-  @Override
-  public int getSerializedSize() {
-    int size = memoizedSize;
-    if (size != -1) return size;
-
-    size = 0;
-    if (dmV220_ != null) {
-      size += com.google.protobuf.CodedOutputStream
-        .computeMessageSize(20, getDmV220());
-    }
-    size += getUnknownFields().getSerializedSize();
-    memoizedSize = size;
-    return size;
-  }
-
-  @Override
-  public boolean equals(final Object obj) {
-    if (obj == this) {
-     return true;
-    }
-    if (!(obj instanceof dm_v2)) {
-      return super.equals(obj);
-    }
-    dm_v2 other = (dm_v2) obj;
-
-    if (hasDmV220() != other.hasDmV220()) return false;
-    if (hasDmV220()) {
-      if (!getDmV220()
-          .equals(other.getDmV220())) return false;
-    }
-    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    if (memoizedHashCode != 0) {
-      return memoizedHashCode;
-    }
-    int hash = 41;
-    hash = (19 * hash) + getDescriptor().hashCode();
-    if (hasDmV220()) {
-      hash = (37 * hash) + DM_V2_20_FIELD_NUMBER;
-      hash = (53 * hash) + getDmV220().hashCode();
-    }
-    hash = (29 * hash) + getUnknownFields().hashCode();
-    memoizedHashCode = hash;
-    return hash;
-  }
-
-  public static dm_v2 parseFrom(
-      java.nio.ByteBuffer data)
-      throws com.google.protobuf.InvalidProtocolBufferException {
-    return PARSER.parseFrom(data);
-  }
-  public static dm_v2 parseFrom(
-      java.nio.ByteBuffer data,
-      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-      throws com.google.protobuf.InvalidProtocolBufferException {
-    return PARSER.parseFrom(data, extensionRegistry);
-  }
-  public static dm_v2 parseFrom(
-      com.google.protobuf.ByteString data)
-      throws com.google.protobuf.InvalidProtocolBufferException {
-    return PARSER.parseFrom(data);
-  }
-  public static dm_v2 parseFrom(
-      com.google.protobuf.ByteString data,
-      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-      throws com.google.protobuf.InvalidProtocolBufferException {
-    return PARSER.parseFrom(data, extensionRegistry);
-  }
-  public static dm_v2 parseFrom(byte[] data)
-      throws com.google.protobuf.InvalidProtocolBufferException {
-    return PARSER.parseFrom(data);
-  }
-  public static dm_v2 parseFrom(
-      byte[] data,
-      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-      throws com.google.protobuf.InvalidProtocolBufferException {
-    return PARSER.parseFrom(data, extensionRegistry);
-  }
-  public static dm_v2 parseFrom(java.io.InputStream input)
-      throws java.io.IOException {
-    return com.google.protobuf.GeneratedMessageV3
-        .parseWithIOException(PARSER, input);
-  }
-  public static dm_v2 parseFrom(
-      java.io.InputStream input,
-      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-      throws java.io.IOException {
-    return com.google.protobuf.GeneratedMessageV3
-        .parseWithIOException(PARSER, input, extensionRegistry);
-  }
-
-  public static dm_v2 parseDelimitedFrom(java.io.InputStream input)
-      throws java.io.IOException {
-    return com.google.protobuf.GeneratedMessageV3
-        .parseDelimitedWithIOException(PARSER, input);
-  }
-
-  public static dm_v2 parseDelimitedFrom(
-      java.io.InputStream input,
-      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-      throws java.io.IOException {
-    return com.google.protobuf.GeneratedMessageV3
-        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
-  }
-  public static dm_v2 parseFrom(
-      com.google.protobuf.CodedInputStream input)
-      throws java.io.IOException {
-    return com.google.protobuf.GeneratedMessageV3
-        .parseWithIOException(PARSER, input);
-  }
-  public static dm_v2 parseFrom(
-      com.google.protobuf.CodedInputStream input,
-      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-      throws java.io.IOException {
-    return com.google.protobuf.GeneratedMessageV3
-        .parseWithIOException(PARSER, input, extensionRegistry);
-  }
-
-  @Override
-  public Builder newBuilderForType() { return newBuilder(); }
-  public static Builder newBuilder() {
-    return DEFAULT_INSTANCE.toBuilder();
-  }
-  public static Builder newBuilder(dm_v2 prototype) {
-    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
-  }
-  @Override
-  public Builder toBuilder() {
-    return this == DEFAULT_INSTANCE
-        ? new Builder() : new Builder().mergeFrom(this);
-  }
-
-  @Override
-  protected Builder newBuilderForType(
-      BuilderParent parent) {
-    Builder builder = new Builder(parent);
-    return builder;
-  }
-  /**
-   * Protobuf type {@code tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2}
-   */
-  public static final class Builder extends
-      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
-      // @@protoc_insertion_point(builder_implements:tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2)
-      dm_v2OrBuilder {
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return Dm_v2Proto.internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_descriptor;
-    }
-
-    @Override
-    protected FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return Dm_v2Proto.internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              dm_v2.class, Builder.class);
-    }
-
-    // Construct using tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2.newBuilder()
-    private Builder() {
-
-    }
-
-    private Builder(
-        BuilderParent parent) {
-      super(parent);
-
-    }
-    @Override
-    public Builder clear() {
-      super.clear();
-      bitField0_ = 0;
-      dmV220_ = null;
-      if (dmV220Builder_ != null) {
-        dmV220Builder_.dispose();
-        dmV220Builder_ = null;
-      }
-      return this;
-    }
-
-    @Override
-    public com.google.protobuf.Descriptors.Descriptor
-        getDescriptorForType() {
-      return Dm_v2Proto.internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_descriptor;
-    }
-
-    @Override
-    public dm_v2 getDefaultInstanceForType() {
-      return dm_v2.getDefaultInstance();
-    }
-
-    @Override
-    public dm_v2 build() {
-      dm_v2 result = buildPartial();
-      if (!result.isInitialized()) {
-        throw newUninitializedMessageException(result);
-      }
-      return result;
-    }
-
-    @Override
-    public dm_v2 buildPartial() {
-      dm_v2 result = new dm_v2(this);
-      if (bitField0_ != 0) { buildPartial0(result); }
-      onBuilt();
-      return result;
-    }
-
-    private void buildPartial0(dm_v2 result) {
-      int from_bitField0_ = bitField0_;
-      if (((from_bitField0_ & 0x00000001) != 0)) {
-        result.dmV220_ = dmV220Builder_ == null
-            ? dmV220_
-            : dmV220Builder_.build();
-      }
-    }
-
-    @Override
-    public Builder clone() {
-      return super.clone();
-    }
-    @Override
-    public Builder setField(
-        com.google.protobuf.Descriptors.FieldDescriptor field,
-        Object value) {
-      return super.setField(field, value);
-    }
-    @Override
-    public Builder clearField(
-        com.google.protobuf.Descriptors.FieldDescriptor field) {
-      return super.clearField(field);
-    }
-    @Override
-    public Builder clearOneof(
-        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
-      return super.clearOneof(oneof);
-    }
-    @Override
-    public Builder setRepeatedField(
-        com.google.protobuf.Descriptors.FieldDescriptor field,
-        int index, Object value) {
-      return super.setRepeatedField(field, index, value);
-    }
-    @Override
-    public Builder addRepeatedField(
-        com.google.protobuf.Descriptors.FieldDescriptor field,
-        Object value) {
-      return super.addRepeatedField(field, value);
-    }
-    @Override
-    public Builder mergeFrom(com.google.protobuf.Message other) {
-      if (other instanceof dm_v2) {
-        return mergeFrom((dm_v2)other);
-      } else {
-        super.mergeFrom(other);
-        return this;
-      }
-    }
-
-    public Builder mergeFrom(dm_v2 other) {
-      if (other == dm_v2.getDefaultInstance()) return this;
-      if (other.hasDmV220()) {
-        mergeDmV220(other.getDmV220());
-      }
-      this.mergeUnknownFields(other.getUnknownFields());
-      onChanged();
-      return this;
-    }
-
-    @Override
-    public final boolean isInitialized() {
-      return true;
-    }
-
-    @Override
-    public Builder mergeFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      if (extensionRegistry == null) {
-        throw new NullPointerException();
-      }
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            case 162: {
-              input.readMessage(
-                  getDmV220FieldBuilder().getBuilder(),
-                  extensionRegistry);
-              bitField0_ |= 0x00000001;
-              break;
-            } // case 162
-            default: {
-              if (!super.parseUnknownField(input, extensionRegistry, tag)) {
-                done = true; // was an endgroup tag
-              }
-              break;
-            } // default:
-          } // switch (tag)
-        } // while (!done)
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.unwrapIOException();
-      } finally {
-        onChanged();
-      } // finally
-      return this;
-    }
-    private int bitField0_;
-
-    private dm_v2_20 dmV220_;
-    private com.google.protobuf.SingleFieldBuilderV3<
-        dm_v2_20, dm_v2_20.Builder, dm_v2_20OrBuilder> dmV220Builder_;
-    /**
-     * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-     * @return Whether the dmV220 field is set.
-     */
-    public boolean hasDmV220() {
-      return ((bitField0_ & 0x00000001) != 0);
-    }
-    /**
-     * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-     * @return The dmV220.
-     */
-    public dm_v2_20 getDmV220() {
-      if (dmV220Builder_ == null) {
-        return dmV220_ == null ? dm_v2_20.getDefaultInstance() : dmV220_;
-      } else {
-        return dmV220Builder_.getMessage();
-      }
-    }
-    /**
-     * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-     */
-    public Builder setDmV220(dm_v2_20 value) {
-      if (dmV220Builder_ == null) {
-        if (value == null) {
-          throw new NullPointerException();
-        }
-        dmV220_ = value;
-      } else {
-        dmV220Builder_.setMessage(value);
-      }
-      bitField0_ |= 0x00000001;
-      onChanged();
-      return this;
-    }
-    /**
-     * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-     */
-    public Builder setDmV220(
-        dm_v2_20.Builder builderForValue) {
-      if (dmV220Builder_ == null) {
-        dmV220_ = builderForValue.build();
-      } else {
-        dmV220Builder_.setMessage(builderForValue.build());
-      }
-      bitField0_ |= 0x00000001;
-      onChanged();
-      return this;
-    }
-    /**
-     * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-     */
-    public Builder mergeDmV220(dm_v2_20 value) {
-      if (dmV220Builder_ == null) {
-        if (((bitField0_ & 0x00000001) != 0) &&
-          dmV220_ != null &&
-          dmV220_ != dm_v2_20.getDefaultInstance()) {
-          getDmV220Builder().mergeFrom(value);
-        } else {
-          dmV220_ = value;
-        }
-      } else {
-        dmV220Builder_.mergeFrom(value);
-      }
-      bitField0_ |= 0x00000001;
-      onChanged();
-      return this;
-    }
-    /**
-     * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-     */
-    public Builder clearDmV220() {
-      bitField0_ = (bitField0_ & ~0x00000001);
-      dmV220_ = null;
-      if (dmV220Builder_ != null) {
-        dmV220Builder_.dispose();
-        dmV220Builder_ = null;
-      }
-      onChanged();
-      return this;
-    }
-    /**
-     * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-     */
-    public dm_v2_20.Builder getDmV220Builder() {
-      bitField0_ |= 0x00000001;
-      onChanged();
-      return getDmV220FieldBuilder().getBuilder();
-    }
-    /**
-     * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-     */
-    public dm_v2_20OrBuilder getDmV220OrBuilder() {
-      if (dmV220Builder_ != null) {
-        return dmV220Builder_.getMessageOrBuilder();
-      } else {
-        return dmV220_ == null ?
-            dm_v2_20.getDefaultInstance() : dmV220_;
-      }
-    }
-    /**
-     * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-     */
-    private com.google.protobuf.SingleFieldBuilderV3<
-        dm_v2_20, dm_v2_20.Builder, dm_v2_20OrBuilder>
-        getDmV220FieldBuilder() {
-      if (dmV220Builder_ == null) {
-        dmV220Builder_ = new com.google.protobuf.SingleFieldBuilderV3<
-            dm_v2_20, dm_v2_20.Builder, dm_v2_20OrBuilder>(
-                getDmV220(),
-                getParentForChildren(),
-                isClean());
-        dmV220_ = null;
-      }
-      return dmV220Builder_;
-    }
-    @Override
-    public final Builder setUnknownFields(
-        final com.google.protobuf.UnknownFieldSet unknownFields) {
-      return super.setUnknownFields(unknownFields);
-    }
-
-    @Override
-    public final Builder mergeUnknownFields(
-        final com.google.protobuf.UnknownFieldSet unknownFields) {
-      return super.mergeUnknownFields(unknownFields);
-    }
-
-
-    // @@protoc_insertion_point(builder_scope:tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2)
-  }
-
-  // @@protoc_insertion_point(class_scope:tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2)
-  private static final dm_v2 DEFAULT_INSTANCE;
-  static {
-    DEFAULT_INSTANCE = new dm_v2();
-  }
-
-  public static dm_v2 getDefaultInstance() {
-    return DEFAULT_INSTANCE;
-  }
-
-  private static final com.google.protobuf.Parser<dm_v2>
-      PARSER = new com.google.protobuf.AbstractParser<dm_v2>() {
-    @Override
-    public dm_v2 parsePartialFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      Builder builder = newBuilder();
-      try {
-        builder.mergeFrom(input, extensionRegistry);
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(builder.buildPartial());
-      } catch (com.google.protobuf.UninitializedMessageException e) {
-        throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(e)
-            .setUnfinishedMessage(builder.buildPartial());
-      }
-      return builder.buildPartial();
-    }
-  };
-
-  public static com.google.protobuf.Parser<dm_v2> parser() {
-    return PARSER;
-  }
-
-  @Override
-  public com.google.protobuf.Parser<dm_v2> getParserForType() {
-    return PARSER;
-  }
-
-  @Override
-  public dm_v2 getDefaultInstanceForType() {
-    return DEFAULT_INSTANCE;
-  }
-
-}
-

+ 0 - 48
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/protobuf/dm_v2OrBuilder.java

@@ -1,48 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: dm_v2.proto
-
-package tech.ordinaryroad.live.chat.client.bilibili.protobuf;
-
-public interface dm_v2OrBuilder extends
-    // @@protoc_insertion_point(interface_extends:tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2)
-    com.google.protobuf.MessageOrBuilder {
-
-  /**
-   * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-   * @return Whether the dmV220 field is set.
-   */
-  boolean hasDmV220();
-  /**
-   * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-   * @return The dmV220.
-   */
-  dm_v2_20 getDmV220();
-  /**
-   * <code>.tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20 dm_v2_20 = 20;</code>
-   */
-  dm_v2_20OrBuilder getDmV220OrBuilder();
-}

+ 0 - 565
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/protobuf/dm_v2_20.java

@@ -1,565 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: dm_v2_20.proto
-
-package tech.ordinaryroad.live.chat.client.bilibili.protobuf;
-
-/**
- * Protobuf type {@code tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20}
- */
-public final class dm_v2_20 extends
-    com.google.protobuf.GeneratedMessageV3 implements
-    // @@protoc_insertion_point(message_implements:tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20)
-    dm_v2_20OrBuilder {
-private static final long serialVersionUID = 0L;
-  // Use dm_v2_20.newBuilder() to construct.
-  private dm_v2_20(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
-    super(builder);
-  }
-  private dm_v2_20() {
-    avatar_ = "";
-  }
-
-  @Override
-  @SuppressWarnings({"unused"})
-  protected Object newInstance(
-      UnusedPrivateParameter unused) {
-    return new dm_v2_20();
-  }
-
-  public static final com.google.protobuf.Descriptors.Descriptor
-      getDescriptor() {
-    return Dm_v2_20Proto.internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_20_descriptor;
-  }
-
-  @Override
-  protected FieldAccessorTable
-      internalGetFieldAccessorTable() {
-    return Dm_v2_20Proto.internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_20_fieldAccessorTable
-        .ensureFieldAccessorsInitialized(
-            dm_v2_20.class, Builder.class);
-  }
-
-  public static final int AVATAR_FIELD_NUMBER = 4;
-  @SuppressWarnings("serial")
-  private volatile Object avatar_ = "";
-  /**
-   * <code>string avatar = 4;</code>
-   * @return The avatar.
-   */
-  @Override
-  public String getAvatar() {
-    Object ref = avatar_;
-    if (ref instanceof String) {
-      return (String) ref;
-    } else {
-      com.google.protobuf.ByteString bs = 
-          (com.google.protobuf.ByteString) ref;
-      String s = bs.toStringUtf8();
-      avatar_ = s;
-      return s;
-    }
-  }
-  /**
-   * <code>string avatar = 4;</code>
-   * @return The bytes for avatar.
-   */
-  @Override
-  public com.google.protobuf.ByteString
-      getAvatarBytes() {
-    Object ref = avatar_;
-    if (ref instanceof String) {
-      com.google.protobuf.ByteString b = 
-          com.google.protobuf.ByteString.copyFromUtf8(
-              (String) ref);
-      avatar_ = b;
-      return b;
-    } else {
-      return (com.google.protobuf.ByteString) ref;
-    }
-  }
-
-  private byte memoizedIsInitialized = -1;
-  @Override
-  public final boolean isInitialized() {
-    byte isInitialized = memoizedIsInitialized;
-    if (isInitialized == 1) return true;
-    if (isInitialized == 0) return false;
-
-    memoizedIsInitialized = 1;
-    return true;
-  }
-
-  @Override
-  public void writeTo(com.google.protobuf.CodedOutputStream output)
-                      throws java.io.IOException {
-    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(avatar_)) {
-      com.google.protobuf.GeneratedMessageV3.writeString(output, 4, avatar_);
-    }
-    getUnknownFields().writeTo(output);
-  }
-
-  @Override
-  public int getSerializedSize() {
-    int size = memoizedSize;
-    if (size != -1) return size;
-
-    size = 0;
-    if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(avatar_)) {
-      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, avatar_);
-    }
-    size += getUnknownFields().getSerializedSize();
-    memoizedSize = size;
-    return size;
-  }
-
-  @Override
-  public boolean equals(final Object obj) {
-    if (obj == this) {
-     return true;
-    }
-    if (!(obj instanceof dm_v2_20)) {
-      return super.equals(obj);
-    }
-    dm_v2_20 other = (dm_v2_20) obj;
-
-    if (!getAvatar()
-        .equals(other.getAvatar())) return false;
-    if (!getUnknownFields().equals(other.getUnknownFields())) return false;
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    if (memoizedHashCode != 0) {
-      return memoizedHashCode;
-    }
-    int hash = 41;
-    hash = (19 * hash) + getDescriptor().hashCode();
-    hash = (37 * hash) + AVATAR_FIELD_NUMBER;
-    hash = (53 * hash) + getAvatar().hashCode();
-    hash = (29 * hash) + getUnknownFields().hashCode();
-    memoizedHashCode = hash;
-    return hash;
-  }
-
-  public static dm_v2_20 parseFrom(
-      java.nio.ByteBuffer data)
-      throws com.google.protobuf.InvalidProtocolBufferException {
-    return PARSER.parseFrom(data);
-  }
-  public static dm_v2_20 parseFrom(
-      java.nio.ByteBuffer data,
-      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-      throws com.google.protobuf.InvalidProtocolBufferException {
-    return PARSER.parseFrom(data, extensionRegistry);
-  }
-  public static dm_v2_20 parseFrom(
-      com.google.protobuf.ByteString data)
-      throws com.google.protobuf.InvalidProtocolBufferException {
-    return PARSER.parseFrom(data);
-  }
-  public static dm_v2_20 parseFrom(
-      com.google.protobuf.ByteString data,
-      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-      throws com.google.protobuf.InvalidProtocolBufferException {
-    return PARSER.parseFrom(data, extensionRegistry);
-  }
-  public static dm_v2_20 parseFrom(byte[] data)
-      throws com.google.protobuf.InvalidProtocolBufferException {
-    return PARSER.parseFrom(data);
-  }
-  public static dm_v2_20 parseFrom(
-      byte[] data,
-      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-      throws com.google.protobuf.InvalidProtocolBufferException {
-    return PARSER.parseFrom(data, extensionRegistry);
-  }
-  public static dm_v2_20 parseFrom(java.io.InputStream input)
-      throws java.io.IOException {
-    return com.google.protobuf.GeneratedMessageV3
-        .parseWithIOException(PARSER, input);
-  }
-  public static dm_v2_20 parseFrom(
-      java.io.InputStream input,
-      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-      throws java.io.IOException {
-    return com.google.protobuf.GeneratedMessageV3
-        .parseWithIOException(PARSER, input, extensionRegistry);
-  }
-
-  public static dm_v2_20 parseDelimitedFrom(java.io.InputStream input)
-      throws java.io.IOException {
-    return com.google.protobuf.GeneratedMessageV3
-        .parseDelimitedWithIOException(PARSER, input);
-  }
-
-  public static dm_v2_20 parseDelimitedFrom(
-      java.io.InputStream input,
-      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-      throws java.io.IOException {
-    return com.google.protobuf.GeneratedMessageV3
-        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
-  }
-  public static dm_v2_20 parseFrom(
-      com.google.protobuf.CodedInputStream input)
-      throws java.io.IOException {
-    return com.google.protobuf.GeneratedMessageV3
-        .parseWithIOException(PARSER, input);
-  }
-  public static dm_v2_20 parseFrom(
-      com.google.protobuf.CodedInputStream input,
-      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-      throws java.io.IOException {
-    return com.google.protobuf.GeneratedMessageV3
-        .parseWithIOException(PARSER, input, extensionRegistry);
-  }
-
-  @Override
-  public Builder newBuilderForType() { return newBuilder(); }
-  public static Builder newBuilder() {
-    return DEFAULT_INSTANCE.toBuilder();
-  }
-  public static Builder newBuilder(dm_v2_20 prototype) {
-    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
-  }
-  @Override
-  public Builder toBuilder() {
-    return this == DEFAULT_INSTANCE
-        ? new Builder() : new Builder().mergeFrom(this);
-  }
-
-  @Override
-  protected Builder newBuilderForType(
-      BuilderParent parent) {
-    Builder builder = new Builder(parent);
-    return builder;
-  }
-  /**
-   * Protobuf type {@code tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20}
-   */
-  public static final class Builder extends
-      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
-      // @@protoc_insertion_point(builder_implements:tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20)
-      dm_v2_20OrBuilder {
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return Dm_v2_20Proto.internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_20_descriptor;
-    }
-
-    @Override
-    protected FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return Dm_v2_20Proto.internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_20_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              dm_v2_20.class, Builder.class);
-    }
-
-    // Construct using tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20.newBuilder()
-    private Builder() {
-
-    }
-
-    private Builder(
-        BuilderParent parent) {
-      super(parent);
-
-    }
-    @Override
-    public Builder clear() {
-      super.clear();
-      bitField0_ = 0;
-      avatar_ = "";
-      return this;
-    }
-
-    @Override
-    public com.google.protobuf.Descriptors.Descriptor
-        getDescriptorForType() {
-      return Dm_v2_20Proto.internal_static_tech_ordinaryroad_live_chat_client_bilibili_protobuf_dm_v2_20_descriptor;
-    }
-
-    @Override
-    public dm_v2_20 getDefaultInstanceForType() {
-      return dm_v2_20.getDefaultInstance();
-    }
-
-    @Override
-    public dm_v2_20 build() {
-      dm_v2_20 result = buildPartial();
-      if (!result.isInitialized()) {
-        throw newUninitializedMessageException(result);
-      }
-      return result;
-    }
-
-    @Override
-    public dm_v2_20 buildPartial() {
-      dm_v2_20 result = new dm_v2_20(this);
-      if (bitField0_ != 0) { buildPartial0(result); }
-      onBuilt();
-      return result;
-    }
-
-    private void buildPartial0(dm_v2_20 result) {
-      int from_bitField0_ = bitField0_;
-      if (((from_bitField0_ & 0x00000001) != 0)) {
-        result.avatar_ = avatar_;
-      }
-    }
-
-    @Override
-    public Builder clone() {
-      return super.clone();
-    }
-    @Override
-    public Builder setField(
-        com.google.protobuf.Descriptors.FieldDescriptor field,
-        Object value) {
-      return super.setField(field, value);
-    }
-    @Override
-    public Builder clearField(
-        com.google.protobuf.Descriptors.FieldDescriptor field) {
-      return super.clearField(field);
-    }
-    @Override
-    public Builder clearOneof(
-        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
-      return super.clearOneof(oneof);
-    }
-    @Override
-    public Builder setRepeatedField(
-        com.google.protobuf.Descriptors.FieldDescriptor field,
-        int index, Object value) {
-      return super.setRepeatedField(field, index, value);
-    }
-    @Override
-    public Builder addRepeatedField(
-        com.google.protobuf.Descriptors.FieldDescriptor field,
-        Object value) {
-      return super.addRepeatedField(field, value);
-    }
-    @Override
-    public Builder mergeFrom(com.google.protobuf.Message other) {
-      if (other instanceof dm_v2_20) {
-        return mergeFrom((dm_v2_20)other);
-      } else {
-        super.mergeFrom(other);
-        return this;
-      }
-    }
-
-    public Builder mergeFrom(dm_v2_20 other) {
-      if (other == dm_v2_20.getDefaultInstance()) return this;
-      if (!other.getAvatar().isEmpty()) {
-        avatar_ = other.avatar_;
-        bitField0_ |= 0x00000001;
-        onChanged();
-      }
-      this.mergeUnknownFields(other.getUnknownFields());
-      onChanged();
-      return this;
-    }
-
-    @Override
-    public final boolean isInitialized() {
-      return true;
-    }
-
-    @Override
-    public Builder mergeFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      if (extensionRegistry == null) {
-        throw new NullPointerException();
-      }
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            case 34: {
-              avatar_ = input.readStringRequireUtf8();
-              bitField0_ |= 0x00000001;
-              break;
-            } // case 34
-            default: {
-              if (!super.parseUnknownField(input, extensionRegistry, tag)) {
-                done = true; // was an endgroup tag
-              }
-              break;
-            } // default:
-          } // switch (tag)
-        } // while (!done)
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.unwrapIOException();
-      } finally {
-        onChanged();
-      } // finally
-      return this;
-    }
-    private int bitField0_;
-
-    private Object avatar_ = "";
-    /**
-     * <code>string avatar = 4;</code>
-     * @return The avatar.
-     */
-    public String getAvatar() {
-      Object ref = avatar_;
-      if (!(ref instanceof String)) {
-        com.google.protobuf.ByteString bs =
-            (com.google.protobuf.ByteString) ref;
-        String s = bs.toStringUtf8();
-        avatar_ = s;
-        return s;
-      } else {
-        return (String) ref;
-      }
-    }
-    /**
-     * <code>string avatar = 4;</code>
-     * @return The bytes for avatar.
-     */
-    public com.google.protobuf.ByteString
-        getAvatarBytes() {
-      Object ref = avatar_;
-      if (ref instanceof String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (String) ref);
-        avatar_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-    /**
-     * <code>string avatar = 4;</code>
-     * @param value The avatar to set.
-     * @return This builder for chaining.
-     */
-    public Builder setAvatar(
-        String value) {
-      if (value == null) { throw new NullPointerException(); }
-      avatar_ = value;
-      bitField0_ |= 0x00000001;
-      onChanged();
-      return this;
-    }
-    /**
-     * <code>string avatar = 4;</code>
-     * @return This builder for chaining.
-     */
-    public Builder clearAvatar() {
-      avatar_ = getDefaultInstance().getAvatar();
-      bitField0_ = (bitField0_ & ~0x00000001);
-      onChanged();
-      return this;
-    }
-    /**
-     * <code>string avatar = 4;</code>
-     * @param value The bytes for avatar to set.
-     * @return This builder for chaining.
-     */
-    public Builder setAvatarBytes(
-        com.google.protobuf.ByteString value) {
-      if (value == null) { throw new NullPointerException(); }
-      checkByteStringIsUtf8(value);
-      avatar_ = value;
-      bitField0_ |= 0x00000001;
-      onChanged();
-      return this;
-    }
-    @Override
-    public final Builder setUnknownFields(
-        final com.google.protobuf.UnknownFieldSet unknownFields) {
-      return super.setUnknownFields(unknownFields);
-    }
-
-    @Override
-    public final Builder mergeUnknownFields(
-        final com.google.protobuf.UnknownFieldSet unknownFields) {
-      return super.mergeUnknownFields(unknownFields);
-    }
-
-
-    // @@protoc_insertion_point(builder_scope:tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20)
-  }
-
-  // @@protoc_insertion_point(class_scope:tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20)
-  private static final dm_v2_20 DEFAULT_INSTANCE;
-  static {
-    DEFAULT_INSTANCE = new dm_v2_20();
-  }
-
-  public static dm_v2_20 getDefaultInstance() {
-    return DEFAULT_INSTANCE;
-  }
-
-  private static final com.google.protobuf.Parser<dm_v2_20>
-      PARSER = new com.google.protobuf.AbstractParser<dm_v2_20>() {
-    @Override
-    public dm_v2_20 parsePartialFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      Builder builder = newBuilder();
-      try {
-        builder.mergeFrom(input, extensionRegistry);
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(builder.buildPartial());
-      } catch (com.google.protobuf.UninitializedMessageException e) {
-        throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(e)
-            .setUnfinishedMessage(builder.buildPartial());
-      }
-      return builder.buildPartial();
-    }
-  };
-
-  public static com.google.protobuf.Parser<dm_v2_20> parser() {
-    return PARSER;
-  }
-
-  @Override
-  public com.google.protobuf.Parser<dm_v2_20> getParserForType() {
-    return PARSER;
-  }
-
-  @Override
-  public dm_v2_20 getDefaultInstanceForType() {
-    return DEFAULT_INSTANCE;
-  }
-
-}
-

+ 0 - 45
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/protobuf/dm_v2_20OrBuilder.java

@@ -1,45 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: dm_v2_20.proto
-
-package tech.ordinaryroad.live.chat.client.bilibili.protobuf;
-
-public interface dm_v2_20OrBuilder extends
-    // @@protoc_insertion_point(interface_extends:tech.ordinaryroad.live.chat.client.bilibili.protobuf.dm_v2_20)
-    com.google.protobuf.MessageOrBuilder {
-
-  /**
-   * <code>string avatar = 4;</code>
-   * @return The avatar.
-   */
-  String getAvatar();
-  /**
-   * <code>string avatar = 4;</code>
-   * @return The bytes for avatar.
-   */
-  com.google.protobuf.ByteString
-      getAvatarBytes();
-}

+ 0 - 259
ruoyi-common/ruoyi-common-live/live-chat-clients/live-chat-client-bilibili/src/main/java/tech/ordinaryroad/live/chat/client/bilibili/util/BilibiliCodecUtil.java

@@ -1,259 +0,0 @@
-/*
- * MIT License
- *
- * Copyright (c) 2023 OrdinaryRoad
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-package tech.ordinaryroad.live.chat.client.bilibili.util;
-
-import cn.hutool.core.util.StrUtil;
-import com.aayushatharva.brotli4j.Brotli4jLoader;
-import com.aayushatharva.brotli4j.decoder.BrotliInputStream;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-import lombok.extern.slf4j.Slf4j;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.OperationEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.constant.ProtoverEnum;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.AuthReplyMsg;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.HeartbeatMsg;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.HeartbeatReplyMsg;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.SendSmsReplyMsg;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.BaseBilibiliMsg;
-import tech.ordinaryroad.live.chat.client.bilibili.msg.base.IBilibiliMsg;
-import tech.ordinaryroad.live.chat.client.commons.base.exception.BaseException;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.nio.charset.StandardCharsets;
-import java.util.*;
-import java.util.zip.DataFormatException;
-import java.util.zip.Inflater;
-
-/**
- * @author mjz
- * @date 2023/1/6
- */
-@Slf4j
-public class BilibiliCodecUtil {
-
-    public static int sequence = 0;
-
-    public static final short FRAME_HEADER_LENGTH = 16;
-
-    public static ByteBuf encode(BaseBilibiliMsg msg) {
-        ByteBuf out = Unpooled.buffer(FRAME_HEADER_LENGTH);
-        String bodyJsonString = StrUtil.EMPTY;
-        // HeartbeatMsg不需要正文,如果序列化后得到`{}`,则替换为空字符串
-        if (!(msg instanceof HeartbeatMsg)) {
-            bodyJsonString = msg.toString();
-            if (StrUtil.EMPTY_JSON.equals(bodyJsonString)) {
-                bodyJsonString = StrUtil.EMPTY;
-            }
-        }
-        byte[] bodyBytes = bodyJsonString.getBytes(StandardCharsets.UTF_8);
-        int length = bodyBytes.length + FRAME_HEADER_LENGTH;
-        out.writeInt(length);
-        out.writeShort(FRAME_HEADER_LENGTH);
-        out.writeShort(msg.getProtoverEnum().getCode());
-        out.writeInt(msg.getOperationEnum().getCode());
-        out.writeInt(sequence++);
-        out.writeBytes(bodyBytes);
-        return out;
-    }
-
-    public static List<IBilibiliMsg> decode(ByteBuf in) {
-        List<IBilibiliMsg> msgList = new ArrayList<>();
-        Queue<ByteBuf> pendingByteBuf = new LinkedList<>();
-
-        do {
-            Optional<IBilibiliMsg> msg = doDecode(in, pendingByteBuf);
-            msg.ifPresent(msgList::add);
-            in = pendingByteBuf.poll();
-        } while (in != null);
-
-        return msgList;
-    }
-
-    /**
-     * 执行解码操作,有压缩则先解压,解压后可能得到多条消息
-     *
-     * @param in             handler收到的一条消息
-     * @param pendingByteBuf 用于存放未读取完的ByteBuf
-     * @return Optional<IBilibiliMsg> 何时为空值:不支持的{@link OperationEnum},不支持的{@link ProtoverEnum},{@link #parse(OperationEnum, String)}反序列化失败
-     * @see OperationEnum
-     * @see ProtoverEnum
-     */
-    private static Optional<IBilibiliMsg> doDecode(ByteBuf in, Queue<ByteBuf> pendingByteBuf) {
-        int length = in.readInt();
-        short frameHeaderLength = in.readShort();
-        short protoverCode = in.readShort();
-        int operationCode = in.readInt();
-        int sequence = in.readInt();
-        int contentLength = length - frameHeaderLength;
-        byte[] inputBytes = new byte[contentLength];
-        in.readBytes(inputBytes);
-        if (in.readableBytes() != 0) {
-            // log.error("in.readableBytes() {}", in.readableBytes());
-            pendingByteBuf.offer(in);
-        }
-
-        OperationEnum operationEnum = OperationEnum.getByCode(operationCode);
-        if (operationEnum == null) {
-            throw new BaseException(String.format("未知operation: %d", operationCode));
-        }
-        if (protoverCode == ProtoverEnum.NORMAL_ZLIB.getCode()) {
-            switch (operationEnum) {
-                case SEND_SMS_REPLY: {
-                    // Decompress the bytes
-                    Inflater inflater = new Inflater();
-                    inflater.reset();
-                    inflater.setInput(inputBytes);
-                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(contentLength);
-                    try {
-                        byte[] bytes = new byte[1024];
-                        while (!inflater.finished()) {
-                            int count = inflater.inflate(bytes);
-                            byteArrayOutputStream.write(bytes, 0, count);
-                        }
-                    } catch (DataFormatException e) {
-                        throw new BaseException(e);
-                    }
-                    inflater.end();
-
-                    return doDecode(Unpooled.wrappedBuffer(byteArrayOutputStream.toByteArray()), pendingByteBuf);
-                }
-                case HEARTBEAT_REPLY: {
-                    BigInteger bigInteger = new BigInteger(inputBytes);
-                    return parse(operationEnum, String.format("{\"popularity\":%d}", bigInteger));
-                }
-                default: {
-                    String s = new String(inputBytes, StandardCharsets.UTF_8);
-                    return parse(operationEnum, s);
-                }
-            }
-        } else if (protoverCode == ProtoverEnum.NORMAL_NO_COMPRESSION.getCode()) {
-            switch (operationEnum) {
-                case HEARTBEAT_REPLY: {
-                    BigInteger bigInteger = new BigInteger(inputBytes);
-                    return parse(operationEnum, String.format("{\"popularity\":%d}", bigInteger));
-                }
-                default: {
-                    String s = new String(inputBytes, StandardCharsets.UTF_8);
-                    return parse(operationEnum, s);
-                }
-            }
-        } else if (protoverCode == ProtoverEnum.HEARTBEAT_AUTH_NO_COMPRESSION.getCode()) {
-            switch (operationEnum) {
-                case HEARTBEAT_REPLY: {
-                    BigInteger bigInteger = new BigInteger(inputBytes);
-                    return parse(operationEnum, String.format("{\"popularity\":%d}", bigInteger));
-                }
-                default: {
-                    String s = new String(inputBytes, StandardCharsets.UTF_8);
-                    return parse(operationEnum, s);
-                }
-            }
-        } else if (protoverCode == ProtoverEnum.NORMAL_BROTLI.getCode()) {
-            switch (operationEnum) {
-                case SEND_SMS_REPLY: {
-                    // Load the native library
-                    Brotli4jLoader.ensureAvailability();
-
-                    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(inputBytes);
-                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(contentLength);
-                    byte[] bytes = new byte[1024];
-                    BrotliInputStream brotliInputStream = null;
-                    ByteBuf wrappedBuffer = null;
-                    try {
-                        brotliInputStream = new BrotliInputStream(byteArrayInputStream);
-                        int count;
-                        while ((count = brotliInputStream.read(bytes)) > -1) {
-                            byteArrayOutputStream.write(bytes, 0, count);
-                        }
-                        wrappedBuffer = Unpooled.wrappedBuffer(byteArrayOutputStream.toByteArray());
-                    } catch (IOException e) {
-                        throw new BaseException(e);
-                    } finally {
-                        try {
-                            // Close the BrotliInputStream. This also closes the InputStream.
-                            if (brotliInputStream != null) {
-                                brotliInputStream.close();
-                            }
-                            byteArrayOutputStream.close();
-                        } catch (IOException e) {
-                            log.error("解压失败", e);
-                        }
-                    }
-                    return doDecode(wrappedBuffer, pendingByteBuf);
-                }
-                case HEARTBEAT_REPLY: {
-                    BigInteger bigInteger = new BigInteger(inputBytes);
-                    return parse(operationEnum, String.format("{\"popularity\":%d}", bigInteger));
-                }
-                default: {
-                    String s = new String(inputBytes, StandardCharsets.UTF_8);
-                    return parse(operationEnum, s);
-                }
-            }
-        } else {
-            if (log.isWarnEnabled()) {
-                log.warn("暂不支持的版本:{}", protoverCode);
-            }
-            return Optional.empty();
-        }
-    }
-
-    public static Optional<IBilibiliMsg> parse(OperationEnum operation, String jsonString) {
-        switch (operation) {
-            case SEND_SMS_REPLY: {
-                try {
-                    return Optional.ofNullable(BaseBilibiliMsg.OBJECT_MAPPER.readValue(jsonString, SendSmsReplyMsg.class));
-                } catch (JsonProcessingException e) {
-                    throw new BaseException(e);
-                }
-            }
-            case AUTH_REPLY: {
-                try {
-                    return Optional.ofNullable(BaseBilibiliMsg.OBJECT_MAPPER.readValue(jsonString, AuthReplyMsg.class));
-                } catch (JsonProcessingException e) {
-                    throw new BaseException(e);
-                }
-            }
-            case HEARTBEAT_REPLY: {
-                try {
-                    return Optional.ofNullable(BaseBilibiliMsg.OBJECT_MAPPER.readValue(jsonString, HeartbeatReplyMsg.class));
-                } catch (JsonProcessingException e) {
-                    throw new BaseException(e);
-                }
-            }
-            default: {
-                if (log.isWarnEnabled()) {
-                    log.warn("暂不支持 {}", operation);
-                }
-                return Optional.empty();
-            }
-        }
-    }
-
-}

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác