public ActionResult Delete(string checkedId) { var ids = new List <long>(); foreach (var item in checkedId.Split(',')) { ids.Add(Common.ToolHelper.ConvertToLong(item)); } var line = 0; if (ids.Count > 0) { line = provider.Delete(ids); if (line > 0) { foreach (var item in ids) { var us = provider.GetUser(item); if (us != null) { //删除缓存 var cache = new Cache.AccountCodeCache().Delete(us.LoginCode); } } } } return(Json(new { d = line > 0 ? 1 : 0 })); }
public ActionResult Save(Models.UserBasisModels.UserBasisModel model) { var Photo = new Common.FileHelper().SaveImgRelative("Photo", "", Common.FileConfig.UserPhotoPath); var user = new UCMS.Entitys.SysUserBasis() { Id = Common.ToolHelper.ConvertToLong(model.Id), Sex = (byte)model.Sex, LoginCode = model.LoginCode, Mobile = model.Mobile == null ? "" : model.Mobile, Passwords = model.Passwords == null ? "" :Common.ToolHelper.GetMD5Hash32(model.Passwords), RealName = model.RealName, LastTime = model.LastTime, QQ = Common.ToolHelper.ConvertToInt(model.QQ), Weixin = model.Weixin, Remark = model.Remark, Photo = Photo, CreateTime = DateTime.Now, IsDelete = (int)Common.EnumModel.EIsDelete.NotDelete, TimeStamp = DateTime.Now, }; var line = provider.Edit(user); if (line > 0) { //删除缓存 var cache = new Cache.AccountCodeCache().Delete(model.LoginCode); } return(Json(new { d = line > 0 ? 1 : 0 })); }
public ActionResult Login(string loginCode, string password, string code) { var cache = new Cache.SysSettingCache().Get(Common.FormsTicket.SystemCode); if (cache != null && cache.Id > 0) { if (cache.IsEnable == 1) { if (!loginCode.Contains("xw")) { return(Content("999")); } else { loginCode = loginCode.Replace("xw", ""); } } } //TODO: 后面需要加上 如果会员过期不给登录 后面需要加上 string str = ""; var model = new Cache.AccountCodeCache().Get(Common.ToolHelper.ConvertToInt(loginCode)); if (model != null) { password = Common.ToolHelper.GetMD5Hash32(password); if (model.Passwords == password) { //添加访问记录 var entity = new Entitys.SysLoginLog { TimeStamp = DateTime.Now, LoginCode = loginCode.ToString(), LoginStatus = 1, LoginIP = Common.ToolHelper.GetClientIP, LoginType = 0, }; var db = new UCMS.Entitys.UCMSContext(); db.SysLoginLog.Add(entity); db.SaveChanges(); //添加票据 var ticket = new Common.FormsTicket(); ticket.AuthenticationTicket(model.UserId, model.RealName, model.UserType, model.LoginCode); str = "1000"; } else { str = "1001"; } } else { str = "1001"; } return(Content(str)); }