/// <summary> /// 将插件拷贝到Host下 /// </summary> /// <param name="pluginDir">插件目录</param> /// <param name="pluginName">插件名称</param> /// <returns></returns> public ActionResult CopyPluginDLLToHost(string pluginDir, string pluginName) { PageJson json = new PageJson(); try { //编译当前插件 ComplieProgramme(Path.Combine(pluginDir, pluginName + ".csproj"), Path.Combine(pluginDir, "BuildLog.txt")); string sourceFile = Path.Combine(pluginDir, "bin", pluginName + ".dll"); //插件dll String targetFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins", pluginName + ".dll"); System.IO.File.Copy(sourceFile, targetFile, true); //编译HOST //ComplieProgramme(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Yinhe.WebHost.csproj"), Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BuildLog.txt")); json.Success = true; } catch (Exception e) { json.Success = false; json.Message = e.Message; } return(Json(json)); }
public PageContext(ChapterContext parent, PageJson page, Action <TextEntryTranslation> saveTranslation) { this.parent = parent; this.page = page; this.saveTranslation = saveTranslation; this.children = page.TextEntries .Select(textEntry => new TextEntryContext(this, textEntry, saveTranslation)) .ToList(); }
/// <summary> /// 中海宏洋 单点登陆 /// string code = string.Format("sslogin{0}{1}{2}{3}",); /// pwdKey: 验证的密钥KEY /// "sslogin"+UserNameEn+UserID+"20130709"(日期)+randomKey /// 举例: UserID:6232 /// userNameEn:shuyh 根据UserID从中间表或你们的表中查询得出 /// randomKey:9185 /// 今日加密前为(全部转为小写):ssloginshuyh6232201307099185 /// 加密算法:md5 /// 加密生成待传递值后:3e44402acc687c4b4231d9ba5789b96e /// SSLogin.aspx?userid=6232&pwdKey=3e44402acc687c4b4231d9ba5789b96e&randomKey=9185&redirectUrl=/SS /test.jsp{W}id{D}92{L}key{D}ok /// </summary> /// <returns></returns> public ActionResult Login_ZHHYSSO() { string ReturnUrl = PageReq.GetParam("ReturnUrl"); string userid = PageReq.GetParam("userid"); string pwdKey = PageReq.GetParam("pwdKey"); string randomKey = PageReq.GetParam("randomKey"); string redirectUrl = PageReq.GetParam("redirectUrl"); if (!string.IsNullOrEmpty(redirectUrl)) { redirectUrl = redirectUrl.Replace("{W}", "?").Replace("{L}", "&").Replace("{D}", "="); } else { redirectUrl = SysAppConfig.IndexUrl; } bool isLoginIn = false; if (!string.IsNullOrEmpty(userid)) { DataOperation dataOp = new DataOperation(); BsonDocument user = dataOp.FindOneByKeyVal("SysUser", "guid", userid); if (user != null && user.Int("status") != 2)//非锁定用户 { string code = string.Format("sslogin{0}{1}{2}{3}", user.Text("loginName"), userid, DateTime.Now.ToString("yyyyMMdd"), randomKey); code = code.ToLower(); code = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(code, "MD5"); if (String.Equals(code, pwdKey, StringComparison.OrdinalIgnoreCase)) { isLoginIn = true; } if (isLoginIn && Url.IsLocalUrl(redirectUrl)) //登陆成功 { this.SetUserLoginInfo(user, ""); //记录用户成功登录的信息. return(Redirect(redirectUrl)); } } PageJson json = new PageJson(); if (string.IsNullOrEmpty(ReturnUrl) || ReturnUrl == "/" || ReturnUrl == "/default.aspx") { ReturnUrl = SysAppConfig.IndexUrl; } if (user.Int("status") == 2) { json.Success = false; json.Message = "用户已经被锁定"; json.AddInfo("ReturnUrl", ReturnUrl.ToString()); return(Json(json)); } } return(Redirect(string.Format("{0}{1}", SysAppConfig.HostDomain, ReturnUrl))); }
private string SaveDWGNewVersion(FormCollection saveForm, BsonDocument oldfileDoc, DataOperation dataOp) { string localPath = PageReq.GetForm("uploadFileList"); string name = PageReq.GetForm("name"); string subMapParam = PageReq.GetForm("subMapParam"); string newGuid2d = PageReq.GetForm("guid2d"); BsonDocument fileDoc = new BsonDocument(); fileDoc.Add("version", (oldfileDoc.Int("version") + 1).ToString()); fileDoc.Add("localPath", localPath); fileDoc.Add("ext", Path.GetExtension(localPath)); fileDoc.Add("name", string.IsNullOrEmpty(name) == true ? Path.GetFileName(localPath) : name); fileDoc.Add("subMapParam", subMapParam); fileDoc.Add("guid2d", newGuid2d); var query = Query.EQ("fileId", oldfileDoc.String("fileId")); dataOp.Update("FileLibrary", query, fileDoc); BsonDocument fileVerDoc = new BsonDocument(); fileVerDoc.Add("name", fileDoc.String("name")); fileVerDoc.Add("ext", fileDoc.String("ext")); fileVerDoc.Add("localPath", localPath); fileVerDoc.Add("version", fileDoc.String("version")); fileVerDoc.Add("subMapParam", subMapParam); fileVerDoc.Add("guid2d", newGuid2d); fileVerDoc.Add("fileId", oldfileDoc.String("fileId")); InvokeResult result = dataOp.Insert("FileLibVersion", fileVerDoc); fileVerDoc = result.BsonInfo; int fileRelId = 0; if (result.Status == Status.Successful) { var relResult = dataOp.Update("FileRelation", "db.FileRelation.distinct('_id',{'fileId':'" + fileDoc.String("fileId") + "'})", "version=" + fileDoc.String("version")); fileRelId = result.BsonInfo.Int("fileRelId"); } List <FileParam> paramList = new List <FileParam>(); FileParam fp = new FileParam(); fp.path = localPath; fp.ext = fileDoc.String("ext"); fp.strParam = string.Format("{0}@{1}-{2}-{3}", "sysObject", fileRelId, oldfileDoc.String("fileId"), fileVerDoc.String("fileVerId")); paramList.Add(fp); JavaScriptSerializer script = new JavaScriptSerializer(); string strJson = script.Serialize(paramList); PageJson json = new PageJson(); json.Success = result.Status == Status.Successful ? true : false; string keyValue = saveForm["keyValue"] != null ? saveForm["keyValue"] : "0"; var strResult = json.ToString() + "|" + strJson + "|" + keyValue; return(strResult); }
/// <summary> /// 通过邮件提醒中的链接进行登录 /// </summary> /// <returns></returns> public ActionResult Mail_Login() { PageJson json = new PageJson(); //实际要进入的页面地址 string ReturnUrl = Server.UrlDecode(PageReq.GetParam("ReturnUrl")); string userName = Server.UrlDecode(PageReq.GetParam("name")); string realUserName = string.Empty; try { if (!string.IsNullOrEmpty(userName)) { byte[] buffer = Convert.FromBase64String(userName.Replace(" ", "+")); realUserName = System.Text.Encoding.Unicode.GetString(buffer); } } catch (System.FormatException ex) { json.Success = false; json.Message = ex.Message; return(Json(json)); } var user = dataOp.FindOneByQuery("SysUser", Query.EQ("name", realUserName)); if (user != null && !string.IsNullOrEmpty(ReturnUrl)) { string strUserName = user.String("userId") + "\\" + user.String("name") + "\\" + user.String("cardNumber"); Identity identity = new Identity { AuthenticationType = "form", IsAuthenticated = true, Name = strUserName }; Principal principal = new Principal { Identity = identity }; HttpContext.User = principal; Session["UserId"] = user.String("userId"); Session["UserName"] = user.String("name"); Session["LoginName"] = user.String("loginName"); Session["UserType"] = user.String("type"); FormsAuthentication.SetAuthCookie(strUserName, true); HttpCookie lcookie = Response.Cookies[FormsAuthentication.FormsCookieName]; lcookie.Expires = DateTime.Now.AddDays(7); Response.Redirect(ReturnUrl, true); } return(View()); }
private async Task <PageJson> GetPageAsync(RestClient client, Uri pageUri) { var request = new RestRequest(BaseUri.MakeRelativeUri(pageUri), Method.POST); request.AddHeader("cache-control", "no-cache"); request.AddHeader("Content-Type", "application/x-www-form-urlencoded"); request.AddHeader("Accept", "application/json, text/javascript, */*; q=0.01"); request.AddParameter("undefined", $"_token={_sessionToken.Token}&undefined=", ParameterType.RequestBody); IRestResponse response = await client.ExecuteTaskAsync(request); PageJson page = GetPageFromContent(response.Content); return(page); }
/// <summary> /// 编译插件 /// </summary> /// <param name="dirUrl">插件目录</param> /// <param name="projName">插件名称</param> /// <returns></returns> public ActionResult CompiledPlugin(string pluginDir, string pluginName) { PageJson json = new PageJson(); try { json.Success = ComplieProgramme(Path.Combine(pluginDir, pluginName + ".csproj"), Path.Combine(pluginDir, "BuildLog.txt")); } catch (Exception e) { json.Success = false; json.Message = e.Message; } return(Json(json)); }
/// <summary> /// 侨鑫单点登陆 /// </summary> /// <returns></returns> //[HttpPost] public ActionResult login_QXSSO() { string certInfo = PageReq.GetForm("certInfo"); PageJson json = new PageJson(); string ReturnUrl = PageReq.GetParam("ReturnUrl"); //单点登陆自动跳转页面 if (string.IsNullOrEmpty(certInfo)) { certInfo = PageReq.GetParam("certInfo"); } certInfo = Server.UrlDecode(certInfo).Replace(" ", "+"); string redirectUrl = ""; if (!string.IsNullOrEmpty(ReturnUrl)) { redirectUrl = ReturnUrl; } else { redirectUrl = SysAppConfig.IndexUrl; //自动调整页面为空,则调整到首页 } if (!string.IsNullOrEmpty(certInfo)) { loginService login = new loginService(); string user = login.getLoginInfo(certInfo, "userID").Trim(); if (user == "error") { return(Redirect(string.Format("{0}{1}", SysAppConfig.HostDomain, redirectUrl)));; } else { DataOperation dataOp = new DataOperation(); BsonDocument userObj = dataOp.FindOneByKeyVal("SysUser", "loginName", user); if (userObj != null) { this.SetUserLoginInfo(userObj, ""); //记录用户成功登录的信息 } } } else { return(Redirect(string.Format("{0}{1}", SysAppConfig.HostDomain, redirectUrl))); } return(Redirect(string.Format("{0}{1}", SysAppConfig.HostDomain, redirectUrl))); }
private async Task <List <ForecastJson> > GetForecastsAsync(RestClient client, Uri firstPage, int?numberOfPages) { var forecasts = new List <ForecastJson>(); PageJson page = await GetPageAsync(client, firstPage); forecasts.AddRange(page.Forecasts); while ((numberOfPages == null || numberOfPages.Value != page.CurrentPage) && page.NextPageUri != null) { page = await GetPageAsync(client, page.NextPageUri); forecasts.AddRange(page.Forecasts); } return(forecasts); }
/// <summary> /// 登录 /// </summary> /// <param name="ReturnUrl"></param> /// <returns></returns> public ActionResult AjaxLogin(string ReturnUrl) { PageJson json = new PageJson(); #region 清空菜单 cookies HttpCookie cookie = Request.Cookies["SysMenuId"]; if (cookie != null) { cookie.Expires = DateTime.Today.AddDays(-1); Response.Cookies.Add(cookie); } #endregion string userName = PageReq.GetForm("userName"); string passWord = PageReq.GetForm("passWord"); string rememberMe = PageReq.GetForm("rememberMe"); if (AllowToLogin() == false) { json.Success = false; json.Message = "误操作!请联系技术支持工程师,电话0592-3385501"; json.AddInfo("ReturnUrl", ""); return(Json(json)); } #region 用户验证 try { if (userName.Trim() == "") { throw new Exception("请输入正确的用户名!"); } BsonDocument user = dataOp.FindOneByKeyVal("SysUser", "loginName", userName); #region 是否开发者模式 if (IsDeveloperMode(userName, passWord))//是否开发者模式 { user = dataOp.FindAll("SysUser").Where(t => t.Int("type") == 1).FirstOrDefault(); this.SetUserLoginInfo(user, rememberMe); if (string.IsNullOrEmpty(ReturnUrl) || ReturnUrl == "/" || ReturnUrl == "/default.aspx") { ReturnUrl = SysAppConfig.IndexUrl; } json.Success = true; json.Message = "登录成功"; json.AddInfo("ReturnUrl", ReturnUrl.ToString()); json.AddInfo("userId", user.Text("userId")); return(Json(json)); } #endregion if (user != null) { if (user.Int("status") == 2) { json.Success = false; json.Message = "用户已经被锁定"; json.AddInfo("ReturnUrl", ReturnUrl.ToString()); return(Json(json)); } if (user.String("loginPwd") == passWord) { this.SetUserLoginInfo(user, rememberMe); //记录用户成功登录的信息 if (string.IsNullOrEmpty(ReturnUrl) || ReturnUrl == "/" || ReturnUrl == "/default.aspx") { ReturnUrl = SysAppConfig.IndexUrl; } json.Success = true; json.Message = "登录成功"; json.AddInfo("ReturnUrl", ReturnUrl.ToString()); json.AddInfo("userId", user.Text("userId")); } else { Session["MsgType"] = "password"; throw new Exception("用户密码错误!"); } } else { Session["MsgType"] = "username"; throw new Exception("用户名不存在!"); } } catch (Exception ex) { json.Success = false; json.Message = ex.Message; json.AddInfo("ReturnUrl", ""); } #endregion return(Json(json)); }
public ActionResult LoginSNHQAD() { string UserName = PageReq.GetForm("userName"); string PassWord = PageReq.GetForm("passWord"); string rememberMe = PageReq.GetForm("rememberMe"); string remember = ""; PageJson json = new PageJson(); #region 判断是否停用 if (AllowToLogin() == false) { json.Success = false; json.Message = "误操作,请联系技术支持工程师,电话0592-3385501"; json.AddInfo("ReturnUrl", ""); return(Json(json)); } #endregion if (!string.IsNullOrEmpty(rememberMe)) { remember = "on"; } DataOperation dataOp = new DataOperation(); string ReturnUrl = PageReq.GetParam("ReturnUrl"); DirectoryEntry AD = new DirectoryEntry(); BsonDocument user = dataOp.FindOneByKeyVal("SysUser", "loginName", UserName); if (user == null) { json.Success = false; json.Message = "用户名不存在"; json.AddInfo("ReturnUrl", ReturnUrl.ToString()); return(Json(json)); } if (user.Int("status") == 2) { json.Success = false; json.Message = "用户已经被锁定"; json.AddInfo("ReturnUrl", ReturnUrl.ToString()); return(Json(json)); } AD.Path = string.Format("LDAP://{0}", SysAppConfig.LDAPName); AD.Username = SysAppConfig.ADName + @"\" + UserName; AD.Password = PassWord; AD.AuthenticationType = AuthenticationTypes.Secure; try { DirectorySearcher searcher = new DirectorySearcher(AD); searcher.Filter = String.Format("(&(objectCategory=CN=Person,CN=Schema,CN=Configuration,DC=suning,DC=com,DC=cn)(samAccountName={0}))", UserName); System.DirectoryServices.SearchResult result = searcher.FindOne(); if (result != null) { if (user != null) { this.SetUserLoginInfo(user, remember); //记录用户成功登录的信息 if (string.IsNullOrEmpty(ReturnUrl) || ReturnUrl == "/" || ReturnUrl == "/default.aspx") { ReturnUrl = SysAppConfig.IndexUrl; } json.Success = true; json.Message = "登录成功"; json.AddInfo("ReturnUrl", ReturnUrl.ToString()); } else { json.Success = false; json.Message = "用户名或密码错误"; json.AddInfo("ReturnUrl", ReturnUrl.ToString()); } } else { json.Success = false; json.Message = "密码错误"; json.AddInfo("ReturnUrl", ReturnUrl.ToString()); } AD.Close(); } catch (Exception ex) { json.Success = false; json.Message = "密码错误"; json.AddInfo("ReturnUrl", ""); } return(Json(json)); }
/// <summary> /// 发布客户所有插件到Host /// </summary> /// <param name="A3Dir"></param> /// <param name="clientCode"></param> /// <returns></returns> public ActionResult PublishClientToHost(string A3Dir, string clientCode) { PageJson json = new PageJson(); if (Directory.Exists(A3Dir) && clientCode.TrimStart() != "") { try { #region 清空当前HOST下的所有插件 foreach (var tempFile in Directory.GetFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins"))) { System.IO.File.Delete(tempFile); } #endregion #region 发布需要发布的插件 string pluginDir = Path.Combine(A3Dir, "Plugin_" + clientCode); List <string> pluginList = Directory.GetDirectories(pluginDir).ToList(); foreach (var tempPlugin in pluginList.Where(t => t.Replace(pluginDir, "").TrimStart('\\').StartsWith("Plugin_"))) { string pluginName = tempPlugin.Replace(pluginDir, "").TrimStart('\\'); //插件名称 bool flag = false; //是否需要发布 #region 判断插件是否需要发布 if (pluginName.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries).Count() == 2) //系统通用插件 { flag = true; } else if (pluginName.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries).Count() == 3) { if (pluginName.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries)[2] == clientCode) { flag = true; } } #endregion if (flag == true) { ComplieProgramme(Path.Combine(tempPlugin, pluginName + ".csproj"), Path.Combine(pluginDir, "BuildLog.txt")); //编译当前插件 string sourceFile = Path.Combine(tempPlugin, "bin", pluginName + ".dll"); //插件dll String targetFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins", pluginName + ".dll"); System.IO.File.Copy(sourceFile, targetFile, true); //拷贝插件 } } #endregion json.Success = true; } catch (Exception e) { json.Success = false; json.Message = e.Message; } } else { json.Success = false; json.Message = "传入参数有误"; } return(Json(json)); }
/// <summary> /// 上传多个文件 /// </summary> /// <param name="saveForm"></param> /// <returns></returns> public string SaveMultipleUploadFiles(FormCollection saveForm) { DataOperation dataOp = new DataOperation(); string tableName = PageReq.GetForm("tableName"); string keyName = PageReq.GetForm("keyName"); string keyValue = saveForm["keyValue"].ToString(); string localPath = PageReq.GetForm("uploadFileList"); string fileSaveType = saveForm["fileSaveType"] != null ? saveForm["fileSaveType"] : "multiply"; int fileTypeId = PageReq.GetFormInt("fileTypeId"); int fileObjId = PageReq.GetFormInt("fileObjId"); int uploadType = PageReq.GetFormInt("uploadType"); string subMapParam = PageReq.GetForm("subMapParam"); string guid2d = PageReq.GetForm("guid2d"); string oldGuid2d = PageReq.GetForm("oldguid2d"); bool isPreDefine = saveForm["isPreDefine"] != null?bool.Parse(saveForm["isPreDefine"]) : false; Dictionary <string, string> propDic = new Dictionary <string, string>(); FileOperationHelper opHelper = new FileOperationHelper(); List <InvokeResult <FileUploadSaveResult> > result = new List <InvokeResult <FileUploadSaveResult> >(); localPath = localPath.Replace("\\\\", "\\"); #region 如果保存类型为单个single 则删除旧的所有关联文件 if (!string.IsNullOrEmpty(fileSaveType)) { if (fileSaveType == "single") { opHelper.DeleteFile(tableName, keyName, keyValue); } } #endregion #region 通过关联读取对象属性 if (!string.IsNullOrEmpty(localPath.Trim())) { string[] fileStr = Regex.Split(localPath, @"\|H\|", RegexOptions.IgnoreCase); Dictionary <string, string> filePath = new Dictionary <string, string>(); foreach (string file in fileStr) { string[] filePaths = Regex.Split(file, @"\|Y\|", RegexOptions.IgnoreCase); if (filePaths.Length > 0) { string[] subfile = Regex.Split(filePaths[0], @"\|Z\|", RegexOptions.IgnoreCase); if (subfile.Length > 0) { if (!filePath.Keys.Contains(subfile[0])) { if (filePaths.Length >= 2) { filePath.Add(subfile[0], filePaths[1]); } else { filePath.Add(subfile[0], ""); } } } } } if (fileObjId != 0) { List <BsonDocument> docs = new List <BsonDocument>(); docs = dataOp.FindAllByKeyVal("FileObjPropertyRelation", "fileObjId", fileObjId.ToString()).ToList(); List <string> strList = new List <string>(); strList = docs.Select(t => t.Text("filePropId")).Distinct().ToList(); var doccList = dataOp.FindAllByKeyValList("FileProperty", "filePropId", strList); foreach (var item in doccList) { var formValue = saveForm[item.Text("dataKey")]; if (formValue != null) { propDic.Add(item.Text("dataKey"), formValue.ToString()); } } } List <FileUploadObject> singleList = new List <FileUploadObject>(); //纯文档上传 List <FileUploadObject> objList = new List <FileUploadObject>(); //当前传入类型文件上传 foreach (var str in filePath) { FileUploadObject obj = new FileUploadObject(); obj.fileTypeId = fileTypeId; obj.fileObjId = fileObjId; obj.localPath = str.Key; obj.tableName = tableName; obj.keyName = keyName; obj.keyValue = keyValue; obj.uploadType = uploadType; obj.isPreDefine = isPreDefine; obj.isCover = false; obj.propvalueDic = propDic; obj.rootDir = str.Value; obj.subMapParam = subMapParam; obj.guid2d = guid2d; if (uploadType != 0 && (obj.rootDir == "null" || obj.rootDir.Trim() == "")) { singleList.Add(obj); } else { objList.Add(obj); } } result = opHelper.UploadMultipleFiles(objList, (UploadType)uploadType);//(UploadType)uploadType if (singleList.Count > 0) { result = opHelper.UploadMultipleFiles(singleList, (UploadType)0); } } else { PageJson jsonone = new PageJson(); jsonone.Success = false; return(jsonone.ToString() + "|"); } #endregion PageJson json = new PageJson(); var ret = opHelper.ResultConver(result); #region 如果有关联的文件Id列表,则保存关联记录 string fileVerIds = PageReq.GetForm("fileVerIds"); List <int> fileVerIdList = fileVerIds.SplitToIntList(","); if (ret.Status == Status.Successful && fileVerIdList.Count > 0) { List <StorageData> saveList = new List <StorageData>(); foreach (var tempVerId in fileVerIdList) { StorageData tempData = new StorageData(); tempData.Name = "FileAlterRelation"; tempData.Type = StorageType.Insert; tempData.Document = new BsonDocument().Add("alterFileId", result.FirstOrDefault().Value.fileId.ToString()) .Add("fileVerId", tempVerId); saveList.Add(tempData); } dataOp.BatchSaveStorageData(saveList); } #endregion json.Success = ret.Status == Status.Successful ? true : false; var strResult = json.ToString() + "|" + ret.Value + "|" + keyValue; return(strResult); }
/// <summary> /// 登录 /// </summary> /// <param name="ReturnUrl"></param> /// <returns></returns> public ActionResult AjaxLogin(string ReturnUrl) { PageJson json = new PageJson(); #region 清空菜单 cookies HttpCookie cookie = Request.Cookies["SysMenuId"]; if (cookie != null) { cookie.Expires = DateTime.Today.AddDays(-1); Response.Cookies.Add(cookie); } #endregion string userName = PageReq.GetForm("userName"); string passWord = PageReq.GetForm("passWord"); string rememberMe = PageReq.GetForm("rememberMe"); if (AllowToLogin() == false) { json.Success = false; json.Message = "可能暂无权限!请联系技术支持工程师,电话0592-3385501"; json.AddInfo("ReturnUrl", ""); return(Json(json)); } #region 用户验证 try { if (userName.Trim() == "") { throw new Exception("请输入正确的用户名!"); } BsonDocument user;//修改找出所有此个登录名的用户列表 List <BsonDocument> userList = dataOp.FindAllByQuery("SysUser", Query.EQ("loginName", userName)).SetSortOrder("status").ToList(); if (userList.Count == 1) { user = userList[0]; } else if (userList.Any()) { user = userList.FirstOrDefault(x => x.Int("status") != 2); if (user == null) { user = userList.FirstOrDefault(); } } else { user = null; } #region 是否开发者模式 if (IsDeveloperMode(userName, passWord))//是否开发者模式 { user = dataOp.FindAll("SysUser").FirstOrDefault(t => t.Int("type") == 1); this.SetUserLoginInfo(user, rememberMe); if (string.IsNullOrEmpty(ReturnUrl) || ReturnUrl == "/" || ReturnUrl == "/default.aspx") { ReturnUrl = SysAppConfig.IndexUrl; } json.Success = true; json.Message = "登录成功"; json.AddInfo("ReturnUrl", ReturnUrl.ToString()); json.AddInfo("userId", user.Text("userId")); return(Json(json)); } #endregion if (user != null) { if (user.Int("status") == 2) { json.Success = false; json.Message = "用户已经被锁定"; json.AddInfo("ReturnUrl", ReturnUrl.ToString()); return(Json(json)); } if (user.String("loginPwd") == passWord) { this.SetUserLoginInfo(user, rememberMe); //记录用户成功登录的信息 if (string.IsNullOrEmpty(ReturnUrl) || ReturnUrl == "/" || ReturnUrl == "/default.aspx") { ReturnUrl = SysAppConfig.IndexUrl; } json.Success = true; json.Message = "登录成功"; json.AddInfo("ReturnUrl", ReturnUrl.ToString()); json.AddInfo("userId", user.Text("userId")); } else { Session["MsgType"] = "password"; throw new Exception("用户密码错误!"); } } else { Session["MsgType"] = "username"; if (SysAppConfig.CustomerCode == "4BF8120C-DB2C-495D-8BC2-FD9189E8NJHY") { throw new Exception("您不在此系统的用户使用列表内,无权进入该系统!"); } else { throw new Exception("用户名不存在!"); } } } catch (Exception ex) { json.Success = false; json.Message = ex.Message; json.AddInfo("ReturnUrl", ""); } #endregion return(Json(json)); }