54 lines
1.2 KiB
Java
54 lines
1.2 KiB
Java
package com.bwie.controller;
|
|
|
|
import com.bwie.common.domain.request.TelLogin;
|
|
import com.bwie.common.domain.request.UserRequest;
|
|
import com.bwie.common.result.Result;
|
|
import com.bwie.service.impl.AuthService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
/**
|
|
* @author gxb
|
|
* @description TODO
|
|
* @date 2023-12-19 15:30
|
|
*/
|
|
@RestController
|
|
public class AuthController {
|
|
@Autowired
|
|
private AuthService authService;
|
|
/**
|
|
* 用户名 + 密码 = 登录
|
|
*/
|
|
@PostMapping("/login")
|
|
public Result login(@RequestBody UserRequest userRequest){
|
|
return authService.login(userRequest);
|
|
}
|
|
|
|
/**
|
|
* 发送验证码
|
|
* @param tel
|
|
* @return
|
|
*/
|
|
@PostMapping("/sendCode/{tel}")
|
|
public Result sendCode(@PathVariable String tel){
|
|
return authService.sendCode(tel);
|
|
}
|
|
|
|
/**
|
|
* 手机号 + 验证码 = 登录
|
|
* @param telLogin
|
|
* @return
|
|
*/
|
|
@PostMapping("/TelLogin")
|
|
public Result TelLogin(@RequestBody TelLogin telLogin){
|
|
return authService.TelLogin(telLogin);
|
|
}
|
|
/**
|
|
* 获取当前登录人
|
|
*/
|
|
@GetMapping("/info")
|
|
public Result info(){
|
|
return authService.info();
|
|
}
|
|
}
|