String code = (String) request.getParameter("validateCode");
String productid = (String)request.getParameter("productid");
ApplicationContext ac = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
IUserCardService userCardService = (IUserCardService) ac.getBean("userCardService");
PrintWriter out = response.getWriter();
String result = "";
if (!code.equalsIgnoreCase((String) request.getSession()
.getAttribute("validateCode"))) {
result = "验证码错误!";
out.write(result);
out.flush();
return ;
}
User authuser = userCardService.auth(new User(username, password));
if (authuser != null) {
RunTimeUser rtUser = new RunTimeUser(authuser);
if(rtUser.getUsertype()!=User.USER_TYPE_NORMAL) {
result = "非会员账号,不能进行兑换";
out.write(result);
out.flush();
return ;
}
rtUser.setUserIp(request.getRemoteAddr());
rtUser.setSessionID(request.getSession().getId());
String sid = request.getSession().getId();
request.getSession().removeAttribute(sid);
request.getSession().setAttribute(sid, rtUser);
if (!ArrayUtil.isEmptyCollection(rtUser.getRoles())) {
rtUser.setIsmanager(true);
}
if(rtUser.getUsertype()==2){
rtUser.setMerchant(true);
}
if(rtUser.getUsertype()==3){
rtUser.setOrganization(true);
}
// 设置当前登录时间ip 下次登录时拿上次的登录时间ip
authuser.setLastlogin(new Date());
authuser.setIp(request.getRemoteAddr());
userCardService.updateUser(authuser);
/*String url = "/page/management/member/member_welcome.jsp";
if (rtUser.isIsmanager()) {
url = "/page/management/common/main.jsp";
rtUser.setUrl(url);