|
@@ -2,7 +2,12 @@ package com.game.business.websocket.client;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
import com.game.business.config.GameOneConfig;
|
|
import com.game.business.config.GameOneConfig;
|
|
|
|
+import com.game.business.domain.AppGame;
|
|
|
|
+import com.game.business.domain.AppGameLottery;
|
|
|
|
+import com.game.business.service.IAppGameLotteryService;
|
|
|
|
+import com.game.business.service.IAppGameService;
|
|
import com.game.business.util.Common;
|
|
import com.game.business.util.Common;
|
|
|
|
+import com.game.common.utils.DateUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
@@ -13,6 +18,12 @@ import javax.websocket.*;
|
|
@ClientEndpoint
|
|
@ClientEndpoint
|
|
public class GameOneClient {
|
|
public class GameOneClient {
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IAppGameLotteryService appGameLotteryService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IAppGameService appGameService;
|
|
|
|
+
|
|
@OnOpen
|
|
@OnOpen
|
|
public void onOpen(Session session) throws Exception{
|
|
public void onOpen(Session session) throws Exception{
|
|
System.out.printf("game one 游戏已连接 server");
|
|
System.out.printf("game one 游戏已连接 server");
|
|
@@ -60,33 +71,29 @@ public class GameOneClient {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
-// GameType gameType = new GameType();
|
|
|
|
-// gameType.setGameTypeCode(code);
|
|
|
|
-// GameType dbGameType = gameTypeService.selectGameType(gameType);
|
|
|
|
-// if(dbGameType == null){
|
|
|
|
-// System.out.printf("game one 游戏类型数据库不匹配");
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// GameRecord record = JSONObject.parseObject(message, GameRecord.class);
|
|
|
|
-// record.setGameTypeId(dbGameType.getGameTypeId());
|
|
|
|
-// gameRecordService.insertGameRecord(record);
|
|
|
|
-//
|
|
|
|
-// 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);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
+ // 是否为开奖
|
|
|
|
+ Integer isLottery = jsonObject.getInteger("isLottery");
|
|
|
|
+ if(isLottery == 0){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ AppGame appGame = appGameService.selectAppGameById(0L);
|
|
|
|
+
|
|
|
|
+ String gameDate = jsonObject.getString("gameDate");
|
|
|
|
+ String gameRecordDate = jsonObject.getString("gameRecordDate");
|
|
|
|
+ String gameLotterySucc = jsonObject.getString("gameLotterySucc");
|
|
|
|
+
|
|
|
|
+ AppGameLottery appGameLottery = new AppGameLottery();
|
|
|
|
+ appGameLottery.setGameId(appGame.getId());
|
|
|
|
+ appGameLottery.setGameDate(gameDate);
|
|
|
|
+ appGameLottery.setIsLottery(isLottery);
|
|
|
|
+ appGameLottery.setGameRecordDate(DateUtils.parseDate(gameRecordDate));
|
|
|
|
+ appGameLottery.setGameLotterySucc(gameLotterySucc);
|
|
|
|
+
|
|
|
|
+ appGameLotteryService.save(appGameLottery);
|
|
|
|
+
|
|
|
|
+ // 开奖结算
|
|
|
|
+
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
System.out.printf("game one 接收数据异常[" + e.getMessage() + "]");
|
|
System.out.printf("game one 接收数据异常[" + e.getMessage() + "]");
|