public string UserLogin() { ResultObj _result = new ResultObj(); _result.Status = (int)CommonStatus.Fail; string useraccount = StringUtils.SafeStr(Request.Form["useraccount"]); string password = StringUtils.SafeStr(Request.Form["password"]); string VerCode = StringUtils.SafeStr(FormString.SafeQ("verCode")); int autologin = FormString.IntSafeQ("autologin"); //if (VerCode.Length == 4) //{ // //string svercode = StringUtils.GetDbString(System.Web.HttpContext.Current.Session["verify_login"]); // HttpCookie cookie = Request.Cookies["verify_login"]; // string svercode = ""; // if (cookie != null) // { // svercode = CryptDES.DESDecrypt(cookie.Value); // } // if (svercode != "") // { // if (VerCode.ToLower() != svercode.ToLower()) // { // return "验证码输入错误"; // } // } //} MemberLoginEntity _loginmodel = new MemberLoginEntity(); _result = MemberLoginBLL.Instance.Login("", useraccount, password, (int)ClientTypeEnum.PC, IPAddress.IP); if (_result != null && _result.Obj != null) { _loginmodel = (MemberLoginEntity)_result.Obj; try { if (_result.Status == (int)CommonStatus.Success) { if (_loginmodel.Status == (int)MemberStatus.WaitCheck) { CookieBLL.SetRegisterCookie(_loginmodel.MemId); } else { CookieBLL.SetLoginCookie(_loginmodel, autologin == 1); CookieBLL.ComBineCart(1); CookieBLL.ComBineCartXuQiu(1); } } } catch (Exception ex) { LogUtil.Log(ex); _result.Status = (int)CommonStatus.ServerError; } } return(JsonJC.ObjectToJson(_result)); }
public string CompanyRegister() { ResultObj _obj = new ResultObj(); string useraccount = FormString.SafeQ("useraccount"); string password = FormString.SafeQ("password"); string mobile = FormString.SafeQ("mobile"); string mobilecode = FormString.SafeQ("mobilecode"); string companyname = FormString.SafeQ("companyname"); int province = FormString.IntSafeQ("province"); int city = FormString.IntSafeQ("city"); int comtype = FormString.IntSafeQ("comtype"); string contractmanname = FormString.SafeQ("contractmanname"); string email = FormString.SafeQ("email"); string address = FormString.SafeQ("address", 300); string recommend = FormString.SafeQ("recommend"); string lisenceurl = FormString.SafeQ("lisencepath", 500); if (System.Web.HttpContext.Current.Session[CommonKey.MobileNoRegister] == null || System.Web.HttpContext.Current.Session[CommonKey.MobileYZCode] == null) { _obj.Status = (int)CommonStatus.RegisterVerCodeHasExDay; } else if (System.Web.HttpContext.Current.Session[CommonKey.MobileNoRegister] == null || System.Web.HttpContext.Current.Session[CommonKey.MobileYZCode] == null || System.Web.HttpContext.Current.Session[CommonKey.MobileNoRegister].ToString() != mobile || System.Web.HttpContext.Current.Session[CommonKey.MobileYZCode].ToString() != mobilecode) { _obj.Status = (int)CommonStatus.RegisterErrorVerCode; } else { VWMemberEntity _mem = new VWMemberEntity(); _mem.MemCode = useraccount; _mem.PassWord = password; _mem.ContactsMobile = mobile; _mem.CompanyName = companyname; _mem.CompanyProvinceId = province; _mem.CompanyCityId = city; _mem.CompanyAddress = address; _mem.ContactsManName = contractmanname; _mem.ContactsEmail = email; _mem.CompanyType = comtype; _mem.RecommendCode = recommend; _mem.CreateClientType = (int)ClientTypeEnum.PC; _mem.CreateIp = IPAddress.IP; _mem.IsStore = 1; _mem.LicensePath = lisenceurl; _mem.IsSupplier = 0; ResultObj _loginentity = MemberLoginBLL.Instance.RegisterStore(_mem); if (_loginentity.Status == (int)CommonStatus.Success) { CookieBLL.SetRegisterCookie(StringUtils.GetDbInt(_loginentity.Obj)); } _obj = _loginentity; } return(JsonJC.ObjectToJson(_obj)); }
public string RegSubmit() { ResultObj _obj = new ResultObj(); string password = FormString.SafeQ("password"); string mobile = FormString.SafeQ("mobile"); string mobilecode = FormString.SafeQ("mobilecode"); if (System.Web.HttpContext.Current.Session[CommonKey.MobileNoRegister] == null || System.Web.HttpContext.Current.Session[CommonKey.MobileYZCode] == null) { _obj.Status = (int)CommonStatus.RegisterVerCodeHasExDay; } else if (System.Web.HttpContext.Current.Session[CommonKey.MobileNoRegister] == null || System.Web.HttpContext.Current.Session[CommonKey.MobileYZCode] == null || System.Web.HttpContext.Current.Session[CommonKey.MobileNoRegister].ToString() != mobile || System.Web.HttpContext.Current.Session[CommonKey.MobileYZCode].ToString() != mobilecode) { _obj.Status = (int)CommonStatus.RegisterErrorVerCode; } else { MemberEntity _mem = new MemberEntity(); _mem.MobilePhone = mobile; _mem.PassWord = password; //_mem.IsSupplier = issupplier; //_mem.IsStore = isstore; string code = CookieBLL.GetWeiXinWebCode(); if (!string.IsNullOrEmpty(code)) { MemWeChatMsgEntity shortmsg = WeiXinJsSdk.Instance.GetWeChatShortInfo(code); if (!string.IsNullOrEmpty(shortmsg.OpenId) && !string.IsNullOrEmpty(shortmsg.UnionId)) { _mem.WeChat = shortmsg.UnionId; } } _mem.CreateClientType = Globals.IsMobileDevice()? (int)ClientTypeEnum.Mobile:(int)ClientTypeEnum.PC; _mem.CreateIp = IPAddress.IP; _mem.Status = (int)MemberStatus.Active; _mem.LoginNum = 0; ResultObj _loginentity = MemberLoginBLL.Instance.Register1(_mem); if (_loginentity.Status == (int)CommonStatus.Success) { MemberEntity member = (MemberEntity)_loginentity.Obj; CookieBLL.SetRegisterCookie(StringUtils.GetDbInt(member.Id)); } _obj = _loginentity; } return(JsonJC.ObjectToJson(_obj)); }
public string UserLogin() { ResultObj _result = new ResultObj(); _result.Status = (int)CommonStatus.Fail; string useraccount = StringUtils.SafeStr(Request.Form["useraccount"]); string password = StringUtils.SafeStr(Request.Form["password"]); string VerCode = StringUtils.SafeStr(FormString.SafeQ("verCode")); int autologin = FormString.IntSafeQ("autologin"); //if (VerCode.Length == 4) //{ // //string svercode = StringUtils.GetDbString(System.Web.HttpContext.Current.Session["verify_login"]); // HttpCookie cookie = Request.Cookies["verify_login"]; // string svercode = ""; // if (cookie != null) // { // svercode = CryptDES.DESDecrypt(cookie.Value); // } // if (svercode != "") // { // if (VerCode.ToLower() != svercode.ToLower()) // { // return "验证码输入错误"; // } // } //} MemberLoginEntity _loginmodel = new MemberLoginEntity(); string unionid = ""; if (System.Web.HttpContext.Current.Session[CommonKey.WeChatUnionId] != null) { unionid = System.Web.HttpContext.Current.Session[CommonKey.WeChatUnionId].ToString(); } //string code = CookieBLL.GetWeiXinWebCode(); //LogUtil.Log("微信传值:", code); //if (!string.IsNullOrEmpty(code)) //{ // MemWeChatMsgEntity shortmsg = WeiXinJsSdk.Instance.GetWeChatShortInfo(code); // LogUtil.Log("微信传值2:", shortmsg.UnionId+","+ shortmsg.OpenId); // if (!string.IsNullOrEmpty(shortmsg.OpenId) && !string.IsNullOrEmpty(shortmsg.UnionId)) // { // unionid = shortmsg.UnionId; // } //} _result = MemberLoginBLL.Instance.Login(unionid, useraccount, password, (int)ClientTypeEnum.PC, IPAddress.IP); if (_result != null && _result.Obj != null) { _loginmodel = (MemberLoginEntity)_result.Obj; try { if (_result.Status == (int)CommonStatus.Success) { if (_loginmodel.Status == (int)MemberStatus.Register1 || _loginmodel.Status == (int)MemberStatus.Register2 || _loginmodel.Status == (int)MemberStatus.WaitCheck) { CookieBLL.SetRegisterCookie(_loginmodel.MemId); } else { CookieBLL.SetLoginCookie(_loginmodel, autologin == 1); CookieBLL.ComBineCart(1); CookieBLL.ComBineCartXuQiu(1); } } } catch (Exception ex) { LogUtil.Log(ex); _result.Status = (int)CommonStatus.ServerError; } } return(JsonJC.ObjectToJson(_result)); }
public string UserRegister() { //string VerCode = StringUtils.SafeStr(FormString.SafeQ("VerCode")); //if (VerCode.Length == 4) //{ // HttpCookie cookie = Request.Cookies["verify_register"]; // string svercode = ""; // if (cookie != null) // { // svercode = Core.DES.DESDecrypt(cookie.Value); // } // if (svercode != "") // { // if (VerCode.ToLower() != svercode.ToLower()) // { // return "011110"; // } // } //} //else //{ // return "011110"; //}} ResultObj _result = new ResultObj(); string useraccount = StringUtils.SafeStr(FormString.SafeQ("useraccount")); string password = StringUtils.SafeStr(FormString.SafeQ("PassWord")); string mobile = StringUtils.SafeStr(FormString.SafeQ("mobile")); string mobilecode = StringUtils.SafeStr(FormString.SafeQ("mobilecode")); ///验证码 //if (System.Web.HttpContext.Current.Session[CommonKey.MobileNo] != null && System.Web.HttpContext.Current.Session[CommonKey.MobileYZCode] != null && System.Web.HttpContext.Current.Session[CommonKey.MobileNo].ToString() == mobile && System.Web.HttpContext.Current.Session[CommonKey.MobileYZCode].ToString() == mobilecode) //{ _result = MemberLoginBLL.Instance.Register(useraccount, password, mobile, (int)ClientTypeEnum.PC, IPAddress.IP, ""); //CookieBLL.SetLoginCookie(_loginentity); //CookieBLL.ComBineCart(1); if (_result.Status == (int)CommonStatus.Success) { CookieBLL.SetRegisterCookie(StringUtils.GetDbInt(_result.Obj)); } //if (StringUtils.IsEmail(useraccount)) //{ // //此处可以异步 // string contenturl = SuperMarket.Core.Globals.WebUrl + "email/RegisterSuccess.aspx?MemCode=" + email + "&Id=" + _loginentity.Member.Id; // try // { // SendEmailSmsEntity sendemail = new SendEmailSmsEntity(); // sendemail.Title = "注册成功通知"; // sendemail.SendTo = email; // sendemail.CreateTime = DateTime.Now; // sendemail.CreateBy = "网站"; // sendemail.Status = 0; // sendemail.MemCode = email; // sendemail.EmailContent = StringUtils.GetContent(contenturl); // sendemail.PriorIndex = 100; // if (sendemail.EmailContent != "") // { // SendEmailSmsBLL.Instance.AddSendEmailSms(sendemail); // } // } // catch (Exception ex) // { // LogUtil.Log(ex); // } //} //} //else //{ // _result.Status = (int)CommonStatus.RegisterErrorVerCode; //} return(JsonJC.ObjectToJson(_result)); }