精简对战接口返回vo
This commit is contained in:
+156
-23
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ruoyi.admin.mapper.TtUserBlendErcashMapper;
|
import com.ruoyi.admin.mapper.TtUserBlendErcashMapper;
|
||||||
import com.ruoyi.admin.mapper.TtUserMapper;
|
import com.ruoyi.admin.mapper.TtUserMapper;
|
||||||
import com.ruoyi.admin.service.*;
|
import com.ruoyi.admin.service.*;
|
||||||
@@ -11,6 +12,7 @@ import com.ruoyi.admin.util.core.fight.LotteryMachine;
|
|||||||
import com.ruoyi.common.annotation.Anonymous;
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
import com.ruoyi.common.annotation.UpdateUserCache;
|
import com.ruoyi.common.annotation.UpdateUserCache;
|
||||||
import com.ruoyi.common.constant.ErrorCode;
|
import com.ruoyi.common.constant.ErrorCode;
|
||||||
|
import com.ruoyi.common.constant.HttpStatus;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
@@ -30,14 +32,20 @@ import com.ruoyi.domain.entity.sys.TtUser;
|
|||||||
import com.ruoyi.domain.other.CreateFightBody;
|
import com.ruoyi.domain.other.CreateFightBody;
|
||||||
import com.ruoyi.domain.other.FightBoutData;
|
import com.ruoyi.domain.other.FightBoutData;
|
||||||
import com.ruoyi.domain.other.TtBox;
|
import com.ruoyi.domain.other.TtBox;
|
||||||
|
import com.ruoyi.domain.other.TtBoxLevelA;
|
||||||
import com.ruoyi.domain.other.TtBoxVO;
|
import com.ruoyi.domain.other.TtBoxVO;
|
||||||
|
import com.ruoyi.domain.other.TtOrnamentsA;
|
||||||
import com.ruoyi.domain.vo.ApiFightListDataVO;
|
import com.ruoyi.domain.vo.ApiFightListDataVO;
|
||||||
import com.ruoyi.domain.vo.FightResultDataVO;
|
import com.ruoyi.domain.vo.FightResultDataVO;
|
||||||
import com.ruoyi.domain.vo.fight.FightBoxVO;
|
import com.ruoyi.domain.vo.fight.FightBoxVO;
|
||||||
import com.ruoyi.domain.vo.upgrade.SimpleOrnamentVO;
|
import com.ruoyi.domain.vo.upgrade.SimpleOrnamentVO;
|
||||||
|
import com.ruoyi.playingmethod.model.vo.ApiFightBoxDetailVo;
|
||||||
|
import com.ruoyi.playingmethod.model.vo.ApiFightBoxTypeVo;
|
||||||
import com.ruoyi.playingmethod.model.vo.ApiFightCardVo;
|
import com.ruoyi.playingmethod.model.vo.ApiFightCardVo;
|
||||||
import com.ruoyi.playingmethod.model.vo.ApiFightRankingVO;
|
import com.ruoyi.playingmethod.model.vo.ApiFightRankingVO;
|
||||||
import com.ruoyi.playingmethod.model.vo.ApiFightResultVo;
|
import com.ruoyi.playingmethod.model.vo.ApiFightResultVo;
|
||||||
|
import com.ruoyi.playingmethod.model.vo.ApiFightRoomVo;
|
||||||
|
import com.ruoyi.playingmethod.model.vo.ApiFightSimpleOrnamentVo;
|
||||||
import com.ruoyi.playingmethod.service.ApiBindBoxService;
|
import com.ruoyi.playingmethod.service.ApiBindBoxService;
|
||||||
import com.ruoyi.playingmethod.service.ApiFightService;
|
import com.ruoyi.playingmethod.service.ApiFightService;
|
||||||
import com.ruoyi.playingmethod.contract.api.request.BoxIdRequest;
|
import com.ruoyi.playingmethod.contract.api.request.BoxIdRequest;
|
||||||
@@ -145,7 +153,7 @@ public class ApiFightController extends BaseController {
|
|||||||
return R.fail(702, "您的账户未进行充过值!");
|
return R.fail(702, "您的账户未进行充过值!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiFightService.createFight(createFightParam, player);
|
return toLeanFightResult(apiFightService.createFight(createFightParam, player));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -183,7 +191,7 @@ public class ApiFightController extends BaseController {
|
|||||||
return R.fail(702, "您的账户未进行充过值!");
|
return R.fail(702, "您的账户未进行充过值!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiFightService.copyFight(param.getFightId(), player);
|
return toLeanFightResult(apiFightService.copyFight(param.getFightId(), player));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -288,7 +296,12 @@ public class ApiFightController extends BaseController {
|
|||||||
|
|
||||||
TtUser player = userService.getById(userId);
|
TtUser player = userService.getById(userId);
|
||||||
|
|
||||||
return apiFightService.fightBegin(param.getFightId(), player);
|
R result = apiFightService.fightBegin(param.getFightId(), player);
|
||||||
|
// 客户端只读 code,成功时不下发整个对局实体
|
||||||
|
if (Integer.valueOf(R.SUCCESS).equals(result.getCode())) {
|
||||||
|
result.setData(null);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -305,7 +318,12 @@ public class ApiFightController extends BaseController {
|
|||||||
R checkLogin = checkLogin();
|
R checkLogin = checkLogin();
|
||||||
if (!checkLogin.getCode().equals(200)) return checkLogin;
|
if (!checkLogin.getCode().equals(200)) return checkLogin;
|
||||||
|
|
||||||
return apiFightService.fightEnd(fightId, getUserId());
|
R result = apiFightService.fightEnd(fightId, getUserId());
|
||||||
|
// 客户端只读 code/msg,成功时不下发整个对局实体
|
||||||
|
if (Integer.valueOf(R.SUCCESS).equals(result.getCode())) {
|
||||||
|
result.setData(null);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -356,35 +374,51 @@ public class ApiFightController extends BaseController {
|
|||||||
return R.ok(list);
|
return R.ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/fightDetail")
|
// [停用-前端零调用] @PostMapping("/fightDetail")
|
||||||
public R fightDetail(@RequestBody FightDetailParam param) {
|
public R fightDetail(@RequestBody FightDetailParam param) {
|
||||||
return apiFightService.fightDetail(param);
|
return apiFightService.fightDetail(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/earlierHistory")
|
// [停用-前端零调用] @PostMapping("/earlierHistory")
|
||||||
public R earlierHistory(@RequestBody FightDetailParam param) {
|
public R earlierHistory(@RequestBody FightDetailParam param) {
|
||||||
return apiFightService.earlierHistory(param);
|
return apiFightService.earlierHistory(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/simpleBoxDetail")
|
@PostMapping("/simpleBoxDetail")
|
||||||
public PageDataInfo<SimpleOrnamentVO> simpleBoxDetail(@RequestBody Map<String, Integer> param) {
|
public PageDataInfo<ApiFightSimpleOrnamentVo> simpleBoxDetail(@RequestBody Map<String, Integer> param) {
|
||||||
startPage();
|
startPage();
|
||||||
Integer boxId = param.get("boxId");
|
Integer boxId = param.get("boxId");
|
||||||
List<SimpleOrnamentVO> list = boxOrnamentsService.simpleBoxDetail(boxId);
|
List<SimpleOrnamentVO> list = boxOrnamentsService.simpleBoxDetail(boxId);
|
||||||
return getPageData(list);
|
long total = new PageInfo<>(list).getTotal();
|
||||||
|
List<ApiFightSimpleOrnamentVo> rows = new ArrayList<>(list.size());
|
||||||
|
for (SimpleOrnamentVO item : list) {
|
||||||
|
if (item == null) continue;
|
||||||
|
ApiFightSimpleOrnamentVo vo = new ApiFightSimpleOrnamentVo();
|
||||||
|
vo.setOrnamentId(item.getOrnamentId());
|
||||||
|
vo.setOrnamentName(item.getOrnamentName());
|
||||||
|
vo.setOrnamentPrice(item.getOrnamentPrice());
|
||||||
|
vo.setOrnamentLevelId(item.getOrnamentLevelId());
|
||||||
|
vo.setOrnamentLevelImg(item.getOrnamentLevelImg());
|
||||||
|
rows.add(vo);
|
||||||
|
}
|
||||||
|
PageDataInfo<ApiFightSimpleOrnamentVo> pageData = new PageDataInfo<>();
|
||||||
|
pageData.setCode(HttpStatus.SUCCESS);
|
||||||
|
pageData.setMsg("查询成功");
|
||||||
|
pageData.setRows(rows);
|
||||||
|
pageData.setTotal(total);
|
||||||
|
return pageData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/getFightBoxList")
|
@PostMapping("/getFightBoxList")
|
||||||
@Anonymous
|
@Anonymous
|
||||||
public R<List<TtBoxVO>> getFightBoxList(@RequestBody(required = false) Map<String, Integer> param) {
|
public R<List<ApiFightBoxTypeVo>> getFightBoxList(@RequestBody(required = false) Map<String, Integer> param) {
|
||||||
Integer boxTypeId = (param != null) ? param.get("boxTypeId") : null;
|
Integer boxTypeId = (param != null) ? param.get("boxTypeId") : null;
|
||||||
List<TtBoxVO> boxData = apiFightService.getFightBoxList(boxTypeId);
|
List<TtBoxVO> boxData = apiFightService.getFightBoxList(boxTypeId);
|
||||||
if (ObjectUtil.isEmpty(boxData) || boxData.isEmpty()) return R.ok(null, "没有匹配的数据。");
|
if (ObjectUtil.isEmpty(boxData) || boxData.isEmpty()) return R.ok(null, "没有匹配的数据。");
|
||||||
return R.ok(boxData);
|
return R.ok(toBoxTypeList(boxData));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Anonymous
|
// [停用-前端零调用] @Anonymous @PostMapping("/getFightList")
|
||||||
@PostMapping("/getFightList")
|
|
||||||
public PageDataInfo<ApiFightListDataVO> getFightList(@RequestBody(required = false) Map<String, Object> param) {
|
public PageDataInfo<ApiFightListDataVO> getFightList(@RequestBody(required = false) Map<String, Object> param) {
|
||||||
startPage();
|
startPage();
|
||||||
String model = param != null ? (String) param.get("model") : null;
|
String model = param != null ? (String) param.get("model") : null;
|
||||||
@@ -394,8 +428,7 @@ public class ApiFightController extends BaseController {
|
|||||||
return getPageData(list);
|
return getPageData(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Anonymous
|
// [停用-前端零调用] @Anonymous @PostMapping("/hall")
|
||||||
@PostMapping("/hall")
|
|
||||||
public R<Map<String, Object>> fightHall(@RequestBody(required = false) Map<String, Object> param) {
|
public R<Map<String, Object>> fightHall(@RequestBody(required = false) Map<String, Object> param) {
|
||||||
Integer pageNum = param != null && param.get("pageNum") != null ? Integer.valueOf(param.get("pageNum").toString()) : 1;
|
Integer pageNum = param != null && param.get("pageNum") != null ? Integer.valueOf(param.get("pageNum").toString()) : 1;
|
||||||
Integer pageSize = param != null && param.get("pageSize") != null ? Integer.valueOf(param.get("pageSize").toString()) : 10;
|
Integer pageSize = param != null && param.get("pageSize") != null ? Integer.valueOf(param.get("pageSize").toString()) : 10;
|
||||||
@@ -488,9 +521,9 @@ public class ApiFightController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/getFightData")
|
@PostMapping("/getFightData")
|
||||||
public R<ApiFightListDataVO> getFightData(@RequestBody FightDetailParam param) {
|
public R<ApiFightRoomVo> getFightData(@RequestBody FightDetailParam param) {
|
||||||
ApiFightListDataVO apiFightListDataVO = apiFightService.getFightList(null, null, null, param.getFightId()).get(0);
|
ApiFightListDataVO apiFightListDataVO = apiFightService.getFightList(null, null, null, param.getFightId()).get(0);
|
||||||
return R.ok(apiFightListDataVO);
|
return R.ok(toRoomVo(apiFightListDataVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @GetMapping("/getFightResult/{fightId}")
|
// @GetMapping("/getFightResult/{fightId}")
|
||||||
@@ -505,7 +538,7 @@ public class ApiFightController extends BaseController {
|
|||||||
return R.ok(fightResultVO);
|
return R.ok(fightResultVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/saveFightBoutData")
|
// [停用-前端零调用] @PostMapping("/saveFightBoutData")
|
||||||
public R<Boolean> saveFightBoutData(@RequestBody FightBoutData fightBoutData) {
|
public R<Boolean> saveFightBoutData(@RequestBody FightBoutData fightBoutData) {
|
||||||
R checkLogin = checkLogin();
|
R checkLogin = checkLogin();
|
||||||
if (!checkLogin.getCode().equals(200)) return checkLogin;
|
if (!checkLogin.getCode().equals(200)) return checkLogin;
|
||||||
@@ -514,7 +547,7 @@ public class ApiFightController extends BaseController {
|
|||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/getFightBoutNum")
|
// [停用-前端零调用] @PostMapping("/getFightBoutNum")
|
||||||
public R<Integer> getFightBoutNum(@RequestBody FightDetailParam param) {
|
public R<Integer> getFightBoutNum(@RequestBody FightDetailParam param) {
|
||||||
Integer fightId = param.getFightId();
|
Integer fightId = param.getFightId();
|
||||||
String key = "fight_bout_data:fight_" + fightId;
|
String key = "fight_bout_data:fight_" + fightId;
|
||||||
@@ -553,8 +586,7 @@ public class ApiFightController extends BaseController {
|
|||||||
return R.ok(fightResultDataVO);
|
return R.ok(fightResultDataVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Anonymous
|
// [停用-前端零调用] @Anonymous @PostMapping("/fightRanking")
|
||||||
@PostMapping("/fightRanking")
|
|
||||||
public AjaxResult getFightRanking() {
|
public AjaxResult getFightRanking() {
|
||||||
// 创建日期格式化对象,指定日期格式
|
// 创建日期格式化对象,指定日期格式
|
||||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
@@ -583,7 +615,7 @@ public class ApiFightController extends BaseController {
|
|||||||
return AjaxResult.success(apiFightService.tenTopFight(param.getMaxType(), param.getModel(), param.getMinPrice(), param.getMaxPrice(), param.getKeyword()));
|
return AjaxResult.success(apiFightService.tenTopFight(param.getMaxType(), param.getModel(), param.getMinPrice(), param.getMaxPrice(), param.getKeyword()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping({"/joinFightRoomForRobot"})
|
// [停用-前端零调用] @PostMapping({"/joinFightRoomForRobot"})
|
||||||
public R joinFightRoomForRobot(@RequestBody FightDetailParam param) {
|
public R joinFightRoomForRobot(@RequestBody FightDetailParam param) {
|
||||||
R checkLogin = checkLogin();
|
R checkLogin = checkLogin();
|
||||||
if (!checkLogin.getCode().equals(200)) return checkLogin;
|
if (!checkLogin.getCode().equals(200)) return checkLogin;
|
||||||
@@ -625,12 +657,113 @@ public class ApiFightController extends BaseController {
|
|||||||
|
|
||||||
@Anonymous
|
@Anonymous
|
||||||
@PostMapping("/boxData")
|
@PostMapping("/boxData")
|
||||||
public R<TtBoxA> getFightBoxData(@RequestBody BoxIdRequest request) {
|
public R<ApiFightBoxDetailVo> getFightBoxData(@RequestBody BoxIdRequest request) {
|
||||||
String websiteMaintenance = sysConfigService.selectConfigByKey("websiteMaintenance");
|
String websiteMaintenance = sysConfigService.selectConfigByKey("websiteMaintenance");
|
||||||
if ("1".equals(websiteMaintenance)) {
|
if ("1".equals(websiteMaintenance)) {
|
||||||
return R.fail("网站维护中......");
|
return R.fail("网站维护中......");
|
||||||
}
|
}
|
||||||
TtBoxA boxData = bindBoxService.getFightBoxData(request.getBoxId());
|
TtBoxA boxData = bindBoxService.getFightBoxData(request.getBoxId());
|
||||||
return R.ok(boxData);
|
return R.ok(toBoxDetail(boxData));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创房/复刻成功时把完整 TtFight 实体裁剪为客户端读取的精简房间信息,失败原样返回
|
||||||
|
*/
|
||||||
|
private R toLeanFightResult(R result) {
|
||||||
|
if (Integer.valueOf(R.SUCCESS).equals(result.getCode()) && result.getData() instanceof TtFight fight) {
|
||||||
|
return R.ok(apiFightService.toFightInfo(fight), result.getMsg());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间数据只下发客户端读取的字段(宝箱/用户明细按库中 JSON 原样下发)
|
||||||
|
*/
|
||||||
|
private ApiFightRoomVo toRoomVo(ApiFightListDataVO source) {
|
||||||
|
ApiFightRoomVo vo = new ApiFightRoomVo();
|
||||||
|
vo.setId(source.getId());
|
||||||
|
vo.setUserId(source.getUserId());
|
||||||
|
vo.setModel(source.getModel());
|
||||||
|
vo.setTeamMode(source.getTeamMode());
|
||||||
|
vo.setPlayerNum(source.getPlayerNum());
|
||||||
|
vo.setRoundNumber(source.getRoundNumber());
|
||||||
|
vo.setStatus(source.getStatus());
|
||||||
|
vo.setBoxPriceTotal(source.getBoxPriceTotal());
|
||||||
|
vo.setWinnerIds(source.getWinnerIds());
|
||||||
|
vo.setTotalOrnamentsPrice(source.getTotalOrnamentsPrice());
|
||||||
|
vo.setBoxData(source.getBoxData());
|
||||||
|
vo.setUserData(source.getUserData());
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创房宝箱列表只下发分类名与箱子卡片读取的字段
|
||||||
|
*/
|
||||||
|
private List<ApiFightBoxTypeVo> toBoxTypeList(List<TtBoxVO> source) {
|
||||||
|
List<ApiFightBoxTypeVo> list = new ArrayList<>(source.size());
|
||||||
|
for (TtBoxVO type : source) {
|
||||||
|
if (type == null) continue;
|
||||||
|
ApiFightBoxTypeVo vo = new ApiFightBoxTypeVo();
|
||||||
|
vo.setBoxTypeName(type.getBoxTypeName());
|
||||||
|
List<ApiFightBoxTypeVo.Box> boxList = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(type.getBoxList())) {
|
||||||
|
for (TtBoxA box : type.getBoxList()) {
|
||||||
|
if (box == null) continue;
|
||||||
|
ApiFightBoxTypeVo.Box item = new ApiFightBoxTypeVo.Box();
|
||||||
|
item.setBoxId(box.getBoxId());
|
||||||
|
item.setBoxName(box.getBoxName());
|
||||||
|
item.setPrice(box.getPrice());
|
||||||
|
item.setBoxImg01(box.getBoxImg01());
|
||||||
|
boxList.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vo.setBoxList(boxList);
|
||||||
|
list.add(vo);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宝箱详情只下发滚轮饰品池与详情弹窗读取的字段
|
||||||
|
*/
|
||||||
|
private ApiFightBoxDetailVo toBoxDetail(TtBoxA source) {
|
||||||
|
if (source == null) return null;
|
||||||
|
ApiFightBoxDetailVo vo = new ApiFightBoxDetailVo();
|
||||||
|
vo.setBoxName(source.getBoxName());
|
||||||
|
vo.setPrice(source.getPrice());
|
||||||
|
vo.setBoxImg01(source.getBoxImg01());
|
||||||
|
List<ApiFightBoxDetailVo.Level> levels = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(source.getProbabilityDistribution())) {
|
||||||
|
for (TtBoxLevelA level : source.getProbabilityDistribution()) {
|
||||||
|
if (level == null) continue;
|
||||||
|
ApiFightBoxDetailVo.Level item = new ApiFightBoxDetailVo.Level();
|
||||||
|
item.setOrnamentsLevelId(level.getOrnamentsLevelId());
|
||||||
|
item.setProbability(level.getProbability());
|
||||||
|
levels.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!levels.isEmpty()) {
|
||||||
|
vo.setProbabilityDistribution(levels);
|
||||||
|
}
|
||||||
|
List<ApiFightBoxDetailVo.Ornament> ornaments = new ArrayList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(source.getBoxOrnamentsList())) {
|
||||||
|
for (TtOrnamentsA ornament : source.getBoxOrnamentsList()) {
|
||||||
|
if (ornament == null) continue;
|
||||||
|
ApiFightBoxDetailVo.Ornament item = new ApiFightBoxDetailVo.Ornament();
|
||||||
|
item.setOrnamentId(ornament.getOrnamentId());
|
||||||
|
item.setName(ornament.getName());
|
||||||
|
item.setShortName(ornament.getShortName());
|
||||||
|
item.setUsePrice(ornament.getUsePrice());
|
||||||
|
item.setImageUrl(ornament.getImageUrl());
|
||||||
|
item.setExteriorName(ornament.getExteriorName());
|
||||||
|
item.setOrnamentsLevelId(ornament.getOrnamentsLevelId());
|
||||||
|
item.setLevelImg(ornament.getLevelImg());
|
||||||
|
ornaments.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!ornaments.isEmpty()) {
|
||||||
|
vo.setBoxOrnamentsList(ornaments);
|
||||||
|
}
|
||||||
|
return vo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+58
@@ -0,0 +1,58 @@
|
|||||||
|
package com.ruoyi.playingmethod.model.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对战宝箱详情(/api/fight/boxData):只含滚轮饰品池与箱子详情弹窗读取的字段。
|
||||||
|
* 箱级 boxId/boxTypeId/boxImg02/boxType/totalOpenOdds/openProbabilityDistribution、
|
||||||
|
* 饰品的 odds/oddsResult/compOdds/compOddsResult/openOdds/openOddsResult 客户端均不读。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public class ApiFightBoxDetailVo {
|
||||||
|
|
||||||
|
private String boxName;
|
||||||
|
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
private String boxImg01;
|
||||||
|
|
||||||
|
// 各品质展示概率(客户端只读 ornamentsLevelId 与 probability)
|
||||||
|
private List<Level> probabilityDistribution;
|
||||||
|
|
||||||
|
private List<Ornament> boxOrnamentsList;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public static class Level {
|
||||||
|
|
||||||
|
private Integer ornamentsLevelId;
|
||||||
|
|
||||||
|
private String probability;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public static class Ornament {
|
||||||
|
|
||||||
|
private Long ornamentId;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String shortName;
|
||||||
|
|
||||||
|
private BigDecimal usePrice;
|
||||||
|
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
|
private String exteriorName;
|
||||||
|
|
||||||
|
private Integer ornamentsLevelId;
|
||||||
|
|
||||||
|
private String levelImg;
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
package com.ruoyi.playingmethod.model.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对战创房宝箱分类(/api/fight/getFightBoxList):只含分类名与箱子卡片读取的字段
|
||||||
|
* (boxTypeId/icon/sort、箱子的 boxImg02/boxTypeId/boxType/饰品池/概率分布客户端不读)。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public class ApiFightBoxTypeVo {
|
||||||
|
|
||||||
|
private String boxTypeName;
|
||||||
|
|
||||||
|
private List<Box> boxList;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public static class Box {
|
||||||
|
|
||||||
|
private Integer boxId;
|
||||||
|
|
||||||
|
private String boxName;
|
||||||
|
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
private String boxImg01;
|
||||||
|
}
|
||||||
|
}
|
||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
package com.ruoyi.playingmethod.model.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonRawValue;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间数据(/api/fight/getFightData):只含房间页读取的字段,null 不下发。
|
||||||
|
* 客户端不读 createTime/updateTime/winnerIdList/winnerTotalPrice/loserTotalPrice/ownerNickName,
|
||||||
|
* seats 查询 SQL 从未返回(恒空)——均不下发。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public class ApiFightRoomVo {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
// 1、欧皇 2、非酋
|
||||||
|
private String model;
|
||||||
|
|
||||||
|
private Integer teamMode;
|
||||||
|
|
||||||
|
private Integer playerNum;
|
||||||
|
|
||||||
|
private Integer roundNumber;
|
||||||
|
|
||||||
|
// 0准备 1进行中 2结束 3超时强制结束
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private BigDecimal boxPriceTotal;
|
||||||
|
|
||||||
|
private List<Integer> winnerIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开箱饰品总金额
|
||||||
|
*/
|
||||||
|
private BigDecimal totalOrnamentsPrice;
|
||||||
|
|
||||||
|
// 宝箱数据(库中 JSON 原样下发,客户端按对象读取)
|
||||||
|
@JsonRawValue
|
||||||
|
private String boxData;
|
||||||
|
|
||||||
|
// 参与用户数据(库中 JSON 原样下发,客户端按数组读取)
|
||||||
|
@JsonRawValue
|
||||||
|
private String userData;
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
package com.ruoyi.playingmethod.model.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对战宝箱饰品池分页兜底(/api/fight/simpleBoxDetail):只含滚轮渲染读取的字段
|
||||||
|
* (id/ornamentHashName/quantity/ornamentLevel/时间等客户端不读)。
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public class ApiFightSimpleOrnamentVo {
|
||||||
|
|
||||||
|
private Long ornamentId;
|
||||||
|
|
||||||
|
private String ornamentName;
|
||||||
|
|
||||||
|
private BigDecimal ornamentPrice;
|
||||||
|
|
||||||
|
private Integer ornamentLevelId;
|
||||||
|
|
||||||
|
private String ornamentLevelImg;
|
||||||
|
}
|
||||||
+6
@@ -12,6 +12,7 @@ import com.ruoyi.domain.vo.ApiFightListDataVO;
|
|||||||
import com.ruoyi.domain.vo.FightResultDataVO;
|
import com.ruoyi.domain.vo.FightResultDataVO;
|
||||||
import com.ruoyi.domain.vo.fight.TtFightVO;
|
import com.ruoyi.domain.vo.fight.TtFightVO;
|
||||||
import com.ruoyi.playingmethod.model.vo.ApiFightCardVo;
|
import com.ruoyi.playingmethod.model.vo.ApiFightCardVo;
|
||||||
|
import com.ruoyi.playingmethod.model.vo.ApiFightInfo;
|
||||||
import com.ruoyi.playingmethod.model.vo.ApiFightRankingVO;
|
import com.ruoyi.playingmethod.model.vo.ApiFightRankingVO;
|
||||||
import com.ruoyi.playingmethod.model.vo.ApiFightResultVo;
|
import com.ruoyi.playingmethod.model.vo.ApiFightResultVo;
|
||||||
|
|
||||||
@@ -69,6 +70,11 @@ public interface ApiFightService extends IService<TtFight> {
|
|||||||
*/
|
*/
|
||||||
void enrichOwnerNickNames(List<TtFight> fights);
|
void enrichOwnerNickNames(List<TtFight> fights);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把完整对局实体裁剪为客户端读取的精简房间信息(创房/复刻响应使用)
|
||||||
|
*/
|
||||||
|
ApiFightInfo toFightInfo(TtFight fight);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 快速加入对战房间
|
* 快速加入对战房间
|
||||||
* 根据用户金额在本阵营等待中房间内,找到总价小于等于用户余额的最高价房间(不落座)
|
* 根据用户金额在本阵营等待中房间内,找到总价小于等于用户余额的最高价房间(不落座)
|
||||||
|
|||||||
+6
@@ -2352,6 +2352,12 @@ public class ApiFightServiceImpl extends ServiceImpl<TtFightMapper, TtFight> imp
|
|||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiFightInfo toFightInfo(TtFight fight) {
|
||||||
|
if (fight == null) return null;
|
||||||
|
return buildFightInfo(fight, fight.getWinnerIds());
|
||||||
|
}
|
||||||
|
|
||||||
private ApiFightInfo buildFightInfo(TtFight fight, List<Integer> winnerIds) {
|
private ApiFightInfo buildFightInfo(TtFight fight, List<Integer> winnerIds) {
|
||||||
ApiFightInfo info = new ApiFightInfo();
|
ApiFightInfo info = new ApiFightInfo();
|
||||||
info.setId(fight.getId());
|
info.setId(fight.getId());
|
||||||
|
|||||||
Reference in New Issue
Block a user