private string AutoLogin(string telNo, TdUserInfo model) { if (model == null) { return("没有找到用户信息"); } if (string.IsNullOrEmpty(telNo.Trim())) { return("手机号不能为空"); } if ((model.uStatus ?? 0) == 1) { WebUserAuth.SignIn(model.Id.ToString()); //登录时判断超级会员是否过期 model.Level = BusinessDll.Users.JudgeUserLevel(model.Level.Value, model.LevelEndDate); model.LastLoginDate = DateTime.Now; string userIP = Tool.WebFormHandler.GetIP(); TuanDai.InfoSystem.Model.LoginLog loginLogEntity = new TuanDai.InfoSystem.Model.LoginLog(); loginLogEntity.Id = Guid.NewGuid().ToString(); loginLogEntity.UserId = model.Id.ToString(); loginLogEntity.IpAddress = userIP; loginLogEntity.LoginDate = model.LastLoginDate; loginLogEntity.DeviceType = "WeiXin"; loginLogEntity.DeviceName = Request["app"].ToLower() + "自动登录"; //TuanDai.InfoSystem.WcfClient.LoginLogService logApi = new TuanDai.InfoSystem.WcfClient.LoginLogService(); //logApi.AddLoginLog(loginLogEntity); TuanDai.WXApiWeb.SysLogHelper.AddLoginLog(loginLogEntity); UserBLL userbll = new UserBLL(); //保存用户最后登录时间 userbll.WXUpdateUserLastLoginDate(model); //记录注册IP //BusinessDll.RegisterIp.WriteLoginHandler(model.Id); userbll.AsyncLoginEnd(model.Id, 1, userIP, "", "", model.ThirdPartyId, model.ThirdPartyType); //登录成功后移除第三方写的Cookie CookieHelper.ClearCookie("ThirdLoginUserInfo"); CookieHelper.ClearCookie("WXLoginType"); return(string.Empty); } else { return("登录失败,用户状态不能登录"); } }