package com.zy.acs.hex.controller;
|
|
import com.zy.acs.framework.common.R;
|
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
/**
|
* 登录控制器
|
*/
|
@RestController
|
@RequestMapping(value = "/login")
|
public class LoginController {
|
|
@Value("${login.username}")
|
private String username;
|
|
@Value("${login.password}")
|
private String password;
|
|
/**
|
* 登录接口
|
*
|
* @param user 用户名
|
* @param pass 密码
|
* @return 登录结果
|
*/
|
@PostMapping(value = "/auth")
|
public R login(@RequestParam String user, @RequestParam String pass) {
|
if (username.equals(user) && password.equals(pass)) {
|
return R.ok("登录成功");
|
} else {
|
return R.error("用户名或密码错误");
|
}
|
}
|
}
|