47 lines
1.1 KiB
Java
47 lines
1.1 KiB
Java
package com.bwie.auth.controller;
|
|
|
|
import com.bwie.auth.service.AuthService;
|
|
import com.bwie.common.domain.User;
|
|
import com.bwie.common.domain.response.JwtResponse;
|
|
import com.bwie.common.result.Result;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
@RestController
|
|
@RequestMapping("/auth")
|
|
public class AuthController {
|
|
|
|
@Autowired
|
|
private AuthService authService;
|
|
|
|
/**
|
|
* 发送验证码
|
|
* @param userPhone
|
|
* @return
|
|
*/
|
|
@PostMapping("/getCode/{userPhone}")
|
|
public Result<String> getCode(@PathVariable String userPhone){
|
|
authService.getCode(userPhone);
|
|
return Result.success(null,"验证码发送成功");
|
|
}
|
|
|
|
/**
|
|
* 登录
|
|
* @param user
|
|
* @return
|
|
*/
|
|
@PostMapping("/login")
|
|
public Result<JwtResponse> login(@RequestBody User user){
|
|
return Result.success(authService.login(user),"登陆成功");
|
|
}
|
|
|
|
/**
|
|
* 登录人信息
|
|
* @return
|
|
*/
|
|
@GetMapping("/getInfo")
|
|
public Result<User> getInfo(){
|
|
return Result.success(authService.getInfo(),"查询成功");
|
|
}
|
|
}
|