feat(game): 添加 PP 平台支持
- 在 GamePlatforms 枚举中添加 PP 平台- 实现 PP 平台的 GamesPPServiceImpl 类 - 添加 PP 平台的地址源 MyPPAddressSource - 优化游戏数据处理逻辑,支持 PP 平台main-pp
parent
a8e2fab566
commit
ff7ddea13e
|
@ -19,6 +19,7 @@ public enum GamePlatforms {
|
|||
PGT("PGT", "PGT"),
|
||||
FBSports("FBSports", "FB体育"),
|
||||
SV388("SV388", "SV388真人"),
|
||||
PP("PP", "PP"),
|
||||
DBSports("DBSports", "DB体育");
|
||||
|
||||
private final String code;
|
||||
|
|
|
@ -4,7 +4,9 @@ import com.dtflys.forest.callback.AddressSource;
|
|||
import com.dtflys.forest.http.ForestAddress;
|
||||
import com.dtflys.forest.http.ForestRequest;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.enums.GamePlatforms;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.game.service.IPlatformService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -18,14 +20,18 @@ import javax.annotation.Resource;
|
|||
*/
|
||||
@Component
|
||||
public class MyPPAddressSource implements AddressSource {
|
||||
|
||||
@Resource
|
||||
private ISysConfigService configService;
|
||||
private IPlatformService platformService;
|
||||
|
||||
|
||||
@Override
|
||||
public ForestAddress getAddress(ForestRequest request) {
|
||||
String apiBaseUrl = configService.selectConfigByKey(Constants.PP_API_BASE_URL);
|
||||
return new ForestAddress("https",apiBaseUrl, 443,"/IntegrationService/v3/http/CasinoGameAPI");
|
||||
String apiBaseUrl = platformService.get(GamePlatforms.PP.getCode())
|
||||
.getUrlInfo().getUrl();
|
||||
String host = platformService.get(GamePlatforms.PP.getCode())
|
||||
.getUrlInfo().getHost();
|
||||
String https = platformService.get(GamePlatforms.PP.getCode())
|
||||
.getUrlInfo().getHttps();
|
||||
return new ForestAddress(https,apiBaseUrl, Integer.parseInt(host),"/IntegrationService/v3/http/CasinoGameAPI");
|
||||
}
|
||||
}
|
|
@ -2,19 +2,15 @@ package com.ff.game.api.pp.impl;
|
|||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.alibaba.druid.support.json.JSONUtils;
|
||||
import com.ff.base.constant.CacheConstants;
|
||||
import com.ff.base.constant.Constants;
|
||||
import com.ff.base.core.redis.RedisCache;
|
||||
import com.ff.base.enums.*;
|
||||
import com.ff.base.exception.base.ApiException;
|
||||
import com.ff.base.exception.base.BaseException;
|
||||
import com.ff.base.system.service.ISysConfigService;
|
||||
import com.ff.base.utils.DateUtils;
|
||||
import com.ff.base.utils.JsonUtil;
|
||||
import com.ff.base.utils.StringUtils;
|
||||
import com.ff.base.utils.sign.Md5Utils;
|
||||
import com.ff.base.utils.uuid.IdUtils;
|
||||
import com.ff.config.KeyConfig;
|
||||
import com.ff.game.api.IGamesService;
|
||||
import com.ff.game.api.pp.client.PPClient;
|
||||
|
@ -22,21 +18,18 @@ import com.ff.game.api.pp.dto.*;
|
|||
import com.ff.game.api.request.*;
|
||||
import com.ff.game.api.xk.dto.XKGamesDTO;
|
||||
import com.ff.game.domain.*;
|
||||
import com.ff.game.dto.GameSecretKeyCurrencyDTO;
|
||||
import com.ff.game.service.*;
|
||||
import com.ff.member.domain.Member;
|
||||
import com.ff.member.service.IMemberService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
@ -61,8 +54,7 @@ public class GamesPPServiceImpl implements IGamesService {
|
|||
private IGameExchangeMoneyService gameExchangeMoneyService;
|
||||
|
||||
|
||||
@Resource
|
||||
private IGamePlatformService gamePlatformService;
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
|
@ -74,11 +66,6 @@ public class GamesPPServiceImpl implements IGamesService {
|
|||
|
||||
@Resource
|
||||
private IGameFreeRecordService gameFreeRecordService;
|
||||
@Resource
|
||||
private IGameSecretKeyService gameSecretKeyService;
|
||||
|
||||
@Resource
|
||||
private IGameSecretKeyCurrencyService gameSecretKeyCurrencyService;
|
||||
|
||||
@Resource
|
||||
private PPClient PPClient;
|
||||
|
@ -90,8 +77,7 @@ public class GamesPPServiceImpl implements IGamesService {
|
|||
@Resource
|
||||
private IGameBettingDetailsService gameBettingDetailsService;
|
||||
|
||||
@Resource
|
||||
private IGameNameService gameNameService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -99,15 +85,7 @@ public class GamesPPServiceImpl implements IGamesService {
|
|||
*/
|
||||
private static final Long GAME_ID = 1904452832756003817L;
|
||||
|
||||
/**
|
||||
* 平台ID
|
||||
*/
|
||||
private static final Long PLATFORM_ID = 1904411420157108325L;
|
||||
|
||||
/**
|
||||
* 游戏名称id
|
||||
*/
|
||||
private static final Long GAME_NAME_ID = 1904452832756002317L;
|
||||
|
||||
/**
|
||||
* 获得就是成功
|
||||
|
@ -199,6 +177,11 @@ public class GamesPPServiceImpl implements IGamesService {
|
|||
return CacheConstants.PP_GAMES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTransactionId(TransactionIdRequestDTO transactionIdRequestDTO) {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 按代理id进行交换转账
|
||||
*
|
||||
|
@ -218,8 +201,8 @@ public class GamesPPServiceImpl implements IGamesService {
|
|||
* @return {@link Boolean }
|
||||
*/
|
||||
@Override
|
||||
public Boolean exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO) {
|
||||
return Boolean.TRUE;
|
||||
public ExchangeTransferStatusResponseDTO exchangeTransferStatus(ExchangeTransferStatusRequestDTO exchangeTransferMoneyRequestDTO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -312,6 +295,11 @@ public class GamesPPServiceImpl implements IGamesService {
|
|||
throw new ApiException(ErrorCode.PLATFORM_NOT_METHODS.getCode());
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameDemoLoginResponseDTO gameDemoLogin(GameDemoLoginRequestDTO gameDemoLoginRequestDTO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
|
@ -334,7 +322,7 @@ public class GamesPPServiceImpl implements IGamesService {
|
|||
}
|
||||
if (!CollectionUtils.isEmpty(gameBettingDetails)) {
|
||||
//查询重复数据id
|
||||
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds);
|
||||
List<String> removeWagersIds = gameBettingDetailsService.selectGameBettingDetailsByWagersId(wagersIds, GamePlatforms.PP.getCode());
|
||||
//用steam流清除list中与wagersIds集合相同的数据
|
||||
gameBettingDetails = gameBettingDetails.stream()
|
||||
.filter(detail -> !removeWagersIds.contains(detail.getWagersId()))
|
||||
|
@ -358,10 +346,6 @@ public class GamesPPServiceImpl implements IGamesService {
|
|||
DGBetRecordResponseDTO.ReportDTO resultBean = (DGBetRecordResponseDTO.ReportDTO) gamesDataBuildDTO.getData();
|
||||
|
||||
|
||||
GameSecretKeyCurrency currencyDTO = gameSecretKeyCurrencyService.findByGameSecretKeyCurrencyDTO(GameSecretKeyCurrencyDTO.builder()
|
||||
.platformCode(GamePlatforms.DG.getInfo())
|
||||
.currencyId(String.valueOf(resultBean.getCurrencyId()))
|
||||
.build());
|
||||
|
||||
|
||||
Member member = memberService.selectMemberByGameAccount(resultBean.getUserName());
|
||||
|
@ -391,16 +375,16 @@ public class GamesPPServiceImpl implements IGamesService {
|
|||
GameBettingDetails gameBettingDetails = GameBettingDetails.builder()
|
||||
.tenantKey(member.getTenantKey())
|
||||
//保存我们的币种id
|
||||
.currencyCode(currencyDTO.getSystemCurrency())
|
||||
.currencyCode(gamesDataBuildDTO.getSystemCurrencyCode())
|
||||
.memberId(member.getId())
|
||||
.gameCode(String.valueOf(resultBean.getGameId()))
|
||||
.gameType(PlatformType.CARD_GAME.getCode())
|
||||
.platformCode(GamePlatforms.DG.getInfo())
|
||||
.gameId(GAME_ID)
|
||||
.gameId("1")
|
||||
.gameName(game.getGameName())
|
||||
.gameStatus(gameStatus)
|
||||
.gameStatusType(resultBean.getGameType())
|
||||
.gameCurrencyCode(currencyDTO.getCurrency())
|
||||
.gameCurrencyCode(String.valueOf(resultBean.getCurrencyId()))
|
||||
.account(String.valueOf(resultBean.getUserName()))
|
||||
.wagersId(String.valueOf(resultBean.getId()))
|
||||
.wagersTime(resultBean.getBetTime().getTime())
|
||||
|
|
Loading…
Reference in New Issue