|
@@ -7,9 +7,11 @@ import com.td.boss.config.enums.ResultEnum;
|
|
|
import com.td.boss.game.comcntorder.pojo.ComCntOrder;
|
|
import com.td.boss.game.comcntorder.pojo.ComCntOrder;
|
|
|
import com.td.boss.game.comcntorder.service.ComCntOrderService;
|
|
import com.td.boss.game.comcntorder.service.ComCntOrderService;
|
|
|
import com.td.boss.game.complayers.pojo.ComPlayers;
|
|
import com.td.boss.game.complayers.pojo.ComPlayers;
|
|
|
|
|
+import com.td.boss.game.complayers.vo.ComPlayersSimpleVo;
|
|
|
import com.td.boss.game.complayers.vo.ComPlayersVo;
|
|
import com.td.boss.game.complayers.vo.ComPlayersVo;
|
|
|
import com.td.boss.game.complayers.service.ComPlayersService;
|
|
import com.td.boss.game.complayers.service.ComPlayersService;
|
|
|
import com.td.boss.util.CopyUtil;
|
|
import com.td.boss.util.CopyUtil;
|
|
|
|
|
+import com.td.boss.util.DateUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import net.bytebuddy.asm.Advice;
|
|
import net.bytebuddy.asm.Advice;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -38,28 +40,28 @@ public class ComPlayersController extends CommonController<ComPlayersVo, ComPlay
|
|
|
* @param userId
|
|
* @param userId
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- @PostMapping("createPlayer")
|
|
|
|
|
- public Result<Map> createPlayer(@RequestParam(value = "userId") String userId,
|
|
|
|
|
- @RequestParam(value = "name") String name,
|
|
|
|
|
- @RequestParam(value = "avatar") String avatar) {
|
|
|
|
|
- //todo 疑问avatar获取渠道?
|
|
|
|
|
- ComPlayers player = comPlayersService.findByUserId(userId);
|
|
|
|
|
- if (player == null) {
|
|
|
|
|
- //player 不存在
|
|
|
|
|
- player = new ComPlayers();
|
|
|
|
|
- player.setUserId(userId);
|
|
|
|
|
- player.setAttributeType(0);
|
|
|
|
|
- }
|
|
|
|
|
- player.setAvatar(avatar);
|
|
|
|
|
- player.setName(name);
|
|
|
|
|
- ComPlayers addPlayer = comPlayersService.addComPlayers(player);
|
|
|
|
|
-
|
|
|
|
|
- Map map = new HashMap();
|
|
|
|
|
- map.put("avatar", addPlayer.getAvatar());
|
|
|
|
|
- map.put("name", addPlayer.getName());
|
|
|
|
|
- map.put("attributeType", addPlayer.getAttributeType());
|
|
|
|
|
- return Result.of(map);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //@PostMapping("createPlayer")
|
|
|
|
|
+ //public Result<Map> createPlayer(@RequestParam(value = "userId") String userId,
|
|
|
|
|
+ // @RequestParam(value = "name") String name,
|
|
|
|
|
+ // @RequestParam(value = "avatar") String avatar) {
|
|
|
|
|
+ // //todo 疑问avatar获取渠道?
|
|
|
|
|
+ // ComPlayers player = comPlayersService.findByUserId(userId);
|
|
|
|
|
+ // if (player == null) {
|
|
|
|
|
+ // //player 不存在
|
|
|
|
|
+ // player = new ComPlayers();
|
|
|
|
|
+ // player.setUserId(userId);
|
|
|
|
|
+ // player.setAttributeType(0);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // player.setAvatar(avatar);
|
|
|
|
|
+ // player.setName(name);
|
|
|
|
|
+ // ComPlayers addPlayer = comPlayersService.addComPlayers(player);
|
|
|
|
|
+ //
|
|
|
|
|
+ // Map map = new HashMap();
|
|
|
|
|
+ // map.put("avatar", addPlayer.getAvatar());
|
|
|
|
|
+ // map.put("name", addPlayer.getName());
|
|
|
|
|
+ // map.put("attributeType", addPlayer.getAttributeType());
|
|
|
|
|
+ // return Result.of(map);
|
|
|
|
|
+ //}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取玩家是否租赁过的信息
|
|
* 获取玩家是否租赁过的信息
|
|
@@ -89,20 +91,20 @@ public class ComPlayersController extends CommonController<ComPlayersVo, ComPlay
|
|
|
* @param userId
|
|
* @param userId
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- @GetMapping("getPlayer")
|
|
|
|
|
- public Result<Map> getPlayer(@RequestParam(value = "userId") String userId) {
|
|
|
|
|
- ComPlayers player = comPlayersService.findByUserId(userId);
|
|
|
|
|
- if (player == null) {
|
|
|
|
|
- //player 不存在
|
|
|
|
|
- return Result.of(null, false, ResultEnum.PLAYER_DOES_NOT_EXIST.getMessage(), ResultEnum.PLAYER_DOES_NOT_EXIST.getCode());
|
|
|
|
|
- }
|
|
|
|
|
- Map map = new HashMap();
|
|
|
|
|
- map.put("playerId", player.getId());
|
|
|
|
|
- map.put("avatar", player.getAvatar());
|
|
|
|
|
- map.put("name", player.getName());
|
|
|
|
|
- map.put("attributeType", player.getAttributeType());
|
|
|
|
|
- return Result.of(map);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //@GetMapping("getPlayer")
|
|
|
|
|
+ //public Result<Map> getPlayer(@RequestParam(value = "userId") String userId) {
|
|
|
|
|
+ // ComPlayers player = comPlayersService.findByUserId(userId);
|
|
|
|
|
+ // if (player == null) {
|
|
|
|
|
+ // //player 不存在
|
|
|
|
|
+ // return Result.of(null, false, ResultEnum.PLAYER_DOES_NOT_EXIST.getMessage(), ResultEnum.PLAYER_DOES_NOT_EXIST.getCode());
|
|
|
|
|
+ // }
|
|
|
|
|
+ // Map map = new HashMap();
|
|
|
|
|
+ // map.put("playerId", player.getId());
|
|
|
|
|
+ // map.put("avatar", player.getAvatar());
|
|
|
|
|
+ // map.put("name", player.getName());
|
|
|
|
|
+ // map.put("attributeType", player.getAttributeType());
|
|
|
|
|
+ // return Result.of(map);
|
|
|
|
|
+ //}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取玩家信息并且携带属性
|
|
* 获取玩家信息并且携带属性
|
|
@@ -110,52 +112,52 @@ public class ComPlayersController extends CommonController<ComPlayersVo, ComPlay
|
|
|
* @param userId
|
|
* @param userId
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- @GetMapping("getPlayerAndBattleAttribute")
|
|
|
|
|
- public Result<Map> getPlayerAndBattleAttribute(@RequestParam(value = "userId") String userId,
|
|
|
|
|
- @RequestParam(value = "name") String name,
|
|
|
|
|
- @RequestParam(value = "avatar") String avatar) {
|
|
|
|
|
- ComPlayers player = comPlayersService.findByUserId(userId);
|
|
|
|
|
- if (player == null) {
|
|
|
|
|
- // todo player 如果角色不存在的话,直接创建一个。
|
|
|
|
|
- player = new ComPlayers();
|
|
|
|
|
- player.setUserId(userId);
|
|
|
|
|
- player.setAttributeType(0);
|
|
|
|
|
- player.setAvatar(avatar);
|
|
|
|
|
- player.setName(name);
|
|
|
|
|
- player = comPlayersService.addComPlayers(player);
|
|
|
|
|
- }
|
|
|
|
|
- Map map = new HashMap();
|
|
|
|
|
- map.put("playerId", player.getId());
|
|
|
|
|
- map.put("avatar", player.getAvatar());
|
|
|
|
|
- map.put("name", player.getName());
|
|
|
|
|
- return Result.of(map);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //@GetMapping("getPlayerAndBattleAttribute")
|
|
|
|
|
+ //public Result<Map> getPlayerAndBattleAttribute(@RequestParam(value = "userId") String userId,
|
|
|
|
|
+ // @RequestParam(value = "name") String name,
|
|
|
|
|
+ // @RequestParam(value = "avatar") String avatar) {
|
|
|
|
|
+ // ComPlayers player = comPlayersService.findByUserId(userId);
|
|
|
|
|
+ // if (player == null) {
|
|
|
|
|
+ // // todo player 如果角色不存在的话,直接创建一个。
|
|
|
|
|
+ // player = new ComPlayers();
|
|
|
|
|
+ // player.setUserId(userId);
|
|
|
|
|
+ // player.setAttributeType(0);
|
|
|
|
|
+ // player.setAvatar(avatar);
|
|
|
|
|
+ // player.setName(name);
|
|
|
|
|
+ // player = comPlayersService.addComPlayers(player);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // Map map = new HashMap();
|
|
|
|
|
+ // map.put("playerId", player.getId());
|
|
|
|
|
+ // map.put("avatar", player.getAvatar());
|
|
|
|
|
+ // map.put("name", player.getName());
|
|
|
|
|
+ // return Result.of(map);
|
|
|
|
|
+ //}
|
|
|
|
|
|
|
|
|
|
|
|
|
- @PostMapping("playerPushInfo")
|
|
|
|
|
- public Result<Map> playerPushInfoFun(@RequestParam(value = "userId") String userId,
|
|
|
|
|
- @RequestParam(value = "playerData") String playerData) {
|
|
|
|
|
- ComPlayers player = comPlayersService.findByUserId(userId);
|
|
|
|
|
- if (player == null) {
|
|
|
|
|
- // todo player 如果角色不存在的话,直接创建一个。
|
|
|
|
|
- player = new ComPlayers();
|
|
|
|
|
- player.setUserId(userId);
|
|
|
|
|
- player.setAttributeType(0);
|
|
|
|
|
- player.setName("");
|
|
|
|
|
- player.setData(playerData);
|
|
|
|
|
- player.setIsExchange(0);
|
|
|
|
|
- player.setCreateTime(new Date());
|
|
|
|
|
- player = comPlayersService.addComPlayers(player);
|
|
|
|
|
- } else {
|
|
|
|
|
- player.setData(playerData);
|
|
|
|
|
- player = comPlayersService.addComPlayers(player);
|
|
|
|
|
- }
|
|
|
|
|
- player.setUpdateTime(new Date());
|
|
|
|
|
- //log.info(playerData);
|
|
|
|
|
- Map map = new HashMap();
|
|
|
|
|
- map.put("playerData", player.getData());
|
|
|
|
|
- return Result.of(map);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //@PostMapping("playerPushInfo")
|
|
|
|
|
+ //public Result<Map> playerPushInfoFun(@RequestParam(value = "userId") String userId,
|
|
|
|
|
+ // @RequestParam(value = "playerData") String playerData) {
|
|
|
|
|
+ // ComPlayers player = comPlayersService.findByUserId(userId);
|
|
|
|
|
+ // if (player == null) {
|
|
|
|
|
+ // // todo player 如果角色不存在的话,直接创建一个。
|
|
|
|
|
+ // player = new ComPlayers();
|
|
|
|
|
+ // player.setUserId(userId);
|
|
|
|
|
+ // player.setAttributeType(0);
|
|
|
|
|
+ // player.setName("");
|
|
|
|
|
+ // player.setData(playerData);
|
|
|
|
|
+ // player.setIsExchange(0);
|
|
|
|
|
+ // player.setCreateTime(new Date());
|
|
|
|
|
+ // player = comPlayersService.addComPlayers(player);
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // player.setData(playerData);
|
|
|
|
|
+ // player = comPlayersService.addComPlayers(player);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // player.setUpdateTime(new Date());
|
|
|
|
|
+ // //log.info(playerData);
|
|
|
|
|
+ // Map map = new HashMap();
|
|
|
|
|
+ // map.put("playerData", player.getData());
|
|
|
|
|
+ // return Result.of(map);
|
|
|
|
|
+ //}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 拉取数据
|
|
* 拉取数据
|
|
@@ -164,25 +166,24 @@ public class ComPlayersController extends CommonController<ComPlayersVo, ComPlay
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("playerPullInfo")
|
|
@GetMapping("playerPullInfo")
|
|
|
- public Result<Map> playerPullInfoFun(@RequestParam(value = "userId") String userId) {
|
|
|
|
|
-
|
|
|
|
|
|
|
+ public Result<?> playerPullInfoFun(@RequestParam(value = "userId") String userId) {
|
|
|
|
|
|
|
|
ComPlayers player = comPlayersService.findByUserId(userId);
|
|
ComPlayers player = comPlayersService.findByUserId(userId);
|
|
|
//判断是否为空,初始化一个基础数据
|
|
//判断是否为空,初始化一个基础数据
|
|
|
if (player == null) {
|
|
if (player == null) {
|
|
|
|
|
+ Date _nowDate = DateUtil.getNowDate();
|
|
|
player = new ComPlayers();
|
|
player = new ComPlayers();
|
|
|
player.setUserId(userId);
|
|
player.setUserId(userId);
|
|
|
player.setName("");
|
|
player.setName("");
|
|
|
player.setAvatar("");
|
|
player.setAvatar("");
|
|
|
player.setAttributeType(0);
|
|
player.setAttributeType(0);
|
|
|
-
|
|
|
|
|
- //这里比较关键了。初始化一个前端默认的游戏数据,后续修改需要联合前端游戏修改
|
|
|
|
|
- player.setData(PlayerData());
|
|
|
|
|
|
|
+ player.setDiamond(0d);
|
|
|
|
|
+ player.setIsExchange(0);
|
|
|
|
|
+ player.setCreateTime(_nowDate);
|
|
|
|
|
+ player.setUpdateTime(_nowDate);
|
|
|
|
|
+ comPlayersService.addComPlayers(player);
|
|
|
}
|
|
}
|
|
|
- //log.info(playerData);
|
|
|
|
|
- Map map = new HashMap();
|
|
|
|
|
- map.put("playerData", player.getData());
|
|
|
|
|
- return Result.of(map);
|
|
|
|
|
|
|
+ return Result.of(CopyUtil.copy(player, ComPlayersSimpleVo.class));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|