Esempio n. 1
0
        public JsonResult Skip(string serviceProvider, string openId, string nickName, string realName, string headimgurl, Entities.MemberOpenIdInfo.AppIdTypeEnum appidtype = Entities.MemberOpenIdInfo.AppIdTypeEnum.Normal, string unionid = null, string sex = null, string city = null, string province = null)
        {
            int    num      = 0;
            string username = DateTime.Now.ToString("yyMMddHHmmssffffff");   //TODO:DZY[150916]未使用,在方法内会重新生成

            nickName   = System.Web.HttpUtility.UrlDecode(nickName);
            realName   = System.Web.HttpUtility.UrlDecode(realName);
            headimgurl = System.Web.HttpUtility.UrlDecode(headimgurl);
            province   = System.Web.HttpUtility.UrlDecode(province);
            city       = System.Web.HttpUtility.UrlDecode(city);
            Entities.MemberInfo memberInfo = _iMemberService.GetMemberByUnionIdOpenId(unionid, openId);
            if (memberInfo == null)
            {
                memberInfo = _iMemberService.QuickRegister(username, realName, nickName, serviceProvider, openId, PlatformType.GetHashCode(),
                                                           unionid, sex, headimgurl, appidtype, null, city, province, spreadId: CurrentSpreadId);
                //TODO:ZJT  在用户注册的时候,检查此用户是否存在OpenId是否存在红包,存在则添加到用户预存款里
                _iBonusService.DepositToRegister(memberInfo.Id);
                //用户注册的时候,检查是否开启注册领取优惠券活动,存在自动添加到用户预存款里
                if (memberInfo.IsNewAccount)
                {
                    num = CouponApplication.RegisterSendCoupon(memberInfo.Id, memberInfo.UserName);
                }
                ClearDistributionSpreadCookie();
                _iMemberService.AddIntegel(memberInfo); //给用户加积分//执行登录后初始化相关操作
            }

            base.SetUserLoginCookie(memberInfo.Id);
            Application.MemberApplication.UpdateLastLoginDate(memberInfo.Id);
            WebHelper.SetCookie(CookieKeysCollection.HIMALL_ACTIVELOGOUT, "0", DateTime.MaxValue);

            #region 判断是否强制绑定手机号
            MemberApplication.UpdateLastLoginDate(memberInfo.Id);
            var isBind = MessageApplication.IsOpenBindSms(memberInfo.Id);
            if (!isBind)
            {
                return(Json <dynamic>(success: false, data: new { num = num }, code: 99));
            }
            #endregion

            return(Json <dynamic>(success: true, data: new { num = num }));
        }
Esempio n. 2
0
        public JsonResult BindUser(string username, string password, string headimgurl, string serviceProvider, string openId, Entities.MemberOpenIdInfo.AppIdTypeEnum appidtype = Entities.MemberOpenIdInfo.AppIdTypeEnum.Normal, string unionid = null, string sex = null, string city = null, string province = null, string country = null, string nickName = null)
        {
            var service = _iMemberService;
            var member  = service.Login(username, password);

            if (member == null)
            {
                throw new Mall.Core.MallException("用户名和密码不匹配");
            }

            //Log.Debug("BindUser unionid=" + (string.IsNullOrWhiteSpace(unionid) ? "null" : unionid));
            headimgurl = System.Web.HttpUtility.UrlDecode(headimgurl);
            nickName   = System.Web.HttpUtility.UrlDecode(nickName);
            city       = System.Web.HttpUtility.UrlDecode(city);
            province   = System.Web.HttpUtility.UrlDecode(province);
            OAuthUserModel model = new OAuthUserModel()
            {
                AppIdType     = appidtype,
                UserId        = member.Id,
                LoginProvider = serviceProvider,
                OpenId        = openId,
                Headimgurl    = headimgurl,
                UnionId       = unionid,
                Sex           = sex,
                NickName      = nickName,
                City          = city,
                Province      = province
            };

            service.BindMember(model);
            base.SetUserLoginCookie(member.Id);
            WebHelper.SetCookie(CookieKeysCollection.Mall_ACTIVELOGOUT, "0", DateTime.MaxValue);
            SellerLoginIn(username, password);
            BizAfterLogin.Run(member.Id);//执行登录后初始化相关操作

            return(Json(new { success = true }));
        }