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 static VWShoppingCartInfo GetXuQiuSession()
 {
     #region 重新获取购物车SESSSION
     System.Web.HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies[Core.SysCookieName.ComBineXuQiu];
     string result = "0";
     if (cookie != null)
     {
         result = cookie.Value;
     }
     if (result == "1")
     {
         RemoveXuQiuSession();
         ShoppingXuQiuProcessor.WriteShoppingXuQiuCookieByLogin();
         CookieBLL.ComBineCartXuQiu(0);
     }
     #endregion
     VWShoppingCartInfo shoppingCart = ShoppingXuQiuProcessor.GetShoppingXuQiu();
     return(shoppingCart);
 }
        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));
        }
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <returns></returns>
        public ActionResult Login()
        {
            if (Globals.IsMobileDevice() && Request.Url.AbsoluteUri.Contains(ConfigCore.Instance.ConfigCommonEntity.LoginWebUrl))
            {
                return(Redirect(Request.Url.AbsoluteUri.Replace(ConfigCore.Instance.ConfigCommonEntity.LoginWebUrl, ConfigCore.Instance.ConfigCommonEntity.LoginMobileWebUrl)));
            }
            string returnurl = StringUtils.GetDbString(Request.QueryString["returnurl"]);
            string unionid   = "";
            string code      = QueryString.SafeQ("wechatcode"); //微信自动登录

            if (!string.IsNullOrEmpty(code))
            {
                MemWeChatMsgEntity shortmsg = WeiXinJsSdk.Instance.GetWeChatShortInfo(code);
                if (!string.IsNullOrEmpty(shortmsg.OpenId) && !string.IsNullOrEmpty(shortmsg.UnionId))
                {
                    unionid = shortmsg.UnionId;
                    System.Web.HttpContext.Current.Session[CommonKey.WeChatUnionId] = unionid;
                    MemWeChatMsgEntity entity = new MemWeChatMsgEntity();
                    entity.AppId   = WeiXinConfig.GetAppId();
                    entity.Status  = (int)WeChatStatus.ShortInfo;
                    entity.UnionId = shortmsg.UnionId;
                    entity.OpenId  = shortmsg.OpenId;
                    MemWeChatMsgBLL.Instance.WeChatLogin(entity);
                    ResultObj _result = MemberLoginBLL.Instance.Login(unionid, "", "", (int)ClientTypeEnum.PC, IPAddress.IP);
                    if (_result != null && _result.Obj != null)
                    {
                        if (_result.Status == (int)CommonStatus.Success)
                        {
                            MemberLoginEntity _loginmodel = (MemberLoginEntity)_result.Obj;
                            if (_loginmodel.Status == (int)MemberStatus.Active)
                            {
                                CookieBLL.SetLoginCookie(_loginmodel, false);
                                CookieBLL.ComBineCart(1);
                                CookieBLL.ComBineCartXuQiu(1);
                                if (string.IsNullOrEmpty(returnurl))
                                {
                                    returnurl = SuperMarket.Core.ConfigCore.Instance.ConfigCommonEntity.MainWebUrl;
                                }
                                return(Redirect(returnurl));
                            }
                        }
                    }
                }
            }
            string tempcode = StringUtils.SafeCodeSmall(QueryString.SafeQNo("tempcode"));//临时自动登录

            if (!string.IsNullOrEmpty(tempcode))
            {
                ResultObj _resulttemp = MemberLoginBLL.Instance.LoginByTempCode(tempcode, unionid, (int)ClientTypeEnum.PC, IPAddress.IP);
                if (_resulttemp != null && _resulttemp.Obj != null)
                {
                    if (_resulttemp.Status == (int)CommonStatus.Success)
                    {
                        MemberLoginEntity _loginmodel = (MemberLoginEntity)_resulttemp.Obj;
                        if (_loginmodel.Status == (int)MemberStatus.Active)
                        {
                            CookieBLL.SetLoginCookie(_loginmodel, false);
                            CookieBLL.ComBineCart(1);
                            CookieBLL.ComBineCartXuQiu(1);
                            if (string.IsNullOrEmpty(returnurl))
                            {
                                returnurl = SuperMarket.Core.ConfigCore.Instance.ConfigCommonEntity.MainWebUrl;
                            }
                            return(Redirect(returnurl));
                        }
                    }
                }
            }

            ViewBag.ReturnUrl = returnurl;
            return(View());
        }