Просмотр исходного кода

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

release_toaliyun_real
hupeng 7 лет назад
Родитель
Сommit
2cf32e0f80
4 измененных файлов: 15 добавлений и 14 удалений
  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 Просмотреть файл

@@ -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());
}
}

+ 1
- 2
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, "游戏获奖已达到上限"),

/**
* 订单
*/


+ 1
- 1
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获得实体
*


+ 10
- 8
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<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);
}




Загрузка…
Отмена
Сохранить