diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java index bb231ed19..a9bb73413 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java @@ -72,10 +72,10 @@ public class WxGameController extends BaseController { } @ApiOperation("添加游戏参与记录") - @GetMapping("checkLimit") + @GetMapping("getCount") @ApiImplicitParams({ @ApiImplicitParam(name = "gameId", value = "游戏ID", dataType = "String", paramType = "query", required = true)}) - public ResultData checkLimit(String gameId) { + public ResultData getCount(String gameId) { Long gameIdL = null; try { gameIdL = Long.valueOf(gameId); @@ -83,6 +83,6 @@ public class WxGameController extends BaseController { return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); } - return wxGameService.checkLimit(gameIdL,getUserId()); + return wxGameService.getCount(gameIdL,getUserId()); } } diff --git a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java index 84e5199ed..988503436 100644 --- a/mallinkService/src/main/java/com/iformall/common/ErrorCode.java +++ b/mallinkService/src/main/java/com/iformall/common/ErrorCode.java @@ -122,8 +122,7 @@ public enum ErrorCode{ * 游戏 */ GAME_NOT_FOUND(2070, "游戏未找到"), - GAME_PLAY_HAS_BEEN_LIMITED(2071, "游戏次数已达到上限"), - GAME_AWARD_HAS_BEEN_LIMITED(2072, "游戏获奖已达到上限"), + /** * 订单 */ diff --git a/mallinkService/src/main/java/com/iformall/service/WxGameService.java b/mallinkService/src/main/java/com/iformall/service/WxGameService.java index 076cc645d..faa72ba10 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxGameService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxGameService.java @@ -26,7 +26,7 @@ public interface WxGameService { ResultData addActionLog(Long userId, Long gameId, Long orderId); - ResultData checkLimit(Long gameId, Long userId); + ResultData getCount(Long gameId, Long userId); /** * 根据Id获得实体 * diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java index 2b41941d5..defdffb36 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java @@ -114,7 +114,7 @@ public class WxGameServiceImpl implements WxGameService { } @Override - public ResultData checkLimit(Long gameId, Long userId) { + public ResultData getCount(Long gameId, Long userId) { WxGame wxGame = wxGameMapper.selectByPrimaryKey(gameId); if (wxGame == null) @@ -130,14 +130,16 @@ public class WxGameServiceImpl implements WxGameService { int playCount = wxGameActionLogMapper.getPlayCount(wxGameActionLog); int AwardCount = wxGameActionLogMapper.getAwardCount(wxGameActionLog); - if ( playLimit != 0 - && playCount >= playLimit) - return new ResultData(ErrorCode.GAME_PLAY_HAS_BEEN_LIMITED); + boolean playAble = !(( playLimit != 0 && playCount >= playLimit) + || (AwardLimit != 0 && AwardCount >= AwardLimit)); - if (AwardLimit != 0 - && AwardCount >= AwardLimit) - return new ResultData(ErrorCode.GAME_AWARD_HAS_BEEN_LIMITED); - return new ResultData(playLimit - playCount); + Map map = new HashMap(); + map.put("playLimit",playLimit); + map.put("AwardLimit",AwardLimit); + map.put("playCount",playCount); + map.put("AwardCount",AwardCount); + map.put("playAble",playAble); + return new ResultData(map); }