Procházet zdrojové kódy

[游戏][修复]:限玩次数接口更新

release_toaliyun_real
hupeng před 7 roky
rodič
revize
2cf32e0f80
4 změnil soubory, kde provedl 15 přidání a 14 odebrání
  1. +3
    -3
      mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java
  2. +1
    -2
      mallinkService/src/main/java/com/iformall/common/ErrorCode.java
  3. +1
    -1
      mallinkService/src/main/java/com/iformall/service/WxGameService.java
  4. +10
    -8
      mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java

+ 3
- 3
mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java Zobrazit soubor

@@ -72,10 +72,10 @@ public class WxGameController extends BaseController {
} }


@ApiOperation("添加游戏参与记录") @ApiOperation("添加游戏参与记录")
@GetMapping("checkLimit")
@GetMapping("getCount")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "gameId", value = "游戏ID", dataType = "String", paramType = "query", required = true)}) @ApiImplicitParam(name = "gameId", value = "游戏ID", dataType = "String", paramType = "query", required = true)})
public ResultData checkLimit(String gameId) {
public ResultData getCount(String gameId) {
Long gameIdL = null; Long gameIdL = null;
try { try {
gameIdL = Long.valueOf(gameId); gameIdL = Long.valueOf(gameId);
@@ -83,6 +83,6 @@ public class WxGameController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
} }


return wxGameService.checkLimit(gameIdL,getUserId());
return wxGameService.getCount(gameIdL,getUserId());
} }
} }

+ 1
- 2
mallinkService/src/main/java/com/iformall/common/ErrorCode.java Zobrazit soubor

@@ -122,8 +122,7 @@ public enum ErrorCode{
* 游戏 * 游戏
*/ */
GAME_NOT_FOUND(2070, "游戏未找到"), GAME_NOT_FOUND(2070, "游戏未找到"),
GAME_PLAY_HAS_BEEN_LIMITED(2071, "游戏次数已达到上限"),
GAME_AWARD_HAS_BEEN_LIMITED(2072, "游戏获奖已达到上限"),

/** /**
* 订单 * 订单
*/ */


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/WxGameService.java Zobrazit soubor

@@ -26,7 +26,7 @@ public interface WxGameService {


ResultData addActionLog(Long userId, Long gameId, Long orderId); ResultData addActionLog(Long userId, Long gameId, Long orderId);


ResultData checkLimit(Long gameId, Long userId);
ResultData getCount(Long gameId, Long userId);
/** /**
* 根据Id获得实体 * 根据Id获得实体
* *


+ 10
- 8
mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java Zobrazit soubor

@@ -114,7 +114,7 @@ public class WxGameServiceImpl implements WxGameService {
} }


@Override @Override
public ResultData checkLimit(Long gameId, Long userId) {
public ResultData getCount(Long gameId, Long userId) {


WxGame wxGame = wxGameMapper.selectByPrimaryKey(gameId); WxGame wxGame = wxGameMapper.selectByPrimaryKey(gameId);
if (wxGame == null) if (wxGame == null)
@@ -130,14 +130,16 @@ public class WxGameServiceImpl implements WxGameService {
int playCount = wxGameActionLogMapper.getPlayCount(wxGameActionLog); int playCount = wxGameActionLogMapper.getPlayCount(wxGameActionLog);
int AwardCount = wxGameActionLogMapper.getAwardCount(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<String,Object> 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);
} }






Načítá se…
Zrušit
Uložit