ADD file via upload

master
moec42frf 2 years ago
parent 10294f4caa
commit fb7d26e26b

@ -0,0 +1,53 @@
package org.sang.controller;
import org.sang.bean.RespBean;
import org.sang.bean.User;
import org.sang.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class LoginRegController {
@Autowired
UserService userService;
@RequestMapping("/login_error")
public RespBean loginError() {
return new RespBean("error", "登录失败!");
}
@RequestMapping("/login_success")
public RespBean loginSuccess() {
return new RespBean("success", "登录成功!");
}
/**
*
* <p>
* JSONHTML
*
* @return
*/
@RequestMapping("/login_page")
public RespBean loginPage() {
return new RespBean("error", "尚未登录,请登录!");
}
@PostMapping("/reg")
public RespBean reg(User user) {
int result = userService.reg(user);
if (result == 0) {
//成功
return new RespBean("success", "注册成功!");
} else if (result == 1) {
return new RespBean("error", "用户名重复,注册失败!");
} else {
//失败
return new RespBean("error", "注册失败!");
}
}
}
Loading…
Cancel
Save