注册接口

This commit is contained in:
石皮幼鸟 2024-04-09 21:49:20 +08:00
parent 519c6e1fb4
commit 8c162a7feb
4 changed files with 44 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package com.example.catchTheLetters.controller;
import com.example.catchTheLetters.entity.LoginDto;
import com.example.catchTheLetters.entity.RegisterDto;
import com.example.catchTheLetters.entity.User;
import com.example.catchTheLetters.service.AuthService;
import com.example.catchTheLetters.utils.R;
@ -43,4 +44,10 @@ public class AuthController {
public R<User> verify(String token) {
return R.ok(authService.verify(token));
}
@ApiOperation(value = "用户注册")
@PostMapping("/register")
public R<String> register(@RequestBody RegisterDto registerDto) {
return R.ok(authService.register(registerDto));
}
}

View File

@ -0,0 +1,23 @@
package com.example.catchTheLetters.entity;
import lombok.Data;
import java.io.Serializable;
/**
* 注册信息类
* @author spyn
*/
@Data
public class RegisterDto implements Serializable {
private String username;
private String password;
public RegisterDto() {
}
public RegisterDto(String username, String password) {
this.username = username;
this.password = password;
}
}

View File

@ -1,6 +1,7 @@
package com.example.catchTheLetters.service;
import com.example.catchTheLetters.entity.LoginDto;
import com.example.catchTheLetters.entity.RegisterDto;
import com.example.catchTheLetters.entity.User;
/**
@ -28,4 +29,11 @@ public interface AuthService {
* @return 用户信息不可以包含密码
*/
User verify(String token);
/**
* 注册
* @param registerDto 注册信息
* @return token
*/
String register(RegisterDto registerDto);
}

View File

@ -1,6 +1,7 @@
package com.example.catchTheLetters.service.impl;
import com.example.catchTheLetters.entity.LoginDto;
import com.example.catchTheLetters.entity.RegisterDto;
import com.example.catchTheLetters.entity.User;
import com.example.catchTheLetters.service.AuthService;
import jakarta.annotation.Resource;
@ -28,4 +29,9 @@ public class AuthServiceImpl implements AuthService {
public User verify(String token) {
return null;
}
@Override
public String register(RegisterDto registerDto) {
return null;
}
}