| | |
| | | |
| | | import com.lf.server.controller.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.data.LoginEntity; |
| | | import com.lf.server.entity.data.UsersEntity; |
| | | import com.lf.server.entity.sys.LoginInfo; |
| | | import com.lf.server.entity.sys.Result; |
| | | import com.lf.server.entity.sys.User; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.service.data.LoginService; |
| | | import com.lf.server.service.data.UsersService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * 签名控制器 |
| | |
| | | public class SignController extends BaseController { |
| | | @Autowired |
| | | UsersService userService; |
| | | |
| | | @Autowired |
| | | LoginService loginService; |
| | | |
| | | /** |
| | | * 跳到首页 |
| | |
| | | * @return String |
| | | */ |
| | | @PostMapping(value="/login", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<String> login(@RequestBody UsersEntity user) { |
| | | public ResponseMsg<String> login(@RequestBody UsersEntity user, HttpServletRequest req, HttpServletResponse res) { |
| | | try { |
| | | if (user == null) { |
| | | return fail("请输入用户名和密码!", null); |
| | |
| | | return fail("用户名不存在!", null); |
| | | } |
| | | |
| | | LoginEntity le = loginService.getNewLogin(user.getId(), req); |
| | | if (!user.getPwd().equals(ue.getPwd())) { |
| | | le.setStatus(0); |
| | | le.setDescr("密码错误"); |
| | | loginService.insertLogin(le); |
| | | return fail("密码不正确!", null); |
| | | } |
| | | le.setStatus(1); |
| | | loginService.insertLogin(le); |
| | | |
| | | return null; |
| | | } catch (Exception ex) { |