Esempio n. 1
0
        /// <summary>
        ///一键登录
        /// </summary>
        /// <returns></returns>
        public JsonResult <Result <dynamic> > GetQuickLogin(string openId = "", string nickName = "", string headImage = "", long?spreadId = null)
        {
            var    wxuserinfo = ApiHelper.GetAppletUserInfo(Request);
            string unionid    = string.Empty;

            if (wxuserinfo != null)
            {
                unionid = wxuserinfo.unionId;
            }
            string unionopenid = "";

            if (!string.IsNullOrEmpty(openId))
            {
                headImage = System.Web.HttpUtility.UrlDecode(headImage);
                nickName  = System.Web.HttpUtility.UrlDecode(nickName);
                string username = DateTime.Now.ToString("yyMMddHHmmssffffff");
                var    member   = ServiceProvider.Instance <IMemberService> .Create.QuickRegister(username, string.Empty, nickName, SmallProgServiceProvider, openId, (int)PlatformType.WeiXinSmallProg, unionid, unionopenid : unionopenid, headImage : headImage, spreadId : spreadId);

                if (member != null)
                {
                    //TODO:ZJT  在用户注册的时候,检查此用户是否存在OpenId是否存在红包,存在则添加到用户预存款里
                    BonusApplication.DepositToRegister(member.Id);
                    //用户注册的时候,检查是否开启注册领取优惠券活动,存在自动添加到用户预存款里
                    if (member.IsNewAccount)
                    {
                        CouponApplication.RegisterSendCoupon(member.Id, member.UserName);
                    }
                }
                return(GetMember(member, openId));
            }
            return(Json(ErrorResult <dynamic>(string.Empty)));
        }
Esempio n. 2
0
        public JsonResult Skip(string oauthId, string openId, string nickName, string unionid = null, string unionopenid = null)
        {
            string username   = DateTime.Now.ToString("yyMMddHHmmssffffff");
            var    memberInfo = _iMemberService.QuickRegister(username, string.Empty, nickName, oauthId, openId, (int)PlatformType.PC, unionid, unionopenid: unionopenid);

            if (memberInfo != null)
            {
                //TODO:ZJT  在用户注册的时候,检查此用户是否存在OpenId是否存在红包,存在则添加到用户预存款里
                BonusApplication.DepositToRegister(memberInfo.Id);
                //用户注册的时候,检查是否开启注册领取优惠券活动,存在自动添加到用户预存款里
                if (memberInfo.IsNewAccount)
                {
                    CouponApplication.RegisterSendCoupon(memberInfo.Id, memberInfo.UserName);
                }
            }
            base.SetUserLoginCookie(memberInfo.Id);
            Application.MemberApplication.UpdateLastLoginDate(memberInfo.Id);

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