Răsfoiți Sursa

游戏统计

kk 8 luni în urmă
părinte
comite
b863615caa

+ 29 - 21
game-business/src/main/java/com/game/business/controller/AppGameBettingController.java

@@ -6,8 +6,11 @@ import com.game.business.domain.*;
 import com.game.business.dto.AppGameBettingCountDTO;
 import com.game.business.dto.AppGameBettingDetailsCountDTO;
 import com.game.business.service.*;
+import com.game.common.annotation.Anonymous;
 import com.game.common.core.controller.BaseController;
 import com.game.common.core.domain.AjaxResult;
+import com.game.common.core.domain.HttpRet;
+import com.game.common.core.domain.HttpRetPageArr;
 import com.game.common.core.domain.R;
 import com.game.common.core.page.TableDataInfo;
 import io.swagger.annotations.Api;
@@ -48,56 +51,57 @@ public class AppGameBettingController extends BaseController{
     /**
      * 下注
      */
+    @Anonymous
     @PostMapping(value = "/create")
     @ApiOperation(value = "游戏下注", notes = "游戏下注")
-    public AjaxResult betting(@RequestBody AppGameBetting gameBetting)
+    public HttpRet<Boolean> betting(@RequestBody AppGameBetting gameBetting)
     {
 
         if(gameBetting.getClassId() == null){
-            return error("游戏平台ID为空。");
+            return HttpRet.fail("游戏平台ID为空。");
         }
 
         if(gameBetting.getGameId() == null){
-            return error("游戏ID为空。");
+            return HttpRet.fail("游戏ID为空。");
         }
 
         if(gameBetting.getUserId()== null){
-            return error("用户ID为空。");
+            return HttpRet.fail("用户ID为空。");
         }
 
         AppGameClassify appGameClassify = appGameClassifyService.selectAppGameClassifyById(gameBetting.getClassId());
         if(appGameClassify == null){
-            return error("游戏平台不存在。");
+            return HttpRet.fail("游戏平台不存在。");
         }
 
         AppGame appGame = appGameService.selectAppGameById(gameBetting.getGameId());
         if(appGame == null){
-            return error("游戏不存在。");
+            return HttpRet.fail("游戏不存在。");
         }
 
         if(StringUtils.isBlank(appGame.getGameDate())){
-            return error("游戏期号不存在,无法下单。");
+            return HttpRet.fail("游戏期号不存在,无法下单。");
         }
 
         if(StringUtils.isBlank(appGame.getGameTime())){
-            return error("游戏已封盘,无法下单。");
+            return HttpRet.fail("游戏已封盘,无法下单。");
         }
 
         if(!appGame.getGameTime().contains(":")){
-            return error("游戏已封盘,无法下单。");
+            return HttpRet.fail("游戏已封盘,无法下单。");
         }
 
         String[] timeArry = appGame.getGameTime().substring(0, 4).split(":");
         int m = Integer.parseInt(timeArry[1]);
 
         if(m <= 10){
-            return error("游戏已封盘,无法下单。");
+            return HttpRet.fail("游戏已封盘,无法下单。");
         }
 
         long count = appGameLotteryService.selectCount(appGame.getClassifyId(), appGame.getId(), appGame.getGameDate());
 
         if(count > 0){
-            return error("游戏已开奖,无法下单。");
+            return HttpRet.fail("游戏已开奖,无法下单。");
         }
 
         synchronized (this){
@@ -105,12 +109,12 @@ public class AppGameBettingController extends BaseController{
             AppUser appUser = appUserService.selectAppUserByUserid(gameBetting.getUserId());
 
             if(appUser == null){
-                return error("用户不存在。");
+                return HttpRet.fail("用户不存在。");
             }
 
             // 获取用户金额,判断投注金额是否大于余额
             if(gameBetting.getBettingAmount() > appUser.getDiamondCoin()){
-                return error("余额不足,投注失败。");
+                return HttpRet.fail("余额不足,投注失败。");
             }
 
             // 更新用户余额
@@ -174,21 +178,22 @@ public class AppGameBettingController extends BaseController{
             finTranRecordService.insertFinTranRecord(finTranRecord);
         }
 
-        return success();
+        return HttpRet.success("下注成功", true);
     }
 
     /**
      * 游戏输赢统计
      */
-    @GetMapping(value = "/count")
+    @Anonymous
+    @PostMapping(value = "/count")
     @ApiOperation(value = "游戏输赢统计(首页)", notes = "游戏输赢统计(首页)")
-    public R<AppGameBettingCountDTO> getCount(@RequestParam(name = "strDate") String strDate)
+    public HttpRet<AppGameBettingCountDTO> getCount(@RequestParam(name = "strDate") String strDate)
     {
         AppGameBettingCountDTO appGameBettingCountDTO = new AppGameBettingCountDTO();
         List<AppGame> gameList = appGameService.selectAppGameList(new AppGame());
 
         if(gameList == null || gameList.isEmpty()){
-            return R.ok(appGameBettingCountDTO);
+            return HttpRet.success("查询成功",appGameBettingCountDTO);
         }
 
         List<AppGameBettingDetailsCountDTO> countList = appGameBettingService.getCount(strDate);
@@ -206,6 +211,8 @@ public class AppGameBettingController extends BaseController{
             AppGameBettingDetailsCountDTO appGameBettingDetailsCountDTO = new AppGameBettingDetailsCountDTO();
             appGameBettingDetailsCountDTO.setGameId(appGame.getId());
             appGameBettingDetailsCountDTO.setGameName(appGame.getName());
+            appGameBettingDetailsCountDTO.setLogoUrl(appGame.getLogoUrl());
+            appGameBettingDetailsCountDTO.setGamePath(appGame.getGamePath());
             if(idGameMap.containsKey(appGame.getId())){
                 AppGameBettingDetailsCountDTO dbAppGameBettingDetailsCount = idGameMap.get(appGame.getId()).get(0);
                 appGameBettingDetailsCountDTO.setBettingCount(dbAppGameBettingDetailsCount.getBettingCount());
@@ -227,18 +234,19 @@ public class AppGameBettingController extends BaseController{
         appGameBettingCountDTO.setWinAmount(winAmount);
         appGameBettingCountDTO.setLoseAmount(loseAmount);
         appGameBettingCountDTO.setList(newList);
-        return R.ok(appGameBettingCountDTO);
+        return HttpRet.success("查询成功", appGameBettingCountDTO);
     }
 
     /**
      * 游戏输赢详情列表
      */
-    @GetMapping(value = "/listByGameId")
+    @Anonymous
+    @PostMapping(value = "/listByGameId")
     @ApiOperation(value = "游戏输赢统计(详情)", notes = "游戏输赢统计(详情)")
-    public TableDataInfo<AppGameBetting> getListByGameId(@RequestParam(name = "gameId") Long gameId)
+    public HttpRetPageArr<AppGameBetting> getListByGameId(@RequestParam(name = "gameId") Long gameId)
     {
         startPage();
         List<AppGameBetting> list = appGameBettingService.selectListByGameId(gameId);
-        return getDataTable(list);
+        return HttpRetPageArr.success("查询成功",getDataTable(list));
     }
 }

+ 6 - 0
game-business/src/main/java/com/game/business/dto/AppGameBettingDetailsCountDTO.java

@@ -14,6 +14,12 @@ public class AppGameBettingDetailsCountDTO {
     @ApiModelProperty(value = "游戏名称")
     private String gameName;
 
+    @ApiModelProperty(value = "logo")
+    private String logoUrl;
+
+    @ApiModelProperty(value = "游戏路径")
+    private String gamePath;
+
     @ApiModelProperty(value = "数量")
     private long bettingCount;