注册接口
This commit is contained in:
parent
519c6e1fb4
commit
8c162a7feb
|
@ -1,6 +1,7 @@
|
||||||
package com.example.catchTheLetters.controller;
|
package com.example.catchTheLetters.controller;
|
||||||
|
|
||||||
import com.example.catchTheLetters.entity.LoginDto;
|
import com.example.catchTheLetters.entity.LoginDto;
|
||||||
|
import com.example.catchTheLetters.entity.RegisterDto;
|
||||||
import com.example.catchTheLetters.entity.User;
|
import com.example.catchTheLetters.entity.User;
|
||||||
import com.example.catchTheLetters.service.AuthService;
|
import com.example.catchTheLetters.service.AuthService;
|
||||||
import com.example.catchTheLetters.utils.R;
|
import com.example.catchTheLetters.utils.R;
|
||||||
|
@ -43,4 +44,10 @@ public class AuthController {
|
||||||
public R<User> verify(String token) {
|
public R<User> verify(String token) {
|
||||||
return R.ok(authService.verify(token));
|
return R.ok(authService.verify(token));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "用户注册")
|
||||||
|
@PostMapping("/register")
|
||||||
|
public R<String> register(@RequestBody RegisterDto registerDto) {
|
||||||
|
return R.ok(authService.register(registerDto));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package com.example.catchTheLetters.service;
|
package com.example.catchTheLetters.service;
|
||||||
|
|
||||||
import com.example.catchTheLetters.entity.LoginDto;
|
import com.example.catchTheLetters.entity.LoginDto;
|
||||||
|
import com.example.catchTheLetters.entity.RegisterDto;
|
||||||
import com.example.catchTheLetters.entity.User;
|
import com.example.catchTheLetters.entity.User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,4 +29,11 @@ public interface AuthService {
|
||||||
* @return 用户信息(不可以包含密码)
|
* @return 用户信息(不可以包含密码)
|
||||||
*/
|
*/
|
||||||
User verify(String token);
|
User verify(String token);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册
|
||||||
|
* @param registerDto 注册信息
|
||||||
|
* @return token
|
||||||
|
*/
|
||||||
|
String register(RegisterDto registerDto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.example.catchTheLetters.service.impl;
|
package com.example.catchTheLetters.service.impl;
|
||||||
|
|
||||||
import com.example.catchTheLetters.entity.LoginDto;
|
import com.example.catchTheLetters.entity.LoginDto;
|
||||||
|
import com.example.catchTheLetters.entity.RegisterDto;
|
||||||
import com.example.catchTheLetters.entity.User;
|
import com.example.catchTheLetters.entity.User;
|
||||||
import com.example.catchTheLetters.service.AuthService;
|
import com.example.catchTheLetters.service.AuthService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
@ -28,4 +29,9 @@ public class AuthServiceImpl implements AuthService {
|
||||||
public User verify(String token) {
|
public User verify(String token) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String register(RegisterDto registerDto) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue