示例#1
0
        public ActionResult SaveUserInfo()
        {
            Return_Msg_APP result        = new Return_Msg_APP();
            string         password      = Utility.IO.Context.GetRequest("password", string.Empty);
            string         phone         = Utility.IO.Context.GetRequest("phone", string.Empty);
            string         code          = Utility.IO.Context.GetRequest("code", string.Empty);
            string         address       = Utility.IO.Context.GetRequest("address", string.Empty);
            string         sourcefrom    = Utility.IO.Context.GetRequest("sourcefrom", "");
            int            agentqrcodeid = Utility.IO.Context.GetRequestInt("agentqrcodeid", 0);

            result.isok = false;
            if (string.IsNullOrEmpty(phone))
            {
                result.Msg = "请输入手机号";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrEmpty(code))
            {
                result.Msg = "请输入验证码";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrEmpty(password))
            {
                result.Msg = "请输入密码";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            if (sourcefrom.Length > 20)
            {
                result.Msg = "无效来源";
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            if (!string.IsNullOrEmpty(phone))
            {
                Account tempaccout = AccountBLL.SingleModel.GetModelByPhone(phone);
                if (tempaccout != null)
                {
                    result.Msg = "该手机号已被注册";
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
            }

            //是否校验手机号,0检验,1不校验
            //校验验证码
            Return_Msg _msg = CommondHelper.CheckVaildCode(phone, code);

            result.isok    = _msg.isok;
            result.Msg     = _msg.Msg;
            result.code    = _msg.code;
            result.dataObj = _msg.dataObj;
            if (!result.isok)
            {
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            Account account = null;

            //如果是代理分销扫描注册,测判断绑定的手机号是否已经注册过账号,如果没有则注册一个账号
            if (agentqrcodeid > 0)
            {
                account = AccountBLL.SingleModel.GetModelByPhone(phone);
            }
            if (account == null)
            {
                account = AccountBLL.SingleModel.WeiXinRegister("", 0, "", true, address, phone, sourcefrom, password);
            }
            else
            {
                //修改已经注册过的用户信息
                AccountBLL.SingleModel.UpdateUserInfo(account.Id.ToString(), phone, password, address);
            }

            if (account != null)
            {
                //用户已绑定手机号,判断是否有单页版
                XcxAppAccountRelation usertemplate = _xcxAppAccountRelationBLL.GetModelByStringId(account.Id.ToString());
                if (usertemplate == null)
                {
                    //免费开通单页版
                    _xcxAppAccountRelationBLL.AddFreeTemplate(account);
                }

                //如果是扫分销代理码注册,则开通代理,
                if (agentqrcodeid > 0)
                {
                    result.Msg = _agentDistributionRelationBLL.CreateDistributionAgent(account.Id.ToString(), agentqrcodeid);
                    if (result.Msg.ToString() != "")
                    {
                        return(Json(result, JsonRequestBehavior.AllowGet));
                    }
                }

                result.isok = true;
                result.Msg  = "注册成功";
            }
            else
            {
                result.isok = false;
                result.Msg  = "注册失败";
            }
            string key = string.Format(_resetPasswordkey, phone);

            RedisUtil.Remove(key);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        /// <summary>
        /// 保存注册信息
        /// </summary>
        /// <returns></returns>
        public ActionResult SaveUserInfo()
        {
            Return_Msg data          = new Return_Msg();
            string     password      = Utility.IO.Context.GetRequest("password", string.Empty);
            string     phone         = Utility.IO.Context.GetRequest("phone", string.Empty);
            string     code          = Utility.IO.Context.GetRequest("code", string.Empty);
            string     address       = Utility.IO.Context.GetRequest("address", string.Empty);
            string     sourcefrom    = Utility.IO.Context.GetRequest("sourcefrom", "代理分销推广");
            int        agentqrcodeid = Utility.IO.Context.GetRequestInt("agentqrcodeid", 0);
            int        opentype      = Utility.IO.Context.GetRequestInt("opentype", 0);
            string     username      = Utility.IO.Context.GetRequest("username", "");
            string     appid         = Utility.IO.Context.GetRequest("appid", "");

            data.isok = false;
            //if (agentqrcodeid>0 && string.IsNullOrEmpty(username))
            //{
            //    _msg.Msg = "请输入姓名";
            //    return Json(_msg, JsonRequestBehavior.AllowGet);
            //}
            if (string.IsNullOrEmpty(phone))
            {
                data.Msg = "请输入手机号";
                return(Json(data));
            }
            if (string.IsNullOrEmpty(code))
            {
                data.Msg = "请输入验证码";
                return(Json(data));
            }
            if (string.IsNullOrEmpty(password))
            {
                data.Msg = "请输入密码";
                return(Json(data));
            }
            if (agentqrcodeid <= 0)
            {
                data.Msg = "参数错误";
                return(Json(data));
            }

            //是否校验手机号,0检验,1不校验
            //校验验证码
            data = CommondHelper.CheckVaildCode(phone, code);
            if (!data.isok)
            {
                return(Json(data));
            }
            Account account = AccountBLL.SingleModel.GetModelByPhone(phone);

            //如果是代理分销扫描注册,则判断绑定的手机号是否已经注册过账号,如果没有则注册一个账号
            if (account == null)
            {
                account = AccountBLL.SingleModel.WeiXinRegister("", 0, "", true, address, phone, sourcefrom, password);
            }
            else
            {
                //修改已经注册过的用户信息
                AccountBLL.SingleModel.UpdateUserInfo(account.Id.ToString(), phone, password, address);
            }

            if (account != null)
            {
                //用户已绑定手机号,判断是否有单页版
                XcxAppAccountRelation usertemplate = XcxAppAccountRelationBLL.SingleModel.GetModelByaccound(account.Id.ToString());
                if (usertemplate == null)
                {
                    //免费开通单页版
                    XcxAppAccountRelationBLL.SingleModel.AddFreeTemplate(account);
                }

                //如果是扫分销代理码注册,则开通代理,
                AgentDistributionRelationBLL agentDistributionRelationBLL = new AgentDistributionRelationBLL();
                data.Msg = agentDistributionRelationBLL.CreateDistributionAgent(account.Id.ToString(), agentqrcodeid, opentype, username);
                if (data.Msg != "")
                {
                    return(Json(data));
                }

                data.isok = true;
                data.Msg  = "注册成功";
            }
            else
            {
                data.isok = false;
                data.Msg  = "注册失败";
            }
            string key = string.Format(_resetPasswordkey, phone);

            RedisUtil.Remove(key);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public ActionResult SaveUserInfo()
        {
            string password      = Utility.IO.Context.GetRequest("password", string.Empty);
            string phone         = Utility.IO.Context.GetRequest("phone", string.Empty);
            string code          = Utility.IO.Context.GetRequest("code", string.Empty);
            string address       = Utility.IO.Context.GetRequest("address", string.Empty);
            string sourcefrom    = Utility.IO.Context.GetRequest("sourcefrom", "");
            int    agentqrcodeid = Utility.IO.Context.GetRequestInt("agentqrcodeid", 0);
            int    opentype      = Utility.IO.Context.GetRequestInt("opentype", 0);
            string username      = Utility.IO.Context.GetRequest("username", "");

            _msg.isok = false;
            //if (agentqrcodeid>0 && string.IsNullOrEmpty(username))
            //{
            //    _msg.Msg = "请输入姓名";
            //    return Json(_msg, JsonRequestBehavior.AllowGet);
            //}
            if (string.IsNullOrEmpty(phone))
            {
                _msg.Msg = "请输入手机号";
                return(Json(_msg, JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrEmpty(code))
            {
                _msg.Msg = "请输入验证码";
                return(Json(_msg, JsonRequestBehavior.AllowGet));
            }
            if (string.IsNullOrEmpty(password))
            {
                _msg.Msg = "请输入密码";
                return(Json(_msg, JsonRequestBehavior.AllowGet));
            }

            if (sourcefrom.Length > 20)
            {
                _msg.Msg = "无效来源";
                return(Json(_msg, JsonRequestBehavior.AllowGet));
            }
            if (!string.IsNullOrEmpty(phone))
            {
                Account tempaccout = AccountBLL.SingleModel.GetModelByPhone(phone);
                if (tempaccout != null)
                {
                    _msg.Msg = "该手机号已被注册";
                    return(Json(_msg, JsonRequestBehavior.AllowGet));
                }
            }


            //是否校验手机号,0检验,1不校验
            //校验验证码
            _msg = CommondHelper.CheckVaildCode(phone, code);
            if (!_msg.isok)
            {
                return(Json(_msg, JsonRequestBehavior.AllowGet));
            }
            Account account = null;

            //如果是代理分销扫描注册,测判断绑定的手机号是否已经注册过账号,如果没有则注册一个账号
            if (agentqrcodeid > 0)
            {
                sourcefrom = "代理分销推广";
                account    = AccountBLL.SingleModel.GetModelByPhone(phone);
            }
            if (account == null)
            {
                account = AccountBLL.SingleModel.WeiXinRegister("", 0, "", true, address, phone, sourcefrom, password);
            }
            else
            {
                //修改已经注册过的用户信息
                AccountBLL.SingleModel.UpdateUserInfo(account.Id.ToString(), phone, password, address);
            }

            if (account != null)
            {
                //用户已绑定手机号,判断是否有单页版
                XcxAppAccountRelation usertemplate = XcxAppAccountRelationBLL.SingleModel.GetModelByaccound(account.Id.ToString());
                if (usertemplate == null)
                {
                    //免费开通单页版
                    XcxAppAccountRelationBLL.SingleModel.AddFreeTemplate(account);
                }

                //如果是扫分销代理码注册,则开通代理,
                if (agentqrcodeid > 0)
                {
                    //判断是否是代理商
                    Agentinfo agentinfo = AgentinfoBLL.SingleModel.GetModelByAccoundId(account.Id.ToString(), -1);
                    if (agentinfo != null)
                    {
                        _msg.isok = true;
                        _msg.Msg  = "注册失败,该号码已绑定了代理商账号";
                        return(Json(_msg, JsonRequestBehavior.AllowGet));
                    }

                    _msg.Msg = _agentDistributionRelationBLL.CreateDistributionAgent(account.Id.ToString(), agentqrcodeid, opentype, username);
                    if (_msg.Msg != "")
                    {
                        return(Json(_msg, JsonRequestBehavior.AllowGet));
                    }
                }

                _msg.isok = true;
                _msg.Msg  = "注册成功";
            }
            else
            {
                _msg.isok = false;
                _msg.Msg  = "注册失败";
            }
            string key = string.Format(_resetPasswordkey, phone);

            RedisUtil.Remove(key);

            return(Json(_msg, JsonRequestBehavior.AllowGet));
        }