Ai-interviewer-system/src/main/java/com/yzdx/AiInterviewer/controller/UserController.java

36 lines
1.1 KiB
Java
Raw Normal View History

2023-10-18 09:01:50 +00:00
package com.yzdx.AiInterviewer.controller;
import com.yzdx.AiInterviewer.comment.R;
import com.yzdx.AiInterviewer.service.UserService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("/admin")
public class UserController {
@Autowired
private UserService userService;
@PostMapping("/login")
public R adminLogin(@RequestBody @ApiParam("传入的值phone,encoding,password") Map<String,Object> loginForm){
if(loginForm.size()==0){
return R.error("传来的数据有误,请检查输入");
}
String phone=(String)loginForm.get("phone");
String encoding=(String)loginForm.get("encoding");
String password=(String)loginForm.get("password");
return userService.adminLogin(phone, encoding, password);
}
}