swagger 推广后台 优化对战百佳历史接口
This commit is contained in:
-7
@@ -1,7 +1,5 @@
|
||||
package com.ruoyi.playingmethod.contract.api.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -18,25 +16,20 @@ import jakarta.validation.constraints.Min;
|
||||
* - boxId 为空:查询全部箱子的记录
|
||||
* - boxId 不为空:仅查询当前选中箱子的记录
|
||||
*/
|
||||
@ApiModel("经典开箱记录查询参数")
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@Builder
|
||||
public class ClassicBoxRecordPageRequest {
|
||||
|
||||
@ApiModelProperty("页码,默认 1")
|
||||
@Min(value = 1, message = "页码最小 1")
|
||||
private Integer page = 1;
|
||||
|
||||
@ApiModelProperty("每页条数,默认 20")
|
||||
@Range(min = 1, max = 50, message = "每页条数 1-50")
|
||||
private Integer size = 20;
|
||||
|
||||
@ApiModelProperty("选中箱子 ID:为空则查询全部箱子的记录,不为空则仅查询该箱子")
|
||||
private Integer boxId;
|
||||
|
||||
@ApiModelProperty("排序方式:0-时间降序,1-时间升序,2-价格降序,默认 0")
|
||||
@Builder.Default
|
||||
private Integer orderByFie = 0;
|
||||
}
|
||||
|
||||
-3
@@ -1,6 +1,5 @@
|
||||
package com.ruoyi.playingmethod.contract.api.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -15,11 +14,9 @@ public class GetRollListParamRequest {
|
||||
private Integer rollId;
|
||||
|
||||
// 0官方 1主播
|
||||
@ApiModelProperty("0官方 1主播")
|
||||
private Integer rollType;
|
||||
|
||||
// 0全部 1可参与 2我的 3已结束
|
||||
@ApiModelProperty("0全部 1可参与 2我的 3已结束")
|
||||
private Integer rollStatus;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
+6
-28
@@ -33,10 +33,6 @@ import com.ruoyi.playingmethod.contract.api.request.ClassicBoxRecordPageRequest;
|
||||
import com.ruoyi.playingmethod.service.ApiBindBoxService;
|
||||
import com.ruoyi.playingmethod.service.ApiBoxRecordsService;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -46,7 +42,6 @@ import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Api(tags = "玩转盲盒模式")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/bindbox")
|
||||
@@ -79,7 +74,6 @@ public class ApiBindBoxController extends BaseController {
|
||||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
@ApiOperation("获取宝箱信息")
|
||||
@Anonymous
|
||||
@PostMapping("/boxData")
|
||||
public R<TtBoxA> getBoxData(@RequestBody BoxIdRequest request) {
|
||||
@@ -95,17 +89,12 @@ public class ApiBindBoxController extends BaseController {
|
||||
return R.ok(boxData);
|
||||
}
|
||||
|
||||
@ApiOperation("获取补偿箱信息")
|
||||
@PostMapping("/getCompBoxData")
|
||||
// [停用-前端零调用] @PostMapping("/getCompBoxData")
|
||||
public AjaxResult getCompBoxData(@RequestBody BoxIdRequest request) {
|
||||
List<TtOrnamentsA> compBoxData = bindBoxService.getCompBoxData(request.getBoxId());
|
||||
return success(compBoxData);
|
||||
}
|
||||
|
||||
@ApiOperation("获取宝箱列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "boxType", value = "宝箱类型(1普通箱 2对战箱 3补偿箱 4九宫格)", dataType = "String", dataTypeClass = String.class)
|
||||
})
|
||||
@Anonymous
|
||||
@PostMapping("/getBoxList")
|
||||
public R<List<TtBoxVO>> getBoxList(@RequestBody(required=false) GetBoxListRequest request) {
|
||||
@@ -123,7 +112,6 @@ public class ApiBindBoxController extends BaseController {
|
||||
/**
|
||||
* 盲盒开箱模式开箱
|
||||
*/
|
||||
@ApiOperation("盲盒开箱")
|
||||
@UpdateUserCache
|
||||
@RateLimiter(time = 60, count = 30, limitType = LimitType.IP)
|
||||
@PostMapping("/openBox")
|
||||
@@ -182,8 +170,7 @@ public class ApiBindBoxController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("获取历史开箱信息")
|
||||
@PostMapping("/getBindBoxHistory")
|
||||
// [停用-前端零调用] @PostMapping("/getBindBoxHistory")
|
||||
public R getBindBoxHistory(@RequestBody @Validated queryCondition param) {
|
||||
if (param.getStatus().equals(1) || param.getStatus().equals(10)) {
|
||||
return R.fail("非法的状态参数。");
|
||||
@@ -193,7 +180,6 @@ public class ApiBindBoxController extends BaseController {
|
||||
return R.ok(ttBoxRecordsVOS);
|
||||
}
|
||||
|
||||
@ApiOperation("获取个人历史开箱记录")
|
||||
@PostMapping("/myBoxHistory")
|
||||
public R<List<TtBoxRecordsVO>> myBoxHistory(@RequestBody queryCondition param) {
|
||||
Long userId = getUserId();
|
||||
@@ -217,8 +203,7 @@ public class ApiBindBoxController extends BaseController {
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@ApiOperation("获取当前补偿值")
|
||||
@PostMapping("/getCompValue")
|
||||
// [停用-前端零调用] @PostMapping("/getCompValue")
|
||||
public AjaxResult getCompValue(@RequestBody BoxIdRequest request) {
|
||||
Long userId = getUserId();
|
||||
TtUser ttUser = userService.getById(userId);
|
||||
@@ -230,8 +215,7 @@ public class ApiBindBoxController extends BaseController {
|
||||
return success(bindBoxService.getCompValue(ttUser, ttBox));
|
||||
}
|
||||
|
||||
@ApiOperation("盲盒top")
|
||||
@PostMapping("/top")
|
||||
// [停用-前端零调用] @PostMapping("/top")
|
||||
public R<List<TtBoxRecordsVO>> topBlinkBox() {
|
||||
Long userId = getUserId();
|
||||
if (ObjectUtil.isNull(userId)) {
|
||||
@@ -253,8 +237,7 @@ public class ApiBindBoxController extends BaseController {
|
||||
return R.ok(ttBoxRecordsVOS);
|
||||
}
|
||||
|
||||
@ApiOperation("十佳掉落")
|
||||
@PostMapping("/tenTop")
|
||||
// [停用-前端零调用] @PostMapping("/tenTop")
|
||||
public R<List<TtBoxRecordsVO>> tenTop() {
|
||||
TenTopQuery param = new TenTopQuery();
|
||||
param.setSource(Collections.singletonList(TtboxRecordSource.BLIND_BOX.getCode()));
|
||||
@@ -266,7 +249,6 @@ public class ApiBindBoxController extends BaseController {
|
||||
return R.ok(ttBoxRecordsVOS);
|
||||
}
|
||||
|
||||
@ApiOperation("今日百佳")
|
||||
@PostMapping("/todayTopHundred")
|
||||
public R<List<TtBoxRecordsVO>> todayTopHundred() {
|
||||
List<Integer> status = Arrays.asList(
|
||||
@@ -283,8 +265,7 @@ public class ApiBindBoxController extends BaseController {
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@ApiOperation("历史百佳")
|
||||
@PostMapping("/historyTopHundred")
|
||||
// [停用-前端零调用] @PostMapping("/historyTopHundred")
|
||||
public R<List<TtBoxRecordsVO>> historyTopHundred() {
|
||||
List<Integer> status = Arrays.asList(
|
||||
TtboxRecordStatus.IN_PACKSACK_ON.getCode(),
|
||||
@@ -300,7 +281,6 @@ public class ApiBindBoxController extends BaseController {
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@ApiOperation("实时 - 所有人历史开箱按时间排序")
|
||||
@Anonymous
|
||||
@PostMapping("/realtime")
|
||||
public R<List<TtBoxRecordsVO>> realtime(@RequestBody @Validated BoxRecordPageRequest request) {
|
||||
@@ -324,7 +304,6 @@ public class ApiBindBoxController extends BaseController {
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@ApiOperation("欧皇 - 所有人开箱按最高价格排序")
|
||||
@Anonymous
|
||||
@PostMapping("/luckyKing")
|
||||
public R<List<TtBoxRecordsVO>> luckyKing(@RequestBody @Validated BoxRecordPageRequest request) {
|
||||
@@ -357,7 +336,6 @@ public class ApiBindBoxController extends BaseController {
|
||||
* - 全服全部箱子:不传参数 / 不登录 → 查看所有用户的所有箱子的开箱记录
|
||||
* - 全服当前箱子:不传 userId + 传 boxId / 不登录 → 查看指定箱子的全服记录
|
||||
*/
|
||||
@ApiOperation("经典开箱记录")
|
||||
@Anonymous
|
||||
@PostMapping("/classicRecords")
|
||||
public R<List<TtBoxRecordsVO>> classicRecords(@RequestBody @Validated ClassicBoxRecordPageRequest request) {
|
||||
|
||||
+1
-5
@@ -6,8 +6,6 @@ import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.domain.dto.boxRecords.queryCondition;
|
||||
import com.ruoyi.domain.vo.boxRecords.TtBoxRecordsVO;
|
||||
import com.ruoyi.playingmethod.service.ApiBoxRecordsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -17,7 +15,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "出货记录")
|
||||
@RestController
|
||||
@RequestMapping("/api/boxRecords")
|
||||
public class ApiBoxRecordsController {
|
||||
@@ -25,8 +22,7 @@ public class ApiBoxRecordsController {
|
||||
@Autowired
|
||||
private ApiBoxRecordsService apiBoxRecordsService;
|
||||
|
||||
@ApiOperation("获取历史出货记录")
|
||||
@PostMapping("/historyByCondition")
|
||||
// [停用-前端零调用] @PostMapping("/historyByCondition")
|
||||
public R getBindBoxHistory(@RequestBody @Validated queryCondition param) {
|
||||
if (param.getStatus().contains(1) || param.getStatus().contains(10)) {
|
||||
return R.fail("非法的状态参数。");
|
||||
|
||||
+2
-7
@@ -8,13 +8,10 @@ import com.ruoyi.common.core.page.PageDataInfo;
|
||||
import com.ruoyi.playingmethod.service.ApiCompoundService;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.domain.vo.UserPackSackDataVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "合成")
|
||||
@RestController
|
||||
@RequestMapping("/api/compound")
|
||||
public class ApiCompoundController extends BaseController {
|
||||
@@ -31,8 +28,7 @@ public class ApiCompoundController extends BaseController {
|
||||
this.compoundService = compoundService;
|
||||
}
|
||||
|
||||
@ApiOperation("合成")
|
||||
@PostMapping("/compound")
|
||||
// [停用-前端零调用] @PostMapping("/compound")
|
||||
public R<UserPackSackDataVO> compound(@RequestBody List<Long> packSackIds) {
|
||||
String websiteMaintenance = sysConfigService.selectConfigByKey("websiteMaintenance");
|
||||
if ("1".equals(websiteMaintenance)) {
|
||||
@@ -46,8 +42,7 @@ public class ApiCompoundController extends BaseController {
|
||||
return compoundService.compound(packSackIds, ttUser);
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户合成记录")
|
||||
@PostMapping("/getUserCompoundRecord")
|
||||
// [停用-前端零调用] @PostMapping("/getUserCompoundRecord")
|
||||
public PageDataInfo<UserPackSackDataVO> getUserCompoundRecord() {
|
||||
startPage();
|
||||
List<UserPackSackDataVO> userCompoundRecord = compoundService.getUserCompoundRecord(getUserId().intValue());
|
||||
|
||||
+7
-22
@@ -19,10 +19,6 @@ import com.ruoyi.playingmethod.contract.api.request.BoxIdRequest;
|
||||
import com.ruoyi.playingmethod.contract.api.request.OpenBoxRequest;
|
||||
import com.ruoyi.playingmethod.mapper.ApiBindBoxMapper;
|
||||
import com.ruoyi.playingmethod.service.ApiExponentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -34,7 +30,6 @@ import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
@Api(tags = "指数盲盒")
|
||||
@RestController
|
||||
@RequestMapping("/api/exponent")
|
||||
public class ApiExponentController extends BaseController {
|
||||
@@ -57,10 +52,9 @@ public class ApiExponentController extends BaseController {
|
||||
@Autowired
|
||||
private RedisLock redisLock;
|
||||
|
||||
@ApiOperation("加入指数盲盒")
|
||||
@Anonymous
|
||||
@UpdateUserCache
|
||||
@PostMapping("/join")
|
||||
// [停用-前端零调用] @PostMapping("/join")
|
||||
public R join(@RequestBody @Validated ExponentJoinParam param) {
|
||||
TtUser ttUser = ttUserService.getById(getUserId());
|
||||
if ("0".equals(ttUser.getIsRealCheck())) {
|
||||
@@ -95,53 +89,44 @@ public class ApiExponentController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("获取宝箱列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "boxType", value = "宝箱类型(1普通箱 2对战箱 3补偿箱 4九宫格 5指数盲盒)", dataType = "String", dataTypeClass = String.class)
|
||||
})
|
||||
@Anonymous
|
||||
@PostMapping("/box")
|
||||
// [停用-前端零调用] @PostMapping("/box")
|
||||
public R box(@RequestBody BoxIdRequest request) {
|
||||
TtUser ttUser = ttUserService.getById(getUserId());
|
||||
return apiExponentService.box(ttUser, request.getBoxId());
|
||||
}
|
||||
|
||||
@ApiOperation("最近十期结果")
|
||||
@Anonymous
|
||||
@PostMapping("/recenttenperiod")
|
||||
// [停用-前端零调用] @PostMapping("/recenttenperiod")
|
||||
public R recenttenperiod() {
|
||||
PageUtils.clearPage();
|
||||
return apiExponentService.recenttenperiod();
|
||||
}
|
||||
|
||||
@ApiOperation("结果信息")
|
||||
@Anonymous
|
||||
@PostMapping("/info")
|
||||
// [停用-前端零调用] @PostMapping("/info")
|
||||
public R info() {
|
||||
PageUtils.clearPage();
|
||||
TtUser ttUser = ttUserService.getById(getUserId());
|
||||
return apiExponentService.info(ttUser);
|
||||
}
|
||||
|
||||
@ApiOperation("指数记录")
|
||||
@Anonymous
|
||||
@PostMapping("/records")
|
||||
// [停用-前端零调用] @PostMapping("/records")
|
||||
public R records() {
|
||||
startPage();
|
||||
TtUser ttUser = ttUserService.getById(getUserId());
|
||||
return apiExponentService.records(ttUser);
|
||||
}
|
||||
|
||||
@ApiOperation("我的箱子")
|
||||
@Anonymous
|
||||
@PostMapping("/mybox")
|
||||
// [停用-前端零调用] @PostMapping("/mybox")
|
||||
public R mybox() {
|
||||
TtUser ttUser = ttUserService.getById(getUserId());
|
||||
return apiExponentService.mybox(ttUser);
|
||||
}
|
||||
@ApiOperation("盲盒开箱")
|
||||
@UpdateUserCache
|
||||
@PostMapping("/openBox")
|
||||
// [停用-前端零调用] @PostMapping("/openBox")
|
||||
public R openBox(@RequestBody OpenBoxRequest request) {
|
||||
TtUser ttUser = ttUserService.getById(getUserId());
|
||||
if ("0".equals(ttUser.getIsRealCheck())) {
|
||||
|
||||
+8
-39
@@ -34,16 +34,15 @@ import com.ruoyi.domain.other.TtBoxVO;
|
||||
import com.ruoyi.domain.vo.ApiFightListDataVO;
|
||||
import com.ruoyi.domain.vo.FightResultDataVO;
|
||||
import com.ruoyi.domain.vo.fight.FightBoxVO;
|
||||
import com.ruoyi.domain.vo.fight.FightResultVO;
|
||||
import com.ruoyi.domain.vo.upgrade.SimpleOrnamentVO;
|
||||
import com.ruoyi.playingmethod.model.vo.ApiFightCardVo;
|
||||
import com.ruoyi.playingmethod.model.vo.ApiFightRankingVO;
|
||||
import com.ruoyi.playingmethod.model.vo.ApiFightResultVo;
|
||||
import com.ruoyi.playingmethod.service.ApiBindBoxService;
|
||||
import com.ruoyi.playingmethod.service.ApiFightService;
|
||||
import com.ruoyi.playingmethod.contract.api.request.BoxIdRequest;
|
||||
import com.ruoyi.domain.other.TtBoxA;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
@@ -58,13 +57,11 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Api(tags = "对战模式")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/fight")
|
||||
public class ApiFightController extends BaseController {
|
||||
|
||||
private final TtFightResultService fightResultService;
|
||||
private final ISysConfigService sysConfigService;
|
||||
private final TtUserService userService;
|
||||
private final ApiFightService apiFightService;
|
||||
@@ -85,12 +82,10 @@ public class ApiFightController extends BaseController {
|
||||
@Autowired
|
||||
private TtUserMapper ttUserMapper;
|
||||
|
||||
public ApiFightController(TtFightResultService fightResultService,
|
||||
ISysConfigService sysConfigService,
|
||||
public ApiFightController(ISysConfigService sysConfigService,
|
||||
TtUserService userService,
|
||||
ApiFightService apiFightService,
|
||||
RedisCache redisCache) {
|
||||
this.fightResultService = fightResultService;
|
||||
this.sysConfigService = sysConfigService;
|
||||
this.userService = userService;
|
||||
this.apiFightService = apiFightService;
|
||||
@@ -117,7 +112,6 @@ public class ApiFightController extends BaseController {
|
||||
/**
|
||||
* Step1 创建对战房间
|
||||
*/
|
||||
@ApiOperation("创建对战房间")
|
||||
@UpdateUserCache
|
||||
@PostMapping("/createFight")
|
||||
public R createFight(@Validated @RequestBody CreateFightBody createFightParam) {
|
||||
@@ -157,7 +151,6 @@ public class ApiFightController extends BaseController {
|
||||
/**
|
||||
* 复刻对战房间:复制目标房间的宝箱配置、人数、组队模式等,创建一个新房间,当前用户成为房主
|
||||
*/
|
||||
@ApiOperation("复刻对战房间")
|
||||
@UpdateUserCache
|
||||
@PostMapping("/copyFight")
|
||||
public R copyFight(@RequestBody FightDetailParam param) {
|
||||
@@ -196,7 +189,6 @@ public class ApiFightController extends BaseController {
|
||||
/**
|
||||
* Step2 加入房间(占座),先行HTTP
|
||||
*/
|
||||
@ApiOperation("加入对战房间")
|
||||
@PostMapping("/joinFightRoom")
|
||||
public R joinFightRoom(@RequestBody FightDetailParam param) {
|
||||
Integer fightId = param.getFightId();
|
||||
@@ -234,8 +226,7 @@ public class ApiFightController extends BaseController {
|
||||
/**
|
||||
* 退出房间
|
||||
*/
|
||||
@ApiOperation("退出房间")
|
||||
@PostMapping("/fightRoomExit")
|
||||
// [停用-前端零调用] @PostMapping("/fightRoomExit")
|
||||
public R fightRoomExit(@RequestBody FightDetailParam param) {
|
||||
Integer fightId = param.getFightId();
|
||||
String websiteMaintenance = sysConfigService.selectConfigByKey("websiteMaintenance");
|
||||
@@ -255,7 +246,6 @@ public class ApiFightController extends BaseController {
|
||||
/**
|
||||
* Step3 玩家准备游戏
|
||||
*/
|
||||
@ApiOperation("玩家准备游戏")
|
||||
@UpdateUserCache
|
||||
@PostMapping("/seatrReady")
|
||||
public R seatrReady(@RequestBody FightDetailParam param) {
|
||||
@@ -281,7 +271,6 @@ public class ApiFightController extends BaseController {
|
||||
/**
|
||||
* Step4 开始游戏(前端满人自动开始)
|
||||
*/
|
||||
@ApiOperation("开始游戏")
|
||||
@PostMapping("/fightBegin")
|
||||
public R fightBegin(@RequestBody FightDetailParam param) {
|
||||
String websiteMaintenance = sysConfigService.selectConfigByKey("websiteMaintenance");
|
||||
@@ -305,7 +294,6 @@ public class ApiFightController extends BaseController {
|
||||
/**
|
||||
* 游戏结束标记
|
||||
*/
|
||||
@ApiOperation("游戏结束标记")
|
||||
@PostMapping("/fightEnd")
|
||||
public R fightEnd(@RequestBody FightDetailParam param) {
|
||||
Integer fightId = param.getFightId();
|
||||
@@ -323,7 +311,6 @@ public class ApiFightController extends BaseController {
|
||||
/**
|
||||
* 抽奖机测试
|
||||
*/
|
||||
// @ApiOperation("抽奖机测试")
|
||||
// @GetMapping("LotteryMachineTest")
|
||||
public R LotteryMachineTest() {
|
||||
R checkLogin = checkLogin();
|
||||
@@ -337,7 +324,6 @@ public class ApiFightController extends BaseController {
|
||||
return R.ok(ornamentId);
|
||||
}
|
||||
|
||||
@ApiOperation("我参与的历史对战记录")
|
||||
@PostMapping("/fightOnMyOwn")
|
||||
public R fightOnMyOwn(@RequestBody FightOnMyOwnParam param) {
|
||||
Long userId = getUserId();
|
||||
@@ -345,7 +331,7 @@ public class ApiFightController extends BaseController {
|
||||
|
||||
param.setPlayerId(userId.intValue());
|
||||
|
||||
List<ApiFightListDataVO> list = apiFightService.getFightList(param);
|
||||
List<ApiFightCardVo> list = apiFightService.getFightList(param);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@@ -353,7 +339,6 @@ public class ApiFightController extends BaseController {
|
||||
* 快速加入对战房间 - 在本阵营(model 0=欧皇 1=非酋)内返回等待中且有空座位、
|
||||
* 总价不超过用户余额的最高价房间 id(不落座,需登录)
|
||||
*/
|
||||
@ApiOperation("快速加入对战房间")
|
||||
@UpdateUserCache
|
||||
@PostMapping("/quickJoinFightRoom")
|
||||
public R<Long> quickJoinFightRoom(@RequestBody QuickJoinFightParam param) {
|
||||
@@ -365,26 +350,22 @@ public class ApiFightController extends BaseController {
|
||||
return apiFightService.quickJoinFightRoom(userId, param != null ? param.getModel() : null);
|
||||
}
|
||||
|
||||
@ApiOperation("全服历史对战记录")
|
||||
@PostMapping("/fightOnAll")
|
||||
public R fightOnAll(@RequestBody FightOnMyOwnParam param) {
|
||||
List<ApiFightListDataVO> list = apiFightService.getFightList(param);
|
||||
List<ApiFightCardVo> list = apiFightService.getFightList(param);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@ApiOperation("历史对战详情")
|
||||
@PostMapping("/fightDetail")
|
||||
public R fightDetail(@RequestBody FightDetailParam param) {
|
||||
return apiFightService.fightDetail(param);
|
||||
}
|
||||
|
||||
@ApiOperation("获取指定记录更早的历史对战")
|
||||
@PostMapping("/earlierHistory")
|
||||
public R earlierHistory(@RequestBody FightDetailParam param) {
|
||||
return apiFightService.earlierHistory(param);
|
||||
}
|
||||
|
||||
@ApiOperation("获取对战宝箱详情")
|
||||
@PostMapping("/simpleBoxDetail")
|
||||
public PageDataInfo<SimpleOrnamentVO> simpleBoxDetail(@RequestBody Map<String, Integer> param) {
|
||||
startPage();
|
||||
@@ -393,7 +374,6 @@ public class ApiFightController extends BaseController {
|
||||
return getPageData(list);
|
||||
}
|
||||
|
||||
@ApiOperation("获取对战宝箱")
|
||||
@PostMapping("/getFightBoxList")
|
||||
@Anonymous
|
||||
public R<List<TtBoxVO>> getFightBoxList(@RequestBody(required = false) Map<String, Integer> param) {
|
||||
@@ -403,7 +383,6 @@ public class ApiFightController extends BaseController {
|
||||
return R.ok(boxData);
|
||||
}
|
||||
|
||||
@ApiOperation("获取对战列表")
|
||||
@Anonymous
|
||||
@PostMapping("/getFightList")
|
||||
public PageDataInfo<ApiFightListDataVO> getFightList(@RequestBody(required = false) Map<String, Object> param) {
|
||||
@@ -415,7 +394,6 @@ public class ApiFightController extends BaseController {
|
||||
return getPageData(list);
|
||||
}
|
||||
|
||||
@ApiOperation("获取对战大厅房间列表(HTTP)")
|
||||
@Anonymous
|
||||
@PostMapping("/hall")
|
||||
public R<Map<String, Object>> fightHall(@RequestBody(required = false) Map<String, Object> param) {
|
||||
@@ -509,28 +487,24 @@ public class ApiFightController extends BaseController {
|
||||
return R.ok(result, "所有对战房间");
|
||||
}
|
||||
|
||||
@ApiOperation("获取对战数据")
|
||||
@PostMapping("/getFightData")
|
||||
public R<ApiFightListDataVO> getFightData(@RequestBody FightDetailParam param) {
|
||||
ApiFightListDataVO apiFightListDataVO = apiFightService.getFightList(null, null, null, param.getFightId()).get(0);
|
||||
return R.ok(apiFightListDataVO);
|
||||
}
|
||||
|
||||
// @ApiOperation("获取对战结果")
|
||||
// @GetMapping("/getFightResult/{fightId}")
|
||||
// public R<FightResultDataVO> getFightResult(@PathVariable("fightId") Integer fightId) {
|
||||
// FightResultDataVO fightResultDataVO = fightResultService.getFightResult(fightId);
|
||||
// return R.ok(fightResultDataVO);
|
||||
// }
|
||||
|
||||
@ApiOperation("获取对战结果")
|
||||
@PostMapping("/getFightResult")
|
||||
public R<FightResultVO> getFightResult(@RequestBody FightDetailParam param) {
|
||||
FightResultVO fightResultVO = fightResultService.getFightResult(param.getFightId());
|
||||
public R<ApiFightResultVo> getFightResult(@RequestBody FightDetailParam param) {
|
||||
ApiFightResultVo fightResultVO = apiFightService.getFightResultForClient(param.getFightId());
|
||||
return R.ok(fightResultVO);
|
||||
}
|
||||
|
||||
@ApiOperation("存储对战回合数据")
|
||||
@PostMapping("/saveFightBoutData")
|
||||
public R<Boolean> saveFightBoutData(@RequestBody FightBoutData fightBoutData) {
|
||||
R checkLogin = checkLogin();
|
||||
@@ -540,7 +514,6 @@ public class ApiFightController extends BaseController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("获取对战回合数")
|
||||
@PostMapping("/getFightBoutNum")
|
||||
public R<Integer> getFightBoutNum(@RequestBody FightDetailParam param) {
|
||||
Integer fightId = param.getFightId();
|
||||
@@ -580,7 +553,6 @@ public class ApiFightController extends BaseController {
|
||||
return R.ok(fightResultDataVO);
|
||||
}
|
||||
|
||||
@ApiOperation("获取对战排行榜")
|
||||
@Anonymous
|
||||
@PostMapping("/fightRanking")
|
||||
public AjaxResult getFightRanking() {
|
||||
@@ -605,14 +577,12 @@ public class ApiFightController extends BaseController {
|
||||
return AjaxResult.success(map);
|
||||
}
|
||||
|
||||
@ApiOperation("十佳对战, 1:最大金额,2:最大增长,3:最大倍数")
|
||||
@Anonymous
|
||||
@PostMapping("/tenTopFight")
|
||||
public AjaxResult tenTopFight(@RequestBody BaiJiaFightParam param) {
|
||||
return AjaxResult.success(apiFightService.tenTopFight(param.getMaxType(), param.getModel(), param.getMinPrice(), param.getMaxPrice(), param.getKeyword()));
|
||||
}
|
||||
|
||||
@ApiOperation("邀请机器人加入对战房间")
|
||||
@PostMapping({"/joinFightRoomForRobot"})
|
||||
public R joinFightRoomForRobot(@RequestBody FightDetailParam param) {
|
||||
R checkLogin = checkLogin();
|
||||
@@ -653,7 +623,6 @@ public class ApiFightController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("对战宝箱详情")
|
||||
@Anonymous
|
||||
@PostMapping("/boxData")
|
||||
public R<TtBoxA> getFightBoxData(@RequestBody BoxIdRequest request) {
|
||||
|
||||
+1
-5
@@ -18,8 +18,6 @@ import com.ruoyi.domain.vo.fight.FightBoxVO;
|
||||
import com.ruoyi.domain.vo.fight.FightResultVO;
|
||||
import com.ruoyi.playingmethod.contract.api.request.FightRoomInfoRequest;
|
||||
import com.ruoyi.playingmethod.service.ApiFightService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -39,7 +37,6 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* 对战房间 HTTP 接口(原 WsFightRoom WebSocket 接口的 HTTP 替代)
|
||||
*/
|
||||
@Api(tags = "对战房间HTTP接口")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/fight/room")
|
||||
@@ -60,8 +57,7 @@ public class ApiFightRoomController extends BaseController {
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@ApiOperation("获取对战房间信息/结果")
|
||||
@PostMapping("/info")
|
||||
// [停用-前端零调用] @PostMapping("/info")
|
||||
public R<Object> info(@RequestBody FightRoomInfoRequest request) {
|
||||
Long userId = getUserId();
|
||||
Integer fightId = request.getFightId();
|
||||
|
||||
+3
-13
@@ -21,8 +21,6 @@ import com.ruoyi.playingmethod.service.ApiLuckyUpgradeService;
|
||||
import com.ruoyi.playingmethod.service.ApiUpgradeRecordService;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.user.service.ApiUserPackSackService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -32,7 +30,6 @@ import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "幸运升级模式")
|
||||
@RestController
|
||||
@RequestMapping("/api/luckyUpgrade")
|
||||
public class ApiLuckyUpgradeController extends BaseController {
|
||||
@@ -66,7 +63,6 @@ public class ApiLuckyUpgradeController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("获取可升级的饰品列表")
|
||||
@Anonymous
|
||||
@PostMapping("/getOrnamentsList")
|
||||
public R<List<ApiLuckyOrnamentsDataVO>> getOrnamentsList(@RequestBody ApiLuckyUpgradeBody apiLuckyUpgradeBody){
|
||||
@@ -89,7 +85,6 @@ public class ApiLuckyUpgradeController extends BaseController {
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@ApiOperation("幸运升级")
|
||||
@UpdateUserCache
|
||||
@PostMapping("/upgrade")
|
||||
public R upgrade(@RequestBody @Validated UpgradeBodyA upgradeParam){
|
||||
@@ -109,14 +104,12 @@ public class ApiLuckyUpgradeController extends BaseController {
|
||||
return apiLuckyUpgradeService.upgrade(ttUser, upgradeParam);
|
||||
}
|
||||
|
||||
@ApiOperation("获取幸运升级历史记录")
|
||||
@PostMapping("/getUpgradeRecord")
|
||||
// [停用-前端零调用] @PostMapping("/getUpgradeRecord")
|
||||
public R getUpgradeRecord(@RequestBody @Validated UpgradeCondition param){
|
||||
return upgradeRecordService.historyDetail(param);
|
||||
}
|
||||
|
||||
@ApiOperation("获取幸运升级十佳记录")
|
||||
@PostMapping("/tenTopUpgradeRecord")
|
||||
// [停用-前端零调用] @PostMapping("/tenTopUpgradeRecord")
|
||||
public R tenTopUpgradeRecord(@RequestBody(required = false) TenTopUpgradeRequest request){
|
||||
Boolean isVictory = (request == null) ? null : request.getIsVictory();
|
||||
R result = upgradeRecordService.tenTopDetail(isVictory);
|
||||
@@ -134,8 +127,7 @@ public class ApiLuckyUpgradeController extends BaseController {
|
||||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation("获取个人幸运升级历史记录列表")
|
||||
@PostMapping("/myHistoryRecord")
|
||||
// [停用-前端零调用] @PostMapping("/myHistoryRecord")
|
||||
public R myHistoryRecord(@RequestBody(required = false) @Validated MyUpgradeRecordRequest request){
|
||||
R check = checkLogin();
|
||||
if (!check.getCode().equals(200)) {
|
||||
@@ -148,7 +140,6 @@ public class ApiLuckyUpgradeController extends BaseController {
|
||||
return upgradeRecordService.myHistoryRecord(userId, request);
|
||||
}
|
||||
|
||||
@ApiOperation("获取当前饰品最近100条拉取记录(含用户头像、概率、饰品全名、磨损度、品质图、图片、价格)")
|
||||
@PostMapping("/recentPulls")
|
||||
public R<List<ApiLuckyUpgradeRecentPullVO>> recentPulls(@RequestBody @Validated UpgradeCondition param) {
|
||||
if (param.getUpgradeRecordId() == null) {
|
||||
@@ -158,7 +149,6 @@ public class ApiLuckyUpgradeController extends BaseController {
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@ApiOperation("幸运升级记录分页(scope: 0全服/1我的;itemScope: 0全部饰品/1当前饰品;均需登录)")
|
||||
@PostMapping("/recordPage")
|
||||
public R recordPage(@RequestBody @Validated UpgradeRecordPageRequest req) {
|
||||
// 记录页无论全服/我的均需登录
|
||||
|
||||
-8
@@ -15,8 +15,6 @@ import com.ruoyi.playingmethod.contract.api.request.GetRedPackRequest;
|
||||
import com.ruoyi.playingmethod.service.ApiRedPackService;
|
||||
import com.ruoyi.thirdparty.wechat.domain.PtLoginUser;
|
||||
import com.ruoyi.thirdparty.wechat.service.ApiTokenService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -29,7 +27,6 @@ import java.util.List;
|
||||
@Deprecated
|
||||
@RestController
|
||||
@RequestMapping("/api/redPackData")
|
||||
@Api(tags = "红包")
|
||||
public class ApiRedPackContoller extends BaseController {
|
||||
|
||||
@Autowired
|
||||
@@ -42,7 +39,6 @@ public class ApiRedPackContoller extends BaseController {
|
||||
// @PostMapping("/getRedPackList")
|
||||
@UserPermission
|
||||
@NoRepeatSubmit
|
||||
@ApiOperation(value = "获取红包列表")
|
||||
public TableDataInfo getRedPackList(HttpServletRequest request, @RequestBody GetRedPackListRequest getRedPackListRequest) {
|
||||
PtLoginUser user = tokenService.getLoginUser(request);
|
||||
|
||||
@@ -57,7 +53,6 @@ public class ApiRedPackContoller extends BaseController {
|
||||
// @PostMapping("/getRedPack")
|
||||
@UserPermission
|
||||
@NoRepeatSubmit
|
||||
@ApiOperation(value = "领取红包")
|
||||
public AjaxResult getRedPack(@RequestBody GetRedPackRequest request) {
|
||||
Long userId = getUserId();
|
||||
return redPackService.getRedPack(userId, request.getRedPackId());
|
||||
@@ -67,7 +62,6 @@ public class ApiRedPackContoller extends BaseController {
|
||||
// @PostMapping("/getRedPackByKey")
|
||||
@UserPermission
|
||||
@NoRepeatSubmit
|
||||
@ApiOperation(value = "根据红包口令兑换红包")
|
||||
public AjaxResult getRedPackByKey(@RequestBody GetRedPackByKeyRequest request) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (request.getRedPackKey() == null || "".equals(request.getRedPackKey())) {
|
||||
@@ -80,7 +74,6 @@ public class ApiRedPackContoller extends BaseController {
|
||||
// @PostMapping("/getActivityDataHis")
|
||||
@UserPermission
|
||||
@NoRepeatSubmit
|
||||
@ApiOperation(value = "查询参与的红包活动记录")
|
||||
public TableDataInfo getBoxDataHis(HttpServletRequest request) {
|
||||
PtLoginUser user = tokenService.getLoginUser(request);
|
||||
startPage();
|
||||
@@ -93,7 +86,6 @@ public class ApiRedPackContoller extends BaseController {
|
||||
// @PostMapping("/getRedPackDataDetail")
|
||||
@UserPermission
|
||||
@NoRepeatSubmit
|
||||
@ApiOperation(value = "查询历史记录")
|
||||
public AjaxResult getRedPackDataDetail(HttpServletRequest request, @RequestBody GetRedPackDetailRequest getRedPackDetailRequest) {
|
||||
PtLoginUser user = tokenService.getLoginUser(request);
|
||||
return redPackService.getRedPackDataDetail(user, getRedPackDetailRequest.getRecordId());
|
||||
|
||||
+1
-5
@@ -7,8 +7,6 @@ import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
import com.ruoyi.playingmethod.model.body.SynthesizeRequest;
|
||||
import com.ruoyi.playingmethod.service.IApiReplacementRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -26,15 +24,13 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/replacementRecord")
|
||||
@Api(tags = "汰换记录")
|
||||
public class ApiReplacementRecordController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IApiReplacementRecordService ttReplacementRecordService;
|
||||
|
||||
@PostMapping("/synthesizeItems")
|
||||
// [停用-前端零调用] @PostMapping("/synthesizeItems")
|
||||
@UserPermission
|
||||
@ApiOperation("汰换饰品")
|
||||
public AjaxResult synthesizeItems(@RequestBody SynthesizeRequest synthesizeRequest) {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
return ttReplacementRecordService.synthesizeItems(loginUser, synthesizeRequest.getBoIds());
|
||||
|
||||
+2
-14
@@ -24,9 +24,6 @@ import com.ruoyi.playingmethod.service.ApiRollService;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.domain.vo.RollDetailsDataVO;
|
||||
import com.ruoyi.domain.vo.RollListDataVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -42,7 +39,6 @@ import jakarta.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "ROLL房模式")
|
||||
@RestController
|
||||
@RequestMapping("/api/roll")
|
||||
public class ApiRollController extends BaseController {
|
||||
@@ -69,7 +65,6 @@ public class ApiRollController extends BaseController {
|
||||
private String rollPassword;
|
||||
}
|
||||
|
||||
@ApiOperation("加入 ROLL 房")
|
||||
@RepeatSubmit(message = "操作过于频繁,请稍后重试!")
|
||||
@PostMapping("/joinRoll")
|
||||
public R joinRoll(@RequestBody @Validated JoinRollParam param) {
|
||||
@@ -91,7 +86,6 @@ public class ApiRollController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取ROLL房列表")
|
||||
@Anonymous
|
||||
@PostMapping("/getRollList")
|
||||
public TableDataInfo getRollList(@RequestBody GetRollListParamRequest param) {
|
||||
@@ -119,33 +113,28 @@ public class ApiRollController extends BaseController {
|
||||
return getPageData(list);
|
||||
}
|
||||
|
||||
@ApiOperation("获取ROLL房详情")
|
||||
@PostMapping("/getRollDetails")
|
||||
public R<RollDetailsDataVO> getRollDetails(@RequestBody RollIdRequest request) {
|
||||
Long userId = getUserId();
|
||||
return apiRollService.getRollDetails(request.getRollId(), userId);
|
||||
}
|
||||
|
||||
@ApiOperation("获取ROLL房参与人员详情")
|
||||
@PostMapping("/getRollPlayers")
|
||||
public R<List<RollUserVO>> getRollPlayers(@RequestBody @Validated GetRollPlayersParam param) {
|
||||
return apiRollService.getRollPlayers(param);
|
||||
}
|
||||
|
||||
@ApiOperation("获取ROLL房奖池详情")
|
||||
@PostMapping("/getRollPrizePool")
|
||||
public R<List<RollJackpotOrnamentsVO>> getRollPrizePool(@RequestBody @Validated GetRollPrizePool param) {
|
||||
return apiRollService.getRollPrizePool(param);
|
||||
}
|
||||
|
||||
@ApiOperation("获取ROLL开奖详情")
|
||||
@PostMapping("/getRollOpenPrize")
|
||||
public R<List<TtBoxRecordsVO>> getRollOpenPrize(@RequestBody @Validated GetRollOpenPrizeParam param) {
|
||||
return apiRollService.getRollOpenPrize(param);
|
||||
}
|
||||
|
||||
@ApiOperation("开奖测试,正式环境删除")
|
||||
@PostMapping("/endRoll")
|
||||
// [停用-前端零调用] @PostMapping("/endRoll")
|
||||
public R endRoll(@RequestBody RollIdRequest request){
|
||||
// TODO: 移除或添加管理员权限校验
|
||||
return apiRollService.endROLL(request.getRollId());
|
||||
@@ -176,8 +165,7 @@ public class ApiRollController extends BaseController {
|
||||
return "1";
|
||||
}
|
||||
|
||||
@ApiOperation("roll房间号搜索")
|
||||
@PostMapping("/searchRollId")
|
||||
// [停用-前端零调用] @PostMapping("/searchRollId")
|
||||
public TableDataInfo searchRoll(@RequestBody RollIdRequest request){
|
||||
GetRollListParamRequest param = new GetRollListParamRequest();
|
||||
param.setRollId(request.getRollId());
|
||||
|
||||
-2
@@ -4,7 +4,6 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.playingmethod.entity.TtAttendanceRecord;
|
||||
import com.ruoyi.playingmethod.service.IApiAttendanceRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -12,7 +11,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "签到记录")
|
||||
@RestController
|
||||
@RequestMapping("/api/attendanceRecord")
|
||||
public class ApiTtAttendanceRecordController extends BaseController {
|
||||
|
||||
+1
-6
@@ -5,14 +5,11 @@ import com.ruoyi.admin.service.TtUserAvatarService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.domain.other.TtUserAvatar;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Api(tags = "用户头像")
|
||||
@RestController
|
||||
@RequestMapping("/api/userAvatar")
|
||||
public class ApiUserAvatarController extends BaseController {
|
||||
@@ -23,8 +20,7 @@ public class ApiUserAvatarController extends BaseController {
|
||||
this.userAvatarService = userAvatarService;
|
||||
}
|
||||
|
||||
@ApiOperation("用户头像列表")
|
||||
@PostMapping("/list")
|
||||
// [停用-前端零调用] @PostMapping("/list")
|
||||
public R<List<TtUserAvatar>> list() {
|
||||
LambdaQueryWrapper<TtUserAvatar> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(TtUserAvatar::getStatus, "0")
|
||||
@@ -33,7 +29,6 @@ public class ApiUserAvatarController extends BaseController {
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@ApiOperation("获取头像图片资源路径列表")
|
||||
@PostMapping("/images")
|
||||
public R<List<String>> getAvatarImages() {
|
||||
LambdaQueryWrapper<TtUserAvatar> wrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
+4
-14
@@ -15,16 +15,12 @@ import com.ruoyi.playingmethod.contract.api.request.OpenWelfareBoxRequest;
|
||||
import com.ruoyi.playingmethod.model.ApiWelfare;
|
||||
import com.ruoyi.playingmethod.service.ApiWelfareService;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Api(tags = "福利")
|
||||
@RestController
|
||||
@RequestMapping("/api/welfare")
|
||||
public class ApiWelfareController extends BaseController {
|
||||
@@ -41,10 +37,7 @@ public class ApiWelfareController extends BaseController {
|
||||
@Autowired
|
||||
private TtUserService userService;
|
||||
|
||||
@ApiOperation("获取福利列表")
|
||||
@ApiResponse(code = 200, message = "eligible【是否具备领取条件(0否 1是)】" +
|
||||
"<br>claimStatus【领取状态(0未领取 1已领取)】")
|
||||
@PostMapping("/getWelfareList")
|
||||
// [停用-前端零调用] @PostMapping("/getWelfareList")
|
||||
public TableDataInfo getWelfareList() {
|
||||
startPage();
|
||||
Long userId = getUserId();
|
||||
@@ -52,8 +45,7 @@ public class ApiWelfareController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("领取福利")
|
||||
@PostMapping("/claimWelfare")
|
||||
// [停用-前端零调用] @PostMapping("/claimWelfare")
|
||||
public AjaxResult claimWelfare(@RequestBody ClaimWelfareRequest request) {
|
||||
Long userId = getUserId();
|
||||
// 检查福利是否存在
|
||||
@@ -82,8 +74,7 @@ public class ApiWelfareController extends BaseController {
|
||||
return AjaxResult.success(openBoxVO);
|
||||
}
|
||||
|
||||
@ApiOperation("每日领取福利箱子")
|
||||
@PostMapping("/claimDailyBox")
|
||||
// [停用-前端零调用] @PostMapping("/claimDailyBox")
|
||||
public R<?> claimDailyBox() {
|
||||
Long userId = getUserId();
|
||||
try {
|
||||
@@ -94,8 +85,7 @@ public class ApiWelfareController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("批量开启福利箱子(1-15个)")
|
||||
@PostMapping("/openBoxes")
|
||||
// [停用-前端零调用] @PostMapping("/openBoxes")
|
||||
public R<?> openBoxes(@RequestBody @Validated OpenWelfareBoxRequest request) {
|
||||
Long userId = getUserId();
|
||||
String bindBoxMaintenance = sysConfigService.selectConfigByKey("bindBoxMaintenance");
|
||||
|
||||
+2
-10
@@ -14,16 +14,12 @@ import com.ruoyi.playingmethod.model.ApiWelfare;
|
||||
import com.ruoyi.playingmethod.model.vo.ApiWelfareMonthlyRechargesVO;
|
||||
import com.ruoyi.playingmethod.service.ApiWelfareMonthlyRechargesService;
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Api(tags = "每月充值福利")
|
||||
@RestController
|
||||
@RequestMapping("/api/welfare/monthlyRecharges")
|
||||
public class ApiWelfareMonthlyRechargesController extends BaseController {
|
||||
@@ -40,10 +36,7 @@ public class ApiWelfareMonthlyRechargesController extends BaseController {
|
||||
@Autowired
|
||||
private TtUserService userService;
|
||||
|
||||
@ApiOperation("获取每月充值福利列表")
|
||||
@ApiResponse(code = 200, message = "eligible【是否具备领取条件(0否 1是)】" +
|
||||
"<br>claimStatus【领取状态(0未领取 1已领取)】")
|
||||
@PostMapping("/list")
|
||||
// [停用-前端零调用] @PostMapping("/list")
|
||||
public TableDataInfo getWelfareList() {
|
||||
startPage();
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
@@ -51,8 +44,7 @@ public class ApiWelfareMonthlyRechargesController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("领取福利")
|
||||
@PostMapping("/claimWelfare")
|
||||
// [停用-前端零调用] @PostMapping("/claimWelfare")
|
||||
public AjaxResult claimWelfare(@RequestBody ClaimWelfareRequest request) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
// 检查福利是否存在
|
||||
|
||||
-1
@@ -1,7 +1,6 @@
|
||||
package com.ruoyi.playingmethod.model;
|
||||
|
||||
import com.ruoyi.domain.other.TtBox;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.ruoyi.playingmethod.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 对战卡片数据:天选战场/历史百佳(tenTopFight)与全服历史/我的对局(fightOnAll/fightOnMyOwn)共用。
|
||||
*/
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ApiFightCardVo {
|
||||
|
||||
private ApiFightInfo fight;
|
||||
|
||||
/**
|
||||
* 赢家所得(卡片“结算”金额)
|
||||
*/
|
||||
private BigDecimal winnerTotalPrice;
|
||||
|
||||
/**
|
||||
* 开箱饰品总金额(点卡片进观战/回顾时房间页展示)
|
||||
*/
|
||||
private BigDecimal totalOrnamentsPrice;
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
package com.ruoyi.playingmethod.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 客户端对战信息(卡片与对战结果接口共用),只含客户端读取的字段,null 字段不下发。
|
||||
*/
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ApiFightInfo {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
// 1、欧皇 2、非酋(卡片皮肤)
|
||||
private String model;
|
||||
|
||||
// 0或null=个人对战(1v1、1v1v1) 1=2v2组队;2v2 时座位 code 0/1 为A队、2/3 为B队
|
||||
private Integer teamMode;
|
||||
|
||||
// 2=1v1 3=1v1v1 4=2v2,决定卡片槽位数与房间页滚轮列数
|
||||
private Integer playerNum;
|
||||
|
||||
private Integer roundNumber;
|
||||
|
||||
// 卡片赢家角标用;对战结果接口的赢家ID走外层 winnerIds,这里不下发
|
||||
private List<Integer> winnerIds;
|
||||
|
||||
// 2结束 3超时强制结束
|
||||
private Integer status;
|
||||
|
||||
// 仅对战开始过的房间有值(房间页实时进度用)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Timestamp beginTime;
|
||||
|
||||
private List<Seat> seats;
|
||||
|
||||
private Map<String, Box> boxData;
|
||||
|
||||
/**
|
||||
* 入场金额(宝箱总价)
|
||||
*/
|
||||
private BigDecimal boxPriceTotal;
|
||||
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public static class Seat {
|
||||
|
||||
// 座位号:1v1 为 0/1,1v1v1 为 0/1/2,2v2 按 0/1、2/3 分队;卡片槽位与房间页均以此定位
|
||||
private Integer code;
|
||||
|
||||
// 是否入座只判 playerId(空位占位 seat 的 playerId 为空),与 seat.status 无关
|
||||
private Integer playerId;
|
||||
|
||||
private String avatar;
|
||||
|
||||
private String nickName;
|
||||
|
||||
private Integer vipLevel;
|
||||
|
||||
// 该玩家本场所得(房间页席位金额)
|
||||
private BigDecimal awardTotalPrices;
|
||||
}
|
||||
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public static class Box {
|
||||
|
||||
private Integer boxId;
|
||||
|
||||
private Integer number;
|
||||
|
||||
private String boxImg01;
|
||||
|
||||
private BigDecimal price;
|
||||
|
||||
private String boxName;
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package com.ruoyi.playingmethod.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 开箱记录(回合掉落 / 赢家所得 / 安慰奖共用),只含客户端展示读取的字段:
|
||||
* 饰品图、名称、磨损、品质、价格、持有者与所属回合。
|
||||
*/
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ApiFightRecordVo {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
private Integer boxId;
|
||||
|
||||
// 价格兜底按 ornamentId 从宝箱饰品池反查
|
||||
private Long ornamentId;
|
||||
|
||||
private String ornamentName;
|
||||
|
||||
private BigDecimal ornamentsPrice;
|
||||
|
||||
private String imageUrl;
|
||||
|
||||
private Integer ornamentsLevelId;
|
||||
|
||||
private String ornamentLevelImg;
|
||||
|
||||
private String exteriorName;
|
||||
|
||||
// 该饰品归谁(结算/席位金额按持有者归属)
|
||||
private Integer holderUserId;
|
||||
|
||||
// 所属回合(0或负=赛后安慰奖/平分奖)
|
||||
private Integer fightRoundNumber;
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.ruoyi.playingmethod.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 对战结果(观战/回顾/结算):客户端用 fight 拿对战基础信息、三个记录列表渲染逐轮掉落与结算,
|
||||
* 另有 totalOrnamentsPrice 与宝箱清单。currentRound/loserTotalPrice/winnerTotalPrice 客户端不读,不下发。
|
||||
*/
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ApiFightResultVo {
|
||||
|
||||
private ApiFightInfo fight;
|
||||
|
||||
private List<Integer> winnerIds;
|
||||
|
||||
// 各回合开箱记录(fightRoundNumber > 0)
|
||||
private List<ApiFightRecordVo> fightResult;
|
||||
|
||||
// 赢家所得(含平分奖)
|
||||
private List<ApiFightRecordVo> winnerPrize;
|
||||
|
||||
// 失败方安慰奖(fightRoundNumber <= 0 且持有人非赢家)
|
||||
private List<ApiFightRecordVo> endGamePrize;
|
||||
|
||||
/**
|
||||
* 开箱饰品总金额
|
||||
*/
|
||||
private BigDecimal totalOrnamentsPrice;
|
||||
|
||||
// 宝箱清单:客户端读 boxId/number/boxImg01/price/boxName
|
||||
private List<ApiFightInfo.Box> fightBoxVOList;
|
||||
}
|
||||
+9
-3
@@ -10,9 +10,10 @@ import com.ruoyi.domain.entity.fight.TtFight;
|
||||
import com.ruoyi.domain.entity.sys.TtUser;
|
||||
import com.ruoyi.domain.vo.ApiFightListDataVO;
|
||||
import com.ruoyi.domain.vo.FightResultDataVO;
|
||||
import com.ruoyi.domain.vo.fight.FightResultVO;
|
||||
import com.ruoyi.domain.vo.fight.TtFightVO;
|
||||
import com.ruoyi.playingmethod.model.vo.ApiFightCardVo;
|
||||
import com.ruoyi.playingmethod.model.vo.ApiFightRankingVO;
|
||||
import com.ruoyi.playingmethod.model.vo.ApiFightResultVo;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -46,7 +47,7 @@ public interface ApiFightService extends IService<TtFight> {
|
||||
|
||||
R fightRoomExit(Integer fightId, TtUser player);
|
||||
|
||||
List<ApiFightListDataVO> getFightList(FightOnMyOwnParam param);
|
||||
List<ApiFightCardVo> getFightList(FightOnMyOwnParam param);
|
||||
|
||||
R fightDetail(FightDetailParam param);
|
||||
|
||||
@@ -56,7 +57,12 @@ public interface ApiFightService extends IService<TtFight> {
|
||||
|
||||
List<ApiFightRankingVO> getFightRankingByDate(String date);
|
||||
|
||||
Map<String, List<FightResultVO>> tenTopFight(Integer maxType, String model, Integer minPrice, Integer maxPrice, String keyword);
|
||||
Map<String, List<ApiFightCardVo>> tenTopFight(Integer maxType, String model, Integer minPrice, Integer maxPrice, String keyword);
|
||||
|
||||
/**
|
||||
* 对战结果(观战/回顾/结算):只下发客户端读取的字段,完整明细见 TtFightResultService#getFightResult
|
||||
*/
|
||||
ApiFightResultVo getFightResultForClient(Integer fightId);
|
||||
|
||||
/**
|
||||
* 批量填充房主昵称(供 controller 中直接操作 TtFight 列表的场景使用)
|
||||
|
||||
+166
-67
@@ -69,7 +69,11 @@ import com.ruoyi.framework.websocket.connector.WsResult;
|
||||
import com.ruoyi.playingmethod.mapper.ApiBindBoxMapper;
|
||||
import com.ruoyi.playingmethod.mapper.ApiFightMapper;
|
||||
import com.ruoyi.playingmethod.mapper.ApiTtUserBlendErcashMapper;
|
||||
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.ApiFightRecordVo;
|
||||
import com.ruoyi.playingmethod.model.vo.ApiFightResultVo;
|
||||
import com.ruoyi.playingmethod.model.vo.ApiFightTenTopVo;
|
||||
import com.ruoyi.playingmethod.service.ApiBindBoxService;
|
||||
import com.ruoyi.playingmethod.service.ApiFightService;
|
||||
@@ -1410,7 +1414,7 @@ public class ApiFightServiceImpl extends ServiceImpl<TtFightMapper, TtFight> imp
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ApiFightListDataVO> getFightList(FightOnMyOwnParam param) {
|
||||
public List<ApiFightCardVo> getFightList(FightOnMyOwnParam param) {
|
||||
|
||||
LambdaQueryWrapper<TtFight> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper
|
||||
@@ -1507,85 +1511,59 @@ public class ApiFightServiceImpl extends ServiceImpl<TtFightMapper, TtFight> imp
|
||||
}
|
||||
}
|
||||
|
||||
var result = page.stream().map(fight -> {
|
||||
ApiFightListDataVO build = ApiFightListDataVO.builder().build();
|
||||
BeanUtil.copyProperties(fight, build);
|
||||
build.setBoxData(JSONUtil.toJsonStr(fight.getBoxData()));
|
||||
build.setSeats(fight.getSeats());
|
||||
build.setRoundNumber(fight.getRoundNumber());
|
||||
// 设置 winnerIdList 以便 getWinnerIds() getter 正确返回
|
||||
if (fight.getWinnerIds() != null && !fight.getWinnerIds().isEmpty()) {
|
||||
build.setWinnerIdList(JSONUtil.toJsonStr(fight.getWinnerIds()));
|
||||
}
|
||||
return build;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
List<Integer> fightIds = result.stream().filter(Objects::nonNull).map(ApiFightListDataVO::getId).collect(Collectors.toList());
|
||||
List<ApiFightTenTopVo> voList = apiFightMapper.fightOrnamentsPrice(fightIds);
|
||||
Map<Integer, BigDecimal> fightIdToPrice = voList.stream()
|
||||
List<Integer> fightIds = page.stream().filter(Objects::nonNull).map(TtFight::getId).collect(Collectors.toList());
|
||||
Map<Integer, BigDecimal> fightIdToPrice = apiFightMapper.fightOrnamentsPrice(fightIds).stream()
|
||||
.filter(Objects::nonNull) // 过滤掉空值
|
||||
.collect(Collectors.toMap(
|
||||
ApiFightTenTopVo::getId,
|
||||
ApiFightTenTopVo::getTotalOrnamentsPrice
|
||||
));
|
||||
for (ApiFightListDataVO vo : result) {
|
||||
vo.setTotalOrnamentsPrice(fightIdToPrice.getOrDefault(vo.getId(), BigDecimal.ZERO));
|
||||
}
|
||||
|
||||
// 批量填充每个玩家开出的饰品总和(seats[].awardTotalPrices)
|
||||
List<ApiFightTenTopVo> holderPriceList = apiFightMapper.holderOrnamentsPrice(fightIds);
|
||||
// 构建 fightId:holderUserId -> totalOrnamentsPrice 映射
|
||||
// 构建 fightId:holderUserId -> 该玩家开出的饰品总额(seats[].awardTotalPrices)
|
||||
Map<String, BigDecimal> holderPriceMap = new HashMap<>();
|
||||
for (ApiFightTenTopVo hp : holderPriceList) {
|
||||
for (ApiFightTenTopVo hp : apiFightMapper.holderOrnamentsPrice(fightIds)) {
|
||||
if (hp != null && hp.getId() != null && hp.getUserId() != null) {
|
||||
holderPriceMap.put(hp.getId() + ":" + hp.getUserId(), hp.getTotalOrnamentsPrice());
|
||||
}
|
||||
}
|
||||
for (ApiFightListDataVO vo : result) {
|
||||
if (vo.getSeats() == null) continue;
|
||||
List<Integer> winIds = vo.getWinnerIds() != null ? vo.getWinnerIds() : Collections.emptyList();
|
||||
BigDecimal winTotal = BigDecimal.ZERO;
|
||||
BigDecimal loseTotal = BigDecimal.ZERO;
|
||||
for (FightSeat seat : vo.getSeats()) {
|
||||
if (seat.getPlayerId() != null) {
|
||||
BigDecimal playerPrice = holderPriceMap.getOrDefault(vo.getId() + ":" + seat.getPlayerId(), BigDecimal.ZERO);
|
||||
seat.setAwardTotalPrices(playerPrice);
|
||||
if (winIds.contains(seat.getPlayerId())) {
|
||||
winTotal = winTotal.add(playerPrice);
|
||||
} else {
|
||||
loseTotal = loseTotal.add(playerPrice);
|
||||
}
|
||||
}
|
||||
}
|
||||
vo.setWinnerTotalPrice(winTotal);
|
||||
vo.setLoserTotalPrice(loseTotal);
|
||||
}
|
||||
|
||||
enrichOwnerNickNamesForVO(result);
|
||||
|
||||
// 批量填充 seats 中的 vipLevel
|
||||
List<Integer> allPlayerIds = result.stream()
|
||||
.filter(v -> v.getSeats() != null)
|
||||
.flatMap(v -> v.getSeats().stream())
|
||||
List<Integer> allPlayerIds = page.stream()
|
||||
.filter(f -> f.getSeats() != null)
|
||||
.flatMap(f -> f.getSeats().stream())
|
||||
.map(FightSeat::getPlayerId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
Map<Integer, Integer> vipMap = new HashMap<>();
|
||||
if (!allPlayerIds.isEmpty()) {
|
||||
List<TtUser> users = new LambdaQueryChainWrapper<>(ttUserMapper)
|
||||
.in(TtUser::getUserId, allPlayerIds)
|
||||
.select(TtUser::getUserId, TtUser::getVipLevel)
|
||||
.list();
|
||||
Map<Integer, Integer> vipMap = users.stream().filter(Objects::nonNull)
|
||||
vipMap = users.stream().filter(Objects::nonNull)
|
||||
.collect(Collectors.toMap(TtUser::getUserId, u -> u.getVipLevel() != null && u.getVipLevel() > 0 ? u.getVipLevel() - 1 : 0, (a, b) -> a));
|
||||
for (ApiFightListDataVO vo : result) {
|
||||
if (vo.getSeats() == null) continue;
|
||||
for (FightSeat seat : vo.getSeats()) {
|
||||
if (seat.getPlayerId() != null) {
|
||||
}
|
||||
|
||||
List<ApiFightCardVo> result = new ArrayList<>(page.size());
|
||||
for (TtFight fight : page) {
|
||||
if (fight == null) continue;
|
||||
List<Integer> winnerIds = fight.getWinnerIds() != null ? fight.getWinnerIds() : Collections.emptyList();
|
||||
BigDecimal winnerTotalPrice = BigDecimal.ZERO;
|
||||
if (fight.getSeats() != null) {
|
||||
for (FightSeat seat : fight.getSeats()) {
|
||||
if (seat.getPlayerId() == null) continue;
|
||||
BigDecimal playerPrice = holderPriceMap.getOrDefault(fight.getId() + ":" + seat.getPlayerId(), BigDecimal.ZERO);
|
||||
seat.setAwardTotalPrices(playerPrice);
|
||||
if (!vipMap.isEmpty()) {
|
||||
seat.setVipLevel(vipMap.getOrDefault(seat.getPlayerId(), 0));
|
||||
}
|
||||
if (winnerIds.contains(seat.getPlayerId())) {
|
||||
winnerTotalPrice = winnerTotalPrice.add(playerPrice);
|
||||
}
|
||||
}
|
||||
}
|
||||
result.add(buildCard(fight, winnerIds, fightIdToPrice.getOrDefault(fight.getId(), BigDecimal.ZERO), winnerTotalPrice));
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -2282,7 +2260,7 @@ public class ApiFightServiceImpl extends ServiceImpl<TtFightMapper, TtFight> imp
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<FightResultVO>> tenTopFight(Integer maxType, String model, Integer minPrice, Integer maxPrice, String keyword) {
|
||||
public Map<String, List<ApiFightCardVo>> tenTopFight(Integer maxType, String model, Integer minPrice, Integer maxPrice, String keyword) {
|
||||
if (maxType == null || maxType < 0 || maxType > 3) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
@@ -2316,7 +2294,7 @@ public class ApiFightServiceImpl extends ServiceImpl<TtFightMapper, TtFight> imp
|
||||
// 获取昨天凌晨时间
|
||||
calendar.add(Calendar.DAY_OF_MONTH, -2); // 从今天凌晨减去2天
|
||||
|
||||
List<FightResultVO> todayFightResult = new ArrayList<>();
|
||||
List<ApiFightCardVo> todayFightResult = new ArrayList<>();
|
||||
|
||||
// 超神模式(maxType=0)不传日期,查全历史
|
||||
String startDate = (maxType == 0) ? null : formattedTodayMidnight;
|
||||
@@ -2337,26 +2315,147 @@ public class ApiFightServiceImpl extends ServiceImpl<TtFightMapper, TtFight> imp
|
||||
ApiFightTenTopVo::getTotalOrnamentsPrice, (a, b) -> a));
|
||||
List<FightResultVO> batchResults = ttFightResultService.getFightResultBatch(fightIds);
|
||||
for (FightResultVO vo : batchResults) {
|
||||
if (vo != null && vo.getFight() != null) {
|
||||
vo.setTotalOrnamentsPrice(priceMap.getOrDefault(vo.getFight().getId(), vo.getTotalOrnamentsPrice()));
|
||||
todayFightResult.add(vo);
|
||||
}
|
||||
if (vo == null || vo.getFight() == null) continue;
|
||||
TtFight fight = vo.getFight();
|
||||
// 榜单金额以 SQL 统计值为准,与排序口径一致
|
||||
BigDecimal totalOrnamentsPrice = priceMap.getOrDefault(fight.getId(), vo.getTotalOrnamentsPrice());
|
||||
todayFightResult.add(buildCard(fight, vo.getWinnerIds(), totalOrnamentsPrice, vo.getWinnerTotalPrice()));
|
||||
}
|
||||
}
|
||||
log.info("today for time is {}", System.currentTimeMillis() - beginTime);
|
||||
|
||||
// 填充房主昵称
|
||||
List<TtFight> fightList = todayFightResult.stream()
|
||||
.map(FightResultVO::getFight)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
enrichOwnerNickNames(fightList);
|
||||
|
||||
Map<String, List<FightResultVO>> map = new HashMap<>();
|
||||
Map<String, List<ApiFightCardVo>> map = new HashMap<>();
|
||||
map.put("todayFightResult", todayFightResult);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiFightResultVo getFightResultForClient(Integer fightId) {
|
||||
FightResultVO source = ttFightResultService.getFightResult(fightId);
|
||||
if (source == null || source.getFight() == null) return null;
|
||||
return buildFightResult(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡片只下发客户端读取的字段:fight{id/userId/model/teamMode/playerNum/roundNumber/winnerIds/status/
|
||||
* beginTime/seats/boxData/boxPriceTotal} + winnerTotalPrice(结算)/totalOrnamentsPrice。
|
||||
* createTime/endTime/updateTime/remark/spectatorNum/ownerNickName、座位 fightId/status、
|
||||
* 宝箱 boxImg02/ornaments 与开箱明细客户端均不读,不下发。
|
||||
*
|
||||
* @param winnerIds 赢家ID,百佳传 FightResultVO 的值(DB 为空时已从 Redis 状态快照兜底)
|
||||
*/
|
||||
private ApiFightCardVo buildCard(TtFight fight, List<Integer> winnerIds, BigDecimal totalOrnamentsPrice, BigDecimal winnerTotalPrice) {
|
||||
ApiFightCardVo card = new ApiFightCardVo();
|
||||
card.setFight(buildFightInfo(fight, winnerIds));
|
||||
card.setWinnerTotalPrice(winnerTotalPrice);
|
||||
card.setTotalOrnamentsPrice(totalOrnamentsPrice);
|
||||
return card;
|
||||
}
|
||||
|
||||
private ApiFightInfo buildFightInfo(TtFight fight, List<Integer> winnerIds) {
|
||||
ApiFightInfo info = new ApiFightInfo();
|
||||
info.setId(fight.getId());
|
||||
info.setUserId(fight.getUserId());
|
||||
info.setModel(fight.getModel());
|
||||
info.setTeamMode(fight.getTeamMode());
|
||||
info.setPlayerNum(fight.getPlayerNum());
|
||||
info.setRoundNumber(fight.getRoundNumber());
|
||||
info.setWinnerIds(winnerIds);
|
||||
info.setStatus(fight.getStatus());
|
||||
info.setBeginTime(fight.getBeginTime());
|
||||
info.setBoxPriceTotal(fight.getBoxPriceTotal());
|
||||
info.setSeats(toSeats(fight.getSeats()));
|
||||
info.setBoxData(toBoxMap(fight.getBoxData()));
|
||||
return info;
|
||||
}
|
||||
|
||||
private List<ApiFightInfo.Seat> toSeats(List<FightSeat> seats) {
|
||||
if (CollectionUtils.isEmpty(seats)) return Collections.emptyList();
|
||||
List<ApiFightInfo.Seat> list = new ArrayList<>(seats.size());
|
||||
for (FightSeat seat : seats) {
|
||||
if (seat == null) continue;
|
||||
ApiFightInfo.Seat vo = new ApiFightInfo.Seat();
|
||||
vo.setCode(seat.getCode());
|
||||
vo.setPlayerId(seat.getPlayerId());
|
||||
vo.setAvatar(seat.getAvatar());
|
||||
vo.setNickName(seat.getNickName());
|
||||
vo.setVipLevel(seat.getVipLevel());
|
||||
vo.setAwardTotalPrices(seat.getAwardTotalPrices());
|
||||
list.add(vo);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private Map<String, ApiFightInfo.Box> toBoxMap(Map<String, FightBoxVO> boxData) {
|
||||
if (MapUtils.isEmpty(boxData)) return Collections.emptyMap();
|
||||
// 保持库中顺序,客户端按 boxData 顺序渲染宝箱行
|
||||
Map<String, ApiFightInfo.Box> map = new LinkedHashMap<>(boxData.size());
|
||||
for (Map.Entry<String, FightBoxVO> entry : boxData.entrySet()) {
|
||||
ApiFightInfo.Box vo = toBox(entry.getValue());
|
||||
if (vo != null) map.put(entry.getKey(), vo);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private ApiFightInfo.Box toBox(FightBoxVO source) {
|
||||
FightBoxVO box = resolveFightBoxVO(source);
|
||||
if (box == null) return null;
|
||||
ApiFightInfo.Box vo = new ApiFightInfo.Box();
|
||||
vo.setBoxId(box.getBoxId());
|
||||
vo.setNumber(box.getNumber());
|
||||
vo.setBoxImg01(box.getBoxImg01());
|
||||
vo.setPrice(box.getPrice());
|
||||
vo.setBoxName(box.getBoxName());
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对战结果只下发客户端读取的内容:fight 基础信息 + winnerIds + 三个记录列表 + totalOrnamentsPrice + 宝箱清单。
|
||||
* 记录里的 boxName/boxPrice/periodNo/marketHashName/status/source/fightId/rollId/isShow/时间等客户端不读;
|
||||
* 外层 currentRound/loserTotalPrice/winnerTotalPrice 也不读(结算金额由客户端按 winnerPrize 汇总)。
|
||||
*/
|
||||
private ApiFightResultVo buildFightResult(FightResultVO source) {
|
||||
ApiFightResultVo vo = new ApiFightResultVo();
|
||||
vo.setFight(buildFightInfo(source.getFight(), null));
|
||||
vo.setWinnerIds(source.getWinnerIds());
|
||||
vo.setFightResult(toRecords(source.getFightResult()));
|
||||
vo.setWinnerPrize(toRecords(source.getWinnerPrize()));
|
||||
vo.setEndGamePrize(toRecords(source.getEndGamePrize()));
|
||||
vo.setTotalOrnamentsPrice(source.getTotalOrnamentsPrice());
|
||||
List<ApiFightInfo.Box> boxList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(source.getFightBoxVOList())) {
|
||||
for (FightBoxVO box : source.getFightBoxVOList()) {
|
||||
ApiFightInfo.Box item = toBox(box);
|
||||
if (item != null) boxList.add(item);
|
||||
}
|
||||
}
|
||||
vo.setFightBoxVOList(boxList);
|
||||
return vo;
|
||||
}
|
||||
|
||||
private List<ApiFightRecordVo> toRecords(List<TtBoxRecords> records) {
|
||||
if (CollectionUtils.isEmpty(records)) return Collections.emptyList();
|
||||
List<ApiFightRecordVo> list = new ArrayList<>(records.size());
|
||||
for (TtBoxRecords record : records) {
|
||||
if (record == null) continue;
|
||||
ApiFightRecordVo vo = new ApiFightRecordVo();
|
||||
vo.setId(record.getId());
|
||||
vo.setUserId(record.getUserId());
|
||||
vo.setBoxId(record.getBoxId());
|
||||
vo.setOrnamentId(record.getOrnamentId());
|
||||
vo.setOrnamentName(record.getOrnamentName());
|
||||
vo.setOrnamentsPrice(record.getOrnamentsPrice());
|
||||
vo.setImageUrl(record.getImageUrl());
|
||||
vo.setOrnamentsLevelId(record.getOrnamentsLevelId());
|
||||
vo.setOrnamentLevelImg(record.getOrnamentLevelImg());
|
||||
vo.setExteriorName(record.getExteriorName());
|
||||
vo.setHolderUserId(record.getHolderUserId());
|
||||
vo.setFightRoundNumber(record.getFightRoundNumber());
|
||||
list.add(vo);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void enrichBoxPrices(List<TtFight> fights) {
|
||||
List<Integer> boxIds = new ArrayList<>();
|
||||
for (TtFight fight : fights) {
|
||||
|
||||
Reference in New Issue
Block a user