public ObjectResultEx EnterpriseLogin(RequestValidate LoginValidate) { try { var ComAdmin = EnterpriseService.EnterpriseLogin(LoginValidate); string Code = string.Empty; if (!LoginValidate.IsApp) { Code = CacheFactory.Cache().GetCache <string>("ValidateCode").Trim(); if (ComAdmin != null && Code.ToUpper().Equals(LoginValidate.ValidateCode.Trim().ToUpper())) { CookieInfo cookie = new CookieInfo(); VerificationExtension.WriteToken(cookie, ComAdmin); return(ObjectResultEx.Instance(new { ResponseCookieInfo.RSAToKen, ResponseCookieInfo.RSAApiKey, ResponseCookieInfo.RSASysKey, ComAdmin }, 1, RetrunMessge.SUCCESS, HttpCode.Success)); } else if (!Code.ToUpper().Equals(LoginValidate.ValidateCode.Trim().ToUpper())) { return(ObjectResultEx.Instance(null, -1, "验证码错误", HttpCode.NoAuth)); } else { return(ObjectResultEx.Instance(null, -1, "登录失败或账户冻结", HttpCode.NoAuth)); } } else { if (ComAdmin != null) { CookieInfo cookie = new CookieInfo(); VerificationExtension.WriteToken(cookie, ComAdmin); return(ObjectResultEx.Instance(new { ResponseCookieInfo.RSAToKen, ResponseCookieInfo.RSAApiKey, ResponseCookieInfo.RSASysKey, ComAdmin }, 1, RetrunMessge.SUCCESS, HttpCode.Success)); } else if (ComAdmin == null) { return(ObjectResultEx.Instance(null, -1, "请检查用户名和密码是否正确", HttpCode.NoAuth)); } else if (!Code.ToUpper().Equals(LoginValidate.ValidateCode.Trim().ToUpper())) { return(ObjectResultEx.Instance(null, -1, "验证码错误", HttpCode.NoAuth)); } else { return(ObjectResultEx.Instance(null, -1, "登录失败或账户冻结", HttpCode.NoAuth)); } } } catch (Exception) { return(ObjectResultEx.Instance(null, -1, "请输入验证码", HttpCode.FAIL)); } }