示例#1
0
        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));
        }