fix
This commit is contained in:
@@ -4,10 +4,14 @@ import com.tailbet.model.dto.BetDTO;
|
||||
import com.tailbet.model.dto.GameOperateDTO;
|
||||
import com.tailbet.model.dto.HistoryQueryDTO;
|
||||
import com.tailbet.model.dto.SetDigitDTO;
|
||||
import com.tailbet.model.entity.BetOrder;
|
||||
import com.tailbet.model.entity.GameRound;
|
||||
import com.tailbet.model.vo.DigitTrialVo;
|
||||
import com.tailbet.model.vo.R;
|
||||
import com.tailbet.model.vo.UserContext;
|
||||
import com.tailbet.service.IBetService;
|
||||
import com.tailbet.service.IGameService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -28,7 +32,7 @@ public class GameController {
|
||||
* 开始游戏(群主)
|
||||
*/
|
||||
@PostMapping("/start")
|
||||
public R<?> startGame(@RequestBody GameOperateDTO dto) {
|
||||
public R<GameRound> startGame(@RequestBody GameOperateDTO dto) {
|
||||
try {
|
||||
Long userId = UserContext.getUserId();
|
||||
var round = gameService.startGame(dto.getGroupId(), userId);
|
||||
@@ -42,7 +46,7 @@ public class GameController {
|
||||
* 结束接注(群主)
|
||||
*/
|
||||
@PostMapping("/end")
|
||||
public R<?> endBet(@RequestBody GameOperateDTO dto) {
|
||||
public R<GameRound> endBet(@RequestBody GameOperateDTO dto) {
|
||||
try {
|
||||
Long userId = UserContext.getUserId();
|
||||
var round = gameService.endBet(dto.getGroupId(), userId);
|
||||
@@ -56,11 +60,11 @@ public class GameController {
|
||||
* 停止自动连开
|
||||
*/
|
||||
@PostMapping("/stop")
|
||||
public R<?> stopAutoNext(@RequestBody GameOperateDTO dto) {
|
||||
public R<Void> stopAutoNext(@RequestBody GameOperateDTO dto) {
|
||||
try {
|
||||
Long userId = UserContext.getUserId();
|
||||
gameService.stopAutoNext(dto.getGroupId(), userId);
|
||||
return R.ok("已停止自动连开");
|
||||
return R.ok();
|
||||
} catch (RuntimeException e) {
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
@@ -70,13 +74,13 @@ public class GameController {
|
||||
* 下注
|
||||
*/
|
||||
@PostMapping("/bet")
|
||||
public R<?> bet(@RequestBody BetDTO dto) {
|
||||
public R<BetOrder> bet(@RequestBody BetDTO dto) {
|
||||
try {
|
||||
Long userId = UserContext.getUserId();
|
||||
var bet = betService.placeBet(userId, dto.getGroupId(),
|
||||
dto.getClientMsgId(), dto.getPlayType(), dto.getBetAmount());
|
||||
if (bet == null) {
|
||||
return R.ok("假人下注已记录");
|
||||
return R.ok();
|
||||
}
|
||||
return R.ok(bet);
|
||||
} catch (RuntimeException e) {
|
||||
@@ -88,9 +92,9 @@ public class GameController {
|
||||
* 尾数试算
|
||||
*/
|
||||
@GetMapping("/bet/trial")
|
||||
public R<?> trialDigit(Long groupId, Long roundId) {
|
||||
public R<List<DigitTrialVo>> trialDigit(Long groupId, Long roundId) {
|
||||
try {
|
||||
List<IGameService.DigitTrial> trials = gameService.trialDigit(groupId, roundId);
|
||||
List<DigitTrialVo> trials = gameService.trialDigit(groupId, roundId);
|
||||
return R.ok(trials);
|
||||
} catch (RuntimeException e) {
|
||||
return R.fail(e.getMessage());
|
||||
@@ -101,7 +105,7 @@ public class GameController {
|
||||
* 开奖历史
|
||||
*/
|
||||
@GetMapping("/history")
|
||||
public R<?> history(HistoryQueryDTO query) {
|
||||
public R<Page<com.tailbet.model.entity.DrawRecord>> history(HistoryQueryDTO query) {
|
||||
var page = gameService.getHistory(query.getGroupId(), query.getPageNum(), query.getPageSize());
|
||||
return R.ok(page);
|
||||
}
|
||||
@@ -110,13 +114,13 @@ public class GameController {
|
||||
* 设置尾数(白名单用户)
|
||||
*/
|
||||
@PostMapping("/digit/set")
|
||||
public R<?> setDigit(@RequestBody SetDigitDTO dto) {
|
||||
public R<Void> setDigit(@RequestBody SetDigitDTO dto) {
|
||||
try {
|
||||
Long userId = UserContext.getUserId();
|
||||
gameService.setTargetDigit(dto.getGroupId(), dto.getDigit(), userId);
|
||||
return R.ok("尾数已设置");
|
||||
return R.ok();
|
||||
} catch (RuntimeException e) {
|
||||
return R.fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user