feat(game): 添加 PP 游戏接口相关类和方法

- 新增 PP 游戏相关的常量和配置
- 添加 PP 游戏用户信息、登录、游戏列表等接口的请求和响应类- 实现 PP 游戏服务的基本功能,包括创建用户、获取游戏列表等
- 添加地址源和客户端接口,用于与 PP游戏服务器通信
main-fb
shi 2025-03-27 17:07:17 +08:00
parent d293f638bf
commit cc17d83e16
5 changed files with 33 additions and 32 deletions

View File

@ -233,6 +233,7 @@ public class GamesDGServiceImpl implements IGamesService {
//没有此平台就新增一个平台 //没有此平台就新增一个平台
if (ObjectUtils.isEmpty(gamePlatform)) { if (ObjectUtils.isEmpty(gamePlatform)) {
gamePlatform = new GamePlatform(); gamePlatform = new GamePlatform();
gamePlatform.setId(PLATFORM_ID);
gamePlatform.setPlatformCode(GamePlatforms.DG.getInfo()); gamePlatform.setPlatformCode(GamePlatforms.DG.getInfo());
gamePlatform.setPlatformType(PlatformType.CARD_GAME.getCode()); gamePlatform.setPlatformType(PlatformType.CARD_GAME.getCode());
gamePlatform.setPlatformName(GamePlatforms.DG.getInfo() + PlatformType.CARD_GAME.getName()); gamePlatform.setPlatformName(GamePlatforms.DG.getInfo() + PlatformType.CARD_GAME.getName());
@ -244,6 +245,7 @@ public class GamesDGServiceImpl implements IGamesService {
//不存在这个游戏 //不存在这个游戏
if (ObjectUtils.isEmpty(game)) { if (ObjectUtils.isEmpty(game)) {
game = new Game(); game = new Game();
game.setId(GAME_ID);
game.setSortNo(gameService.selectMaxSortNoByPlatformId(gamePlatform.getId()) + 1); game.setSortNo(gameService.selectMaxSortNoByPlatformId(gamePlatform.getId()) + 1);
game.setPlatformId(gamePlatform.getId()); game.setPlatformId(gamePlatform.getId());
game.setGameCode("1"); game.setGameCode("1");
@ -255,6 +257,7 @@ public class GamesDGServiceImpl implements IGamesService {
GameName gameName = gameNameService.selectGameNameById(GAME_NAME_ID); GameName gameName = gameNameService.selectGameNameById(GAME_NAME_ID);
if (ObjectUtils.isEmpty(gameName)) { if (ObjectUtils.isEmpty(gameName)) {
gameNameService.insertGameName(GameName.builder() gameNameService.insertGameName(GameName.builder()
.id(GAME_NAME_ID)
.gameId(game.getId()) .gameId(game.getId())
.gameName(game.getGameName()) .gameName(game.getGameName())
.langCode("zh-CN") .langCode("zh-CN")

View File

@ -245,6 +245,7 @@ public class GamesSAServiceImpl implements IGamesService {
//没有此平台就新增一个平台 //没有此平台就新增一个平台
if (ObjectUtils.isEmpty(gamePlatform)) { if (ObjectUtils.isEmpty(gamePlatform)) {
gamePlatform = new GamePlatform(); gamePlatform = new GamePlatform();
gamePlatform.setId(PLATFORM_ID);
gamePlatform.setPlatformCode(GamePlatforms.SA.getInfo()); gamePlatform.setPlatformCode(GamePlatforms.SA.getInfo());
gamePlatform.setPlatformType(PlatformType.CARD_GAME.getCode()); gamePlatform.setPlatformType(PlatformType.CARD_GAME.getCode());
gamePlatform.setPlatformName(GamePlatforms.SA.getInfo() + PlatformType.CARD_GAME.getName()); gamePlatform.setPlatformName(GamePlatforms.SA.getInfo() + PlatformType.CARD_GAME.getName());
@ -256,6 +257,7 @@ public class GamesSAServiceImpl implements IGamesService {
//不存在这个游戏 //不存在这个游戏
if (ObjectUtils.isEmpty(game)) { if (ObjectUtils.isEmpty(game)) {
game = new Game(); game = new Game();
game.setId(GAME_ID);
game.setSortNo(gameService.selectMaxSortNoByPlatformId(gamePlatform.getId()) + 1); game.setSortNo(gameService.selectMaxSortNoByPlatformId(gamePlatform.getId()) + 1);
game.setPlatformId(gamePlatform.getId()); game.setPlatformId(gamePlatform.getId());
game.setGameCode("1"); game.setGameCode("1");
@ -267,6 +269,7 @@ public class GamesSAServiceImpl implements IGamesService {
GameName gameName = gameNameService.selectGameNameById(GAME_NAME_ID); GameName gameName = gameNameService.selectGameNameById(GAME_NAME_ID);
if (ObjectUtils.isEmpty(gameName)) { if (ObjectUtils.isEmpty(gameName)) {
gameNameService.insertGameName(GameName.builder() gameNameService.insertGameName(GameName.builder()
.id(GAME_NAME_ID)
.gameId(game.getId()) .gameId(game.getId())
.gameName(game.getGameName()) .gameName(game.getGameName())
.langCode("zh-CN") .langCode("zh-CN")

View File

@ -2,6 +2,7 @@ package com.ff.game.service.impl;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import com.ff.base.utils.DateUtils; import com.ff.base.utils.DateUtils;
import com.ff.game.domain.GameName; import com.ff.game.domain.GameName;
import com.ff.game.dto.GameDTO; import com.ff.game.dto.GameDTO;
@ -20,8 +21,7 @@ import cn.hutool.core.util.IdUtil;
* @date 2025-03-13 * @date 2025-03-13
*/ */
@Service @Service
public class GameNameServiceImpl implements IGameNameService public class GameNameServiceImpl implements IGameNameService {
{
@Autowired @Autowired
private GameNameMapper gameNameMapper; private GameNameMapper gameNameMapper;
@ -32,8 +32,7 @@ public class GameNameServiceImpl implements IGameNameService
* @return * @return
*/ */
@Override @Override
public GameName selectGameNameById(Long id) public GameName selectGameNameById(Long id) {
{
return gameNameMapper.selectGameNameById(id); return gameNameMapper.selectGameNameById(id);
} }
@ -44,8 +43,7 @@ public class GameNameServiceImpl implements IGameNameService
* @return * @return
*/ */
@Override @Override
public List<GameName> selectGameNameList(GameName gameName) public List<GameName> selectGameNameList(GameName gameName) {
{
return gameNameMapper.selectGameNameList(gameName); return gameNameMapper.selectGameNameList(gameName);
} }
@ -56,9 +54,11 @@ public class GameNameServiceImpl implements IGameNameService
* @return * @return
*/ */
@Override @Override
public int insertGameName(GameName gameName) public int insertGameName(GameName gameName) {
{ if (gameName.getId() == null) {
gameName.setId(IdUtil.getSnowflakeNextId()); gameName.setId(IdUtil.getSnowflakeNextId());
}
gameName.setCreateTime(DateUtils.getNowDate()); gameName.setCreateTime(DateUtils.getNowDate());
return gameNameMapper.insertGameName(gameName); return gameNameMapper.insertGameName(gameName);
} }
@ -70,8 +70,7 @@ public class GameNameServiceImpl implements IGameNameService
* @return * @return
*/ */
@Override @Override
public int updateGameName(GameName gameName) public int updateGameName(GameName gameName) {
{
gameName.setUpdateTime(DateUtils.getNowDate()); gameName.setUpdateTime(DateUtils.getNowDate());
return gameNameMapper.updateGameName(gameName); return gameNameMapper.updateGameName(gameName);
} }
@ -83,8 +82,7 @@ public class GameNameServiceImpl implements IGameNameService
* @return * @return
*/ */
@Override @Override
public int deleteGameNameByIds(Long[] ids) public int deleteGameNameByIds(Long[] ids) {
{
return gameNameMapper.deleteGameNameByIds(ids); return gameNameMapper.deleteGameNameByIds(ids);
} }
@ -95,8 +93,7 @@ public class GameNameServiceImpl implements IGameNameService
* @return * @return
*/ */
@Override @Override
public int deleteGameNameById(Long id) public int deleteGameNameById(Long id) {
{
return gameNameMapper.deleteGameNameById(id); return gameNameMapper.deleteGameNameById(id);
} }

View File

@ -4,11 +4,13 @@ import java.util.List;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.ff.base.utils.DateUtils; import com.ff.base.utils.DateUtils;
import com.ff.base.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ff.game.mapper.GamePlatformMapper; import com.ff.game.mapper.GamePlatformMapper;
import com.ff.game.domain.GamePlatform; import com.ff.game.domain.GamePlatform;
import com.ff.game.service.IGamePlatformService; import com.ff.game.service.IGamePlatformService;
import org.springframework.util.ObjectUtils;
/** /**
* Service * Service
@ -17,8 +19,7 @@ import com.ff.game.service.IGamePlatformService;
* @date 2025-02-10 * @date 2025-02-10
*/ */
@Service @Service
public class GamePlatformServiceImpl implements IGamePlatformService public class GamePlatformServiceImpl implements IGamePlatformService {
{
@Autowired @Autowired
private GamePlatformMapper gamePlatformMapper; private GamePlatformMapper gamePlatformMapper;
@ -29,8 +30,7 @@ public class GamePlatformServiceImpl implements IGamePlatformService
* @return * @return
*/ */
@Override @Override
public GamePlatform selectGamePlatformById(Long id) public GamePlatform selectGamePlatformById(Long id) {
{
return gamePlatformMapper.selectGamePlatformById(id); return gamePlatformMapper.selectGamePlatformById(id);
} }
@ -41,8 +41,7 @@ public class GamePlatformServiceImpl implements IGamePlatformService
* @return * @return
*/ */
@Override @Override
public List<GamePlatform> selectGamePlatformList(GamePlatform gamePlatform) public List<GamePlatform> selectGamePlatformList(GamePlatform gamePlatform) {
{
return gamePlatformMapper.selectGamePlatformList(gamePlatform); return gamePlatformMapper.selectGamePlatformList(gamePlatform);
} }
@ -53,9 +52,10 @@ public class GamePlatformServiceImpl implements IGamePlatformService
* @return * @return
*/ */
@Override @Override
public int insertGamePlatform(GamePlatform gamePlatform) public int insertGamePlatform(GamePlatform gamePlatform) {
{ if (ObjectUtils.isEmpty(gamePlatform.getId())) {
gamePlatform.setId(IdUtil.getSnowflakeNextId()); gamePlatform.setId(IdUtil.getSnowflakeNextId());
}
gamePlatform.setCreateTime(DateUtils.getNowDate()); gamePlatform.setCreateTime(DateUtils.getNowDate());
return gamePlatformMapper.insertGamePlatform(gamePlatform); return gamePlatformMapper.insertGamePlatform(gamePlatform);
} }
@ -67,8 +67,7 @@ public class GamePlatformServiceImpl implements IGamePlatformService
* @return * @return
*/ */
@Override @Override
public int updateGamePlatform(GamePlatform gamePlatform) public int updateGamePlatform(GamePlatform gamePlatform) {
{
gamePlatform.setUpdateTime(DateUtils.getNowDate()); gamePlatform.setUpdateTime(DateUtils.getNowDate());
return gamePlatformMapper.updateGamePlatform(gamePlatform); return gamePlatformMapper.updateGamePlatform(gamePlatform);
} }
@ -80,8 +79,7 @@ public class GamePlatformServiceImpl implements IGamePlatformService
* @return * @return
*/ */
@Override @Override
public int deleteGamePlatformByIds(Long[] ids) public int deleteGamePlatformByIds(Long[] ids) {
{
return gamePlatformMapper.deleteGamePlatformByIds(ids); return gamePlatformMapper.deleteGamePlatformByIds(ids);
} }
@ -92,13 +90,11 @@ public class GamePlatformServiceImpl implements IGamePlatformService
* @return * @return
*/ */
@Override @Override
public int deleteGamePlatformById(Long id) public int deleteGamePlatformById(Long id) {
{
return gamePlatformMapper.deleteGamePlatformById(id); return gamePlatformMapper.deleteGamePlatformById(id);
} }
/** /**
* *
* *

View File

@ -77,7 +77,9 @@ public class GameServiceImpl implements IGameService
@Override @Override
public int insertGame(Game game) public int insertGame(Game game)
{ {
if (game.getId() == null){
game.setId(IdUtil.getSnowflakeNextId()); game.setId(IdUtil.getSnowflakeNextId());
}
game.setCreateTime(DateUtils.getNowDate()); game.setCreateTime(DateUtils.getNowDate());
return gameMapper.insertGame(game); return gameMapper.insertGame(game);
} }