目前接口全部设置完成,待实现

This commit is contained in:
石皮幼鸟 2024-04-10 01:06:54 +08:00
parent 8c162a7feb
commit c21397e8a4
4 changed files with 127 additions and 5 deletions

View File

@ -7,12 +7,10 @@ import com.example.catchTheLetters.service.AuthService;
import com.example.catchTheLetters.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* 认证控制器
@ -39,7 +37,7 @@ public class AuthController {
return authService.logout(token) ? R.ok() : R.fail();
}
@ApiOperation(value = "验证token")
@ApiOperation(value = "验证token(不会返回密码)")
@PostMapping("/verify")
public R<User> verify(String token) {
return R.ok(authService.verify(token));
@ -50,4 +48,17 @@ public class AuthController {
public R<String> register(@RequestBody RegisterDto registerDto) {
return R.ok(authService.register(registerDto));
}
@ApiOperation(value = "用户信息查询不会返回密码查不出status为0的用户")
@GetMapping("/info")
@ApiParam(name = "id", value = "用户ID不传就是拿token查自己")
public R<User> info(@RequestParam(required = false) Long id) {
return null;
}
@ApiOperation(value = "用户信息修改")
@PostMapping("/update")
public R update(@RequestBody User user) {
return null;
}
}

View File

@ -0,0 +1,65 @@
package com.example.catchTheLetters.controller;
import com.example.catchTheLetters.entity.Level;
import com.example.catchTheLetters.entity.RankVo;
import com.example.catchTheLetters.entity.ScoreInfo;
import com.example.catchTheLetters.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
/**
* 关卡控制器
* @author spyn
*/
@RestController
@Slf4j
@Api(tags = "关卡API")
@RequestMapping("/level")
public class LevelController {
@ApiOperation(value = "关卡列表只返回ID、名称和类型")
@GetMapping("/list")
public R<Level> list() {
return null;
}
@ApiOperation(value = "关卡详情")
@GetMapping("/detail")
@ApiParam(name = "id", value = "关卡ID")
public R<Level> detail(Long id) {
return null;
}
@ApiOperation(value = "关卡创建web前端管理员提交")
@PostMapping("/create")
public R create(@RequestBody Level level) {
return null;
}
@ApiOperation(value = "关卡修改web前端管理员提交")
@PostMapping("/update")
public R update(@RequestBody Level level) {
return null;
}
@ApiOperation(value = "关卡删除web前端管理员提交")
@PostMapping("/delete")
public R delete(Long id) {
return null;
}
@ApiOperation(value = "获取某个关卡排行榜数据")
@GetMapping("/rank")
@ApiParam(name = "id", value = "关卡ID")
public R<RankVo> rank(Long id) {
return null;
}
@ApiOperation(value = "关卡结算游戏结束时提交一定要鉴别token")
@PostMapping("/settle")
public R settle(@RequestBody ScoreInfo scoreInfo) {
return null;
}
}

View File

@ -0,0 +1,25 @@
package com.example.catchTheLetters.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 排行榜类
*
* @author spyn
*/
@Data
public class RankVo implements Serializable {
private List<ScoreInfo> scoreInfos;
private ScoreInfo myScore;
public RankVo() {
}
public RankVo(List<ScoreInfo> scoreInfos, ScoreInfo myScore) {
this.scoreInfos = scoreInfos;
this.myScore = myScore;
}
}

View File

@ -0,0 +1,21 @@
package com.example.catchTheLetters.entity;
import lombok.Data;
import java.io.Serializable;
/**
* 数据表版本类用于Realm对MongoDB的数据表版本进行同步检测版本号不同则进行同步
* @author spyn
*/
@Data
public class Version implements Serializable {
/**
* 数据表名称即类名
*/
private String table;
/**
* 数据表版本号
*/
private Long version;
}