public ActionResult GetAdmin( string userName , string pwd , string lastTime ) { var msg = new MsgBase(); try { Admin adm = admBll.Get( userName , pwd ); if ( adm != null ) { Session["USER"] = adm; if ( lastTime.ToLower() != "none" ) { //保存cookie var user = new OnlineUser(); user.SetCookie( userName , lastTime ); } LoginLog lastLog = logBll.Get( OnlineUser.OnLineUserID ); //创建登陆日志对象 var log = new LoginLog(); string ip = WebHelper.CurrentIp; if ( lastLog != null ) { log.LastLoginIpAddress = lastLog.LoginIPAddress; log.LastLoginPlace = lastLog.LoginPlace; log.LastLoginTime = lastLog.LoginTime; } log.LoginIPAddress = ip; log.LoginPlace = WebHelper.GetPlaceByIp( ip ); log.OperateId = OnlineUser.OnLineUserID; log.Status = (int)UserStatus.在线; log.LoginTime = DateTime.Now; //执行插入 logBll.Add( log ); msg.Code = 1; } else { msg.Code = 0; msg.Message = "账号或者密码错误"; } } catch ( Exception ex ) { msg.Code = -1; msg.Message = MsgBase.ErrMessage; } return Json( msg ); }