Browse Source

websocket

kk 9 months ago
parent
commit
0a279fda07

+ 33 - 0
game-business/pom.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+    <parent>
+        <artifactId>game</artifactId>
+        <groupId>com.game</groupId>
+        <version>3.8.7</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>game-business</artifactId>
+
+    <description>
+        business业务处理
+    </description>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-websocket</artifactId>
+        </dependency>
+
+        <!-- 通用工具-->
+        <dependency>
+            <groupId>com.game</groupId>
+            <artifactId>game-common</artifactId>
+        </dependency>
+
+    </dependencies>
+
+</project>

+ 13 - 8
game-business/src/main/java/com/game/business/websocket/client/GameOneClient.java

@@ -87,16 +87,21 @@ public class GameOneClient {
             record.setGameTypeId(dbGameType.getGameTypeId());
             gameRecordService.insertGameRecord(record);
 
-            // 如果是开奖,添加开奖记录
-            if(record.getIsLottery() == 1){
-                GameLottery gameLottery = new GameLottery();
-                gameLottery.setGameTypeId(dbGameType.getGameTypeId());
-                gameLottery.setGameDate(record.getGameDate());
-                gameLottery.setGameLotteryDate(record.getGameRecordDate());
-                gameLottery.setGameLotterySucc(record.getGameLotterySucc());
+            GameLottery gameLottery = new GameLottery();
+            gameLottery.setGameTypeId(dbGameType.getGameTypeId());
+            gameLottery.setGameDate(record.getGameDate());
+
+            GameLottery dbGameLottery = gameLotteryService.selectGameLottery(gameLottery);
+
+            if(dbGameLottery == null){
                 gameLotteryService.insertGameLottery(gameLottery);
+            }else{
+                if(record.getIsLottery() == 1) {
+                    dbGameLottery.setGameLotteryDate(record.getGameRecordDate());
+                    dbGameLottery.setGameLotterySucc(record.getGameLotterySucc());
+                    gameLotteryService.updateGameLottery(dbGameLottery);
+                }
             }
-
         }catch (Exception e){
             e.printStackTrace();
             System.out.printf("game one 接收数据异常[" + e.getMessage() + "]");