修改邮箱bug

This commit is contained in:
ETHEREAL 2024-06-20 00:23:32 +08:00
parent 9a58ac439e
commit 4149721808
4 changed files with 28 additions and 3 deletions

View File

@ -3,13 +3,16 @@ package com.example.catchTheLetters.controller;
import com.example.catchTheLetters.entity.*; import com.example.catchTheLetters.entity.*;
import com.example.catchTheLetters.model.vo.RankVo; import com.example.catchTheLetters.model.vo.RankVo;
import com.example.catchTheLetters.service.LevelService; import com.example.catchTheLetters.service.LevelService;
import com.example.catchTheLetters.service.RoomService;
import com.example.catchTheLetters.service.VersionService; import com.example.catchTheLetters.service.VersionService;
import com.example.catchTheLetters.service.impl.RoomServiceImpl;
import com.example.catchTheLetters.utils.R; import com.example.catchTheLetters.utils.R;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -31,6 +34,9 @@ public class LevelController {
@Resource @Resource
private VersionService versionService; private VersionService versionService;
@Resource
private RoomService roomService;
@ApiOperation(value = "关卡列表只返回ID、排序、名称和类型") @ApiOperation(value = "关卡列表只返回ID、排序、名称和类型")
@GetMapping("/list") @GetMapping("/list")
public R<List<Level>> list() { public R<List<Level>> list() {
@ -111,4 +117,10 @@ public class LevelController {
public R<List<VersionDownload>> getNewVersion(){ public R<List<VersionDownload>> getNewVersion(){
return versionService.getNewDownloads(); return versionService.getNewDownloads();
} }
@ApiOperation(value = "获取所有房间")
@GetMapping("/all-room")
public R<List<GameRoom>> getAllRoom(){
return R.ok(roomService.getAllRoom());
}
} }

View File

@ -1,8 +1,11 @@
package com.example.catchTheLetters.service; package com.example.catchTheLetters.service;
import com.example.catchTheLetters.entity.GameRoom;
import com.example.catchTheLetters.entity.PlayerInput; import com.example.catchTheLetters.entity.PlayerInput;
import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.WebSocketSession;
import java.util.List;
/** /**
* 房间服务 * 房间服务
* *
@ -103,4 +106,6 @@ public interface RoomService {
* @param letterId 字母ID * @param letterId 字母ID
*/ */
void getLetter(long roomId, WebSocketSession session, long letterId); void getLetter(long roomId, WebSocketSession session, long letterId);
List<GameRoom> getAllRoom();
} }

View File

@ -285,6 +285,11 @@ public class RoomServiceImpl implements RoomService {
} }
} }
@Override
public List<GameRoom> getAllRoom() {
return new ArrayList<>(rooms.values());
}
private void generateLetter(GameRoom room) { private void generateLetter(GameRoom room) {
var players = room.getPlayers(); var players = room.getPlayers();
var words = room.getWords(); var words = room.getWords();

View File

@ -5,7 +5,9 @@ import com.example.catchTheLetters.entity.Level;
import com.example.catchTheLetters.entity.ScoreInfo; import com.example.catchTheLetters.entity.ScoreInfo;
import com.example.catchTheLetters.entity.VersionDownload; import com.example.catchTheLetters.entity.VersionDownload;
import com.example.catchTheLetters.entity.Word; import com.example.catchTheLetters.entity.Word;
import com.example.catchTheLetters.service.RoomService;
import com.example.catchTheLetters.service.VersionService; import com.example.catchTheLetters.service.VersionService;
import com.example.catchTheLetters.service.impl.RoomServiceImpl;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -35,6 +37,9 @@ class TestInsertLevel {
@Resource @Resource
private VersionService versionService; private VersionService versionService;
@Resource
private RoomService roomService;
private final List<String> words = new ArrayList<>() { private final List<String> words = new ArrayList<>() {
{ {
add("apple"); add("apple");
@ -124,8 +129,6 @@ class TestInsertLevel {
@Test @Test
@Disabled @Disabled
void minIOTest(){ void minIOTest(){
Aggregation aggregation = Aggregation.newAggregation(Aggregation.sample(5)); System.out.println(roomService.getAllRoom());
AggregationResults<Word> results = mongoTemplate.aggregate(aggregation,Word.class,Word.class);
System.out.println(results.getMappedResults());
} }
} }