41 lines
951 B
Java
41 lines
951 B
Java
package com.jdc.jdcproject.controller;
|
|
|
|
import com.jdc.jdcproject.entity.Users;
|
|
import com.jdc.jdcproject.service.IUsersService;
|
|
import com.jdc.jdcproject.utils.Result;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
/**
|
|
* <p>
|
|
* 前端控制器
|
|
* </p>
|
|
*
|
|
* @author haoyanlu
|
|
* @since 2025-04-26
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/users")
|
|
public class UsersController {
|
|
@Autowired
|
|
private IUsersService usersService;
|
|
|
|
@GetMapping("captcha")
|
|
public String captcha() {
|
|
return "captcha";
|
|
}
|
|
|
|
@PostMapping("/login")
|
|
public Result login(@RequestBody Users user) {
|
|
String token = usersService.login(user);
|
|
return Result.successResult().data("token",token);
|
|
}
|
|
|
|
@GetMapping("/me")
|
|
public Result me() {
|
|
return Result.successResult().data("data","1234567");
|
|
}
|
|
|
|
}
|