Example #1
0
    protected void SetAuthenPhoneBtn_Click(object sender, EventArgs e)
    {
        LoginPassword = Request["LoginPassword"];
        Phone         = Request["Phone"];
        AuthenCode    = Request["AuthenCode"];
        CheckCode     = Request["CheckCode"];

        // 校验LoginPassword

        try
        {
            if (!CommonUtility.ValidateValidateCode(HttpUtility.HtmlDecode(CheckCode), this.Context))
            {
                errorHint.InnerHtml = "<script type='text/javascript'>showError('验证码校验未通过!')</script>";
                return;
            }
            else
            {
                string webpwd = CryptographyUtil.Encrypt(LoginPassword);
                int    i      = FindPwd.SelState(CustID, webpwd, out ErrMsg);
                if (i != 0)
                {
                    errorHint.InnerHtml = "<script type='text/javascript'>  $('#LoginPassword').attr('value','" + LoginPassword + "');$('#Phone').attr('value','" + Phone + "');$('#AuthenCode').attr('value','" + AuthenCode + "');$('#CheckCode').attr('value','" + CheckCode + "');showError('登录密码输入错误,请重新输入!')</script>";
                    return;
                }
                else
                {
                    Result = PhoneBO.SelSendSMSMassage(CustID, Phone, AuthenCode, out ErrMsg);   // 校验手机验证码
                    if (Result == 0)
                    {
                        Result = PhoneBO.PhoneSetV2(SPID, CustID, Phone, "2", "2", out ErrMsg);
                        if (Result == 0)
                        {
                            //跳转
                            errorHint.InnerHtml = "<script type='text/javascript'>showError('认证手机设置成功!')</script>";
                            //Response.Redirect("m.114yg.cn",true);
                            return;
                        }
                        else
                        {
                            errorHint.InnerHtml = "<script type='text/javascript'>showError('" + ErrMsg + "!')</script>";
                            return;
                        }
                    }
                    else
                    {
                        errorHint.InnerHtml = "<script type='text/javascript'>showError('" + ErrMsg + "!')</script>";
                        return;
                    }
                }
            }
        }
        catch (Exception exp)
        {
            errorHint.InnerHtml = "<script type='text/javascript'>showError('" + exp.ToString() + "!')</script>";
            return;
        }
    }
Example #2
0
    protected void register_Click(object sender, EventArgs e)
    {
        string mobile    = this.mobile.Text;
        string checkCode = this.checkCode.Text;
        string password  = this.password.Text;
        string password2 = this.password2.Text;

        //判断手机验证码
        if (checkCode != null && !"".Equals(checkCode))
        {
            Result = PhoneBO.SelSendSMSMassage("", mobile, checkCode, out ErrMsg);
            if (Result != 0)
            {
                errorHint.InnerHtml = "手机验证码错误,请重新输入";
                return;
            }
        }

        Result = UserRegistry.quickUserRegistryWeb(SPID, password, mobile, "2", out CustID, out ErrMsg);
        if (Result != 0)
        {
            CommonBizRules.ErrorHappenedRedircet(Result, ErrMsg, "用户注册", this.Context);
            return;
        }

        SPInfoManager spInfo = new SPInfoManager();
        Object        SPData = spInfo.GetSPData(this.Context, "SPData");
        string        key    = spInfo.GetPropertyBySPID(SPID, "SecretKey", SPData);

        string Digest = CryptographyUtil.GenerateAuthenticator(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg, key);
        string temp   = SPID + "$" + CryptographyUtil.Encrypt(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg + "$" + Digest, key);
        string RegistryResponseValue = HttpUtility.UrlEncode(temp);

        log(String.Format("key:{0},Digest:{1},temp:{2},RegistryResponseValue:{3}", key, Digest, temp, RegistryResponseValue));
        //给用户写cookie
        UserToken UT   = new UserToken();
        string    key2 = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);

        string RealName = mobile;
        string UserName = mobile;
        string NickName = mobile;

        //                                           CustID, RealName, UserName, NickName, OuterID, CustType, string LoginAuthenName, string LoginAuthenType,string key, out string ErrMsg
        string UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, "", "42", UserName, "1", key2, out ErrMsg);
        string CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];

        PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);

        //通知积分平台
        CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg);
        //记登录日志
        CommonBizRules.WriteDataCustAuthenLog(SPID, CustID, "35", "0", "", "2", Result, ErrMsg);

        Response.Redirect(ReturnUrl + "?RegistryResponse=" + RegistryResponseValue, true);
    }
    protected void register_Click(object sender, EventArgs e)
    {
        Int32  Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
        String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;


        //判断手机验证码
        if (checkCode != null && !"".Equals(checkCode))
        {
            Result = PhoneBO.SelSendSMSMassage("", this.mobile.Text, checkCode, out ErrMsg);
            if (Result != 0)
            {
                hintCode.InnerHtml = "手机验证码错误,请重新输入";  // 这里如何控制样式
                return;
            }
        }


        //String realName,String contactTel,String sex,String certtype,String certnum,
        Result = BesttoneAccountHelper.RegisterBesttoneAccount(this.mobile.Text, realName, this.contactTel.Text, contactMail, sex, this.certtype.Value, certnum, TransactionID, out ErrMsg);
        if (Result == 0)
        {
            log(String.Format("开户结果:{0},{1},{2}", Result, ErrMsg, this.myCustID.Value));
            // todo 建立绑定关系,插入绑定关系表
            int ret = 0;

            ret = UserRegistry.CreateBesttoneAccount(SPID, this.myCustID.Value, this.mobile.Text, out ErrMsg);
            if (ret == 0)
            {
                log(String.Format("绑定结果:ret:{0},ErrMsg:{1},ReturnUrl:{2}", ret, ErrMsg, ReturnUrl));


                Response.Redirect(this.myReturnUrl.Value);
            }
            else
            {
                log(String.Format("绑定结果:{0},{1}", ret, ErrMsg));
                Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
            }
        }
        else
        {
            log(String.Format("开户结果:{0},{1}", Result, ErrMsg));
            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
        }
    }
Example #4
0
    /// <summary>
    /// 作者:赵锐
    /// 日期:2009年8月15日
    /// </summary>
    public void setMobile()
    {
        string ErrMsg = "";
        string mnum   = HttpUtility.HtmlDecode(Request.QueryString["mnum"].ToString());
        string auth   = HttpUtility.HtmlDecode(Request.QueryString["auth"].ToString());
        string custid = HttpUtility.HtmlDecode(Request.QueryString["custid"].ToString());
        string spid   = HttpUtility.HtmlDecode(Request.QueryString["spid"].ToString());
        string pwd    = HttpUtility.HtmlDecode(Request.QueryString["pwd"].ToString());
        string webpwd = CryptographyUtil.Encrypt(pwd);
        int    i      = FindPwd.SelState(custid, webpwd, out ErrMsg); // 根据custid和webpwd 校验客户身份是否合法性

        if (!ValidateValidateCode())                                  //校验页面验证码
        {
            Response.Write("验证码错误,请重新输入");
            return;
        }
        else
        {
            if (i != 0)
            {
                Response.Write("登录密码输入错误,请重新输入");
                return;
            }
            else
            {
                k = PhoneBO.SelSendSMSMassage(custid, mnum, auth, out msg);   // 校验手机验证码
                if (k == 0)
                {
                    //int y = PhoneBO.PhoneSet(spid, custid, mnum, "2", "2", out msg);
                    int y = PhoneBO.PhoneSetV2(spid, custid, mnum, "2", "2", out msg);
                    Response.Write(k);
                }
                else
                {
                    Response.Write(msg);
                }
            }
        }
    }
Example #5
0
    protected void RestPasswordByPhoneBtn_Click(object sender, ImageClickEventArgs e)
    {
        SPID = Request["SPID"] == null ? String.Empty : Request["SPID"].ToString();

        if ("35433334".Equals(SPID))
        {
            ReturnUrl = "http://www.114yg.cn/userCenterAction.do?actions=intoUserLogin";
        }
        else
        {
            ReturnUrl = "http://sso.118114.cn/SSO/loginV2.action";
        }
        this.hdReturnUrl.Value = ReturnUrl;
        AuthenPhone            = Request["AuthenPhone"];
        SmsAuthenCode          = Request["AuthenCode"];
        if (!String.IsNullOrEmpty(AuthenPhone))
        {
            this.hdAuthenPhone.Value = AuthenPhone;
        }
        if (!String.IsNullOrEmpty(SmsAuthenCode))
        {
            this.hdAuthenCode.Value = SmsAuthenCode;
        }


        AuthenPhone   = this.hdAuthenPhone.Value;
        SmsAuthenCode = this.hdAuthenCode.Value;
        ReturnUrl     = this.hdReturnUrl.Value;
        String        CustID = "";
        StringBuilder sbLog  = new StringBuilder();

        sbLog.AppendFormat("AuthenPhone:{0}\r\n", AuthenPhone);
        sbLog.AppendFormat("SmsAuthenCode:{0}\r\n", SmsAuthenCode);
        try
        {
            CustID = PhoneBO.IsAuthenPhone(AuthenPhone, SPID, out ErrMsg);
            sbLog.AppendFormat("CustID:{0}\r\n", CustID);
            sbLog.AppendFormat("ErrMsg:{0}\r\n", ErrMsg);
            if (!String.IsNullOrEmpty(CustID))
            {
                Result = PhoneBO.SelSendSMSMassage(CustID, AuthenPhone, SmsAuthenCode, out ErrMsg);
                sbLog.AppendFormat("SelSendSMSMassage:Result:{0}-{1}\r\n", Result, ErrMsg);
                if (Result == 0)
                {
                    Response.Redirect("ResetPwdByPhone.aspx?UrlParam=" + CustID + "$2$" + ReturnUrl, false);
                }
                else
                {
                    CommonBizRules.SuccessRedirect("../ErrorInfo.aspx", "找回密码失败:" + ErrMsg, HttpContext.Current);
                }
            }
            else
            {
                CommonBizRules.SuccessRedirect("../ErrorInfo.aspx", "该手机号码不是认证手机,找回密码失败:" + ErrMsg, HttpContext.Current);
            }
        }
        catch (Exception ex)
        {
            sbLog.AppendFormat("异常:{0}\r\n", ex.Message);
        }
        finally
        {
            log(sbLog.ToString());
        }
    }
    protected void register_Click(object sender, EventArgs e)
    {
        StringBuilder strLog = new StringBuilder();

        try
        {
            ParseSPTokenRequest();
            //CreateSPTokenRequest();

            Int32  Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
            String ErrMsg = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;
            realName = Request["realName"];
            //contactMail = Request["contactMail"];
            sex       = Request["sex"];
            certnum   = Request["certnum"];
            checkCode = Request["checkCode"];
            CustID    = this.myCustID.Value;
            strLog.AppendFormat("开户页面手机验证码:{0}", checkCode);

            //判断手机验证码
            if (checkCode != null && !"".Equals(checkCode))
            {
                Result = PhoneBO.SelSendSMSMassage("", this.mobile.Text, checkCode, out ErrMsg);
                if (Result != 0)
                {
                    hintCode.InnerHtml = "手机验证码错误,请重新输入";  // 这里如何控制样式

                    return;
                }
            }

            string BindedBestpayAccount          = "";
            string CreateTime                    = "";
            int    IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(this.myCustID.Value, out BindedBestpayAccount, out CreateTime, out ErrMsg);
            if (IsBesttoneAccountBindV5Result == 0)
            {
                Response.Redirect("ErrorInfo.aspx?ErrorInfo=该账户绑定关系未解除,请联系管理人员!");
            }

            TransactionID = BesttoneAccountHelper.CreateTransactionID();
            AccountItem ai           = new AccountItem();
            string      ResponseCode = "";
            int         QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(this.mobile.Text, out ai, out ResponseCode, out ErrMsg);
            strLog.AppendFormat("查询账户信息返回:{0},{1},{2}", QueryBesttoneAccountResult, ErrMsg, this.mobile.Text);
            if (QueryBesttoneAccountResult == 0)
            {
                if ("200010".Equals(ResponseCode))  // 200010 -> 客户不存在
                {
                    //todo 发起开户请求日志
                    UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, this.myCustID.Value, this.mobile.Text, out ErrMsg);
                    strLog.AppendFormat("BeforeCreateBesttoneAccount:ErrMsg:{0}", ErrMsg);
                    //String realName,String contactTel,String sex,String certtype,String certnum,
                    Result = BesttoneAccountHelper.RegisterBesttoneAccount(this.mobile.Text, realName, this.mobile.Text, "", sex, "1", certnum, TransactionID, out ErrMsg);
                    if (Result == 0)
                    {
                        strLog.AppendFormat("开户结果:{0},{1},{2}", Result, ErrMsg, this.myCustID.Value);
                        // todo 建立绑定关系,插入绑定关系表
                        int ret = 0;

                        ret = UserRegistry.CreateBesttoneAccount(SPID, this.myCustID.Value, this.mobile.Text, out ErrMsg);
                        strLog.AppendFormat("CreateBesttoneAccount:ErrMsg:{0}", ErrMsg);
                        if (ret == 0)
                        {
                            //todo 开户完成 建立绑定关系 日志
                            UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, this.myCustID.Value, this.mobile.Text, out ErrMsg);
                            strLog.AppendFormat("AfterCreateBesttoneAccount:ErrMsg:{0}", ErrMsg);
                            strLog.AppendFormat("绑定结果:ret:{0},ErrMsg:{1},ReturnUrl:{2}", ret, ErrMsg, ReturnUrl);

                            int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, this.myCustID.Value, realName, certnum, out ErrMsg);
                            strLog.AppendFormat("回写客户信息结果:retWriteBack:{0},ErrMsg:{1}", retWriteBack, ErrMsg);

                            strLog.AppendFormat("SPTokenRequest={0}", SPTokenRequest);
                            strLog.AppendFormat("Redirect to Url:{0}", "OpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0");
                            Response.Redirect("OpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0");
                        }
                        else
                        {
                            strLog.AppendFormat("绑定结果:{0},{1}", ret, ErrMsg);
                            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                        }
                    }
                    else
                    {
                        strLog.AppendFormat("开户结果:{0},{1}", Result, ErrMsg);
                        Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                    }
                }
                else  // 账户已存在
                {
                    // todo 建立绑定关系,插入绑定关系表
                    UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, this.myCustID.Value, this.mobile.Text, out ErrMsg);
                    strLog.AppendFormat("OnlyBindingBesttoneAccount:ErrMsg:{0}", ErrMsg);
                    int ret = 0;

                    ret = UserRegistry.CreateBesttoneAccount(SPID, this.myCustID.Value, this.mobile.Text, out ErrMsg);
                    if (ret == 0)
                    {
                        int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, this.myCustID.Value, realName, certnum, out ErrMsg);
                        strLog.AppendFormat("回写客户信息结果:retWriteBack:{0},ErrMsg:{1}", retWriteBack, ErrMsg);
                        strLog.AppendFormat("绑定结果:ret:{0},ErrMsg:{1},ReturnUrl:{2}", ret, ErrMsg, ReturnUrl);
                        strLog.AppendFormat(String.Format("SPTokenRequest={0}", SPTokenRequest));
                        Response.Redirect("OpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0");
                        //Response.Redirect(this.myReturnUrl.Value);
                    }
                    else
                    {
                        strLog.AppendFormat("绑定结果:{0},{1}", ret, ErrMsg);
                        Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                    }
                }
            }
            else
            {
                strLog.AppendFormat("查询账户信息返回:{0},{1},{2}", QueryBesttoneAccountResult, ErrMsg, this.mobile.Text);
                Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
            }
        }
        catch (System.Exception ex)
        {
            log(ex.ToString());
        }
        finally
        {
            log(strLog.ToString());
        }
    }
Example #7
0
    public String RegisterInLowstingHttp(String SPID, String UserName, String PassWord, String PassWord2, String Device, String ShareCode, String wt)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        #region 数据校验
        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(UserName))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "UserName不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "UserName不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(AuthenCode))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "AuthenCode不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "AuthenCode不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        String t_CustID = String.Empty;
        String msg      = String.Empty;
        int    k        = PhoneBO.SelSendSMSMassage(t_CustID, UserName, AuthenCode, out msg);
        if (k != 0)
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "验证码不正确!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "验证码不正确!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        String regMobile = @"^1[345678]\d{9}$";
        //String regEmail = @"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$";
        //String RegularUserName = @"^[a-zA-Z][a-zA-Z0-9]*([-._]?[a-zA-Z0-9]+)*$";
        if (!ValidateUserName(UserName, regMobile))
        //if (!ValidateUserName(UserName, RegularUserName))
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "991");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "UserName只能是手机号码!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "991");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "UserName只能是手机号码!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(PassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "PassWord不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "PassWord不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(PassWord2))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "PassWord2不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "PassWord2不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (!PassWord.Equals(PassWord2))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1001");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "密码不一致!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1001");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "密码不一致!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        #endregion

        String appId       = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;
        String appSecret   = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret;
        String version     = UDBConstDefinition.DefaultInstance.UnifyPlatformVersion;
        String clientType  = UDBConstDefinition.DefaultInstance.UnifyPlatformClientType;
        String clientIp    = HttpContext.Current.Request.UserHostAddress;
        String clientAgent = HttpContext.Current.Request.UserAgent;
        String sendSms     = UDBConstDefinition.DefaultInstance.UnifyPlatformRegisterAccountSendSms;
        if (String.IsNullOrEmpty(sendSms))
        {
            sendSms = "false";
        }

        //综合平台隐式注册只支持手机,也就是说,用户名模式,放弃注册为天翼账号,仅注册为号百用户
        //既有用户名又有手机的,放弃注册天翼账号
        String Unify_ErrMsg = String.Empty;
        String userId       = String.Empty;
        String o_userName   = String.Empty;
        String accessToken  = String.Empty;
        //msg.AppendFormat("注册天翼账号:\r\n");
        int Unify_Result = CIP2BizRules.RegisterUnifyPlatformAccount(appId, appSecret, version, clientType, clientIp, clientAgent, UserName, PassWord, sendSms, out userId, out o_userName, out accessToken, out Unify_ErrMsg);
        //msg.AppendFormat("注册天翼账号,Result:{0},accessToken:{1},userId:{2},usrName:{3},ErrMsg:{4}\r\n", Unify_Result, accessToken, userId, o_userName, Unify_ErrMsg);


        if (Unify_Result == 0 && !String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(accessToken))
        {
            //Result = UserRegistry.UserRegisterWebLowStintV3(SPID, UserName, PassWord, Device, ShareCode, out CustID, out ErrMsg);
            UDBMBOSS         _UDBMBoss   = new UDBMBOSS();
            UnifyAccountInfo accountInfo = new UnifyAccountInfo();
            Unify_Result = _UDBMBoss.UnifyPlatformGetUserInfo(appId, appSecret, version, clientType, accessToken, clientIp, clientAgent, out accountInfo, out Unify_ErrMsg);
            String OuterID, Status, CustType, CustLevel, NickName, Email, CertificateCode, CertificateType, Sex, RealName, EnterpriseID, ProvinceID, AreaID, RegistrationSource;

            if (Unify_Result == 0 && !String.IsNullOrEmpty(Convert.ToString(accountInfo.userId)))
            {
                String MobileName = String.Empty;
                String EmailName  = String.Empty;
                if (!String.IsNullOrEmpty(accountInfo.nickName))
                {
                    RealName = accountInfo.nickName;
                }
                else if (!String.IsNullOrEmpty(accountInfo.userName))
                {
                    RealName = accountInfo.userName;
                }
                else if (!String.IsNullOrEmpty(accountInfo.mobileName))
                {
                    RealName = accountInfo.mobileName;
                }
                else if (!String.IsNullOrEmpty(accountInfo.emailName))
                {
                    RealName = accountInfo.emailName;
                }
                else
                {
                    RealName = "";
                }
                if (!String.IsNullOrEmpty(accountInfo.mobileName))
                {
                    MobileName = accountInfo.mobileName;
                }
                if (!String.IsNullOrEmpty(accountInfo.emailName))
                {
                    EmailName = accountInfo.emailName;
                }
                String EncrytpPassWord = CryptographyUtil.Encrypt(PassWord);
                String OperType        = "2"; // 注册 ,

                if (!String.IsNullOrEmpty(MobileName) || !String.IsNullOrEmpty(EmailName))
                {
                    CustID = String.Empty;

                    Result = CIP2BizRules.BindCustInfoUnifyPlatform("02", "021", MobileName, EmailName, RealName, EncrytpPassWord, accountInfo.userId, SPID, OperType, out CustID, out ErrMsg);

                    if (Result == 0 && !String.IsNullOrEmpty(CustID))
                    {
                        Result = CustBasicInfo.getCustInfo(SPID, CustID, out ErrMsg, out OuterID, out Status, out CustType, out CustLevel, out RealName,
                                                           out UserName, out NickName, out CertificateCode, out CertificateType, out Sex, out Email, out EnterpriseID, out ProvinceID,
                                                           out AreaID, out RegistrationSource);
                        CommonBizRules.WriteTraceIpLog(CustID, UserName, SPID, Request.UserHostAddress.ToString(), "client_zc");

                        String youhuiquan_url = "http://www.114yg.cn/facadeHome.do?actions=facadeHome&method=sendCouponToShare&wt=json&from=" + Device + "&registerCustId=" + CustID;
                        String jsonmsg        = HttpMethods.HttpGet(youhuiquan_url);
                        System.Collections.Generic.Dictionary <string, string> resuzt = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Collections.Generic.Dictionary <string, string> >(jsonmsg);
                        //{"returnCode":"00000"}
                        string youhuiquan = "";
                        resuzt.TryGetValue("returnCode", out youhuiquan);
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                            ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", CustID);
                            ResponseMsg.AppendFormat("\"returnCode\":\"{0}\",", youhuiquan);
                            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "注册成功!");
                            ResponseMsg.Append("}");
                        }
                        else
                        {
                            ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                            ResponseMsg.Append("<PayPlatRequestParameter>");
                            ResponseMsg.Append("<PARAMETERS>");
                            ResponseMsg.AppendFormat("<CustID>{0}</CustID>", CustID);
                            ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                            ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "注册成功!");
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                        return(ResponseMsg.ToString());
                    }
                }
                else
                {
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-11");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "MobileName或EmailName为空不能注册天翼账号所以号百注册也失败!");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-11");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "MobileName或EmailName为空不能注册天翼账号所以号百注册也失败!!");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return(ResponseMsg.ToString());
                }
                //http://www.114yg.cn/facadeHome.do?actions=facadeHome&method=sendCouponToShare&wt=json&from=ios&registerCustId=134664179
                //"http://116.228.55.13:8113/facadeHome.do?actions=facadeHome&method=sendCouponToShare&wt=json&from=ios&registerCustId=
            }
            else
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-10");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "号百账号注册失败!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-10");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "号百账号注册失败!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }
        else
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-10");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "天翼账号注册失败!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-10");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "天翼账号注册失败!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        return(ResponseMsg.ToString());
    }
Example #8
0
    public String RegisterInLowstingHttp(String SPID, String UserName, String PassWord, String PassWord2, String Device, String wt)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        #region 数据校验
        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(UserName))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "UserName不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "UserName不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(AuthenCode))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "AuthenCode不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "AuthenCode不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        String t_CustID = String.Empty;
        String msg      = String.Empty;
        int    k        = PhoneBO.SelSendSMSMassage(t_CustID, UserName, AuthenCode, out msg);
        if (k != 0)
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "验证码不正确!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "验证码不正确!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        String regMobile       = @"^1[345678]\d{9}$";
        String regEmail        = @"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$";
        String RegularUserName = @"^[a-zA-Z][a-zA-Z0-9]*([-._]?[a-zA-Z0-9]+)*$";

        if (!ValidateUserName(UserName, regMobile))
        //if (!ValidateUserName(UserName, RegularUserName))
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "991");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "UserName只能是手机号码!");
                //ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "UserName不合乎规范!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "991");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "UserName只能是手机号码!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(PassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "PassWord不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "PassWord不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(PassWord2))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "PassWord2不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "PassWord2不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (!PassWord.Equals(PassWord2))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1001");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "密码不一致!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1001");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "密码不一致!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        //Result = CustBasicInfo.IsExistUser(UserName);

        //if (Result != 0)
        //{
        //    // 返回错误信息
        //    ResponseMsg.Length = 0;
        //    if ("json".Equals(wt))
        //    {
        //        ResponseMsg.Append("{");
        //        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1000");
        //        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "用户名已经存在!");
        //        ResponseMsg.Append("}");
        //    }
        //    else
        //    {
        //        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        //        ResponseMsg.Append("<PayPlatRequestParameter>");
        //        ResponseMsg.Append("<PARAMETERS>");
        //        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1000");
        //        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "用户名已经存在!");
        //        ResponseMsg.Append("</PARAMETERS>");
        //        ResponseMsg.Append("</PayPlatRequestParameter>");
        //    }
        //    return ResponseMsg.ToString();
        //}



        //验证码校验

        //if (!CommonUtility.ValidateValidateCode(HttpUtility.HtmlDecode(checkCode), this.Context))
        //{
        //hintError提示错误验证码校验未通过
        //errorHint.InnerHtml = "验证码校验未通过!";
        //return;
        //}


        #endregion



        String appId       = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;
        String appSecret   = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret;
        String version     = UDBConstDefinition.DefaultInstance.UnifyPlatformVersion;
        String clientType  = UDBConstDefinition.DefaultInstance.UnifyPlatformClientType;
        String clientIp    = HttpContext.Current.Request.UserHostAddress;
        String clientAgent = HttpContext.Current.Request.UserAgent;
        String sendSms     = UDBConstDefinition.DefaultInstance.UnifyPlatformRegisterAccountSendSms;
        if (String.IsNullOrEmpty(sendSms))
        {
            sendSms = "false";
        }

        //综合平台隐式注册只支持手机,也就是说,用户名模式,放弃注册为天翼账号,仅注册为号百用户
        //既有用户名又有手机的,放弃注册天翼账号
        String Unify_ErrMsg = String.Empty;
        String userId       = String.Empty;
        String o_userName   = String.Empty;
        String accessToken  = String.Empty;
        //msg.AppendFormat("注册天翼账号:\r\n");
        int Unify_Result = CIP2BizRules.RegisterUnifyPlatformAccount(appId, appSecret, version, clientType, clientIp, clientAgent, UserName, PassWord, sendSms, out userId, out o_userName, out accessToken, out Unify_ErrMsg);
        //msg.AppendFormat("注册天翼账号,Result:{0},accessToken:{1},userId:{2},usrName:{3},ErrMsg:{4}\r\n", Unify_Result, accessToken, userId, o_userName, Unify_ErrMsg);

        if (Unify_Result == 0 && !String.IsNullOrEmpty(userId) && !String.IsNullOrEmpty(accessToken))
        {
            Result = UserRegistry.UserRegisterWebLowStintV2(SPID, UserName, PassWord, Device, out CustID, out ErrMsg);
            if (Result == 0)
            {
                String IPAddress = Request.UserHostAddress.ToString();
                CommonBizRules.WriteTraceIpLog(CustID, UserName, SPID, IPAddress, "client_zc");

                String youhuiquan_url = "http://www.114yg.cn/facadeHome.do?actions=facadeHome&method=sendCouponToRegist&wt=json&from=" + Device + "&custId=" + CustID;
                String jsonmsg        = HttpMethods.HttpGet(youhuiquan_url);
                System.Collections.Generic.Dictionary <string, string> resuzt = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Collections.Generic.Dictionary <string, string> >(jsonmsg);
                //{"returnCode":"00000"}
                string youhuiquan = "";
                resuzt.TryGetValue("returnCode", out youhuiquan);

                //建立绑定关系  (待完成)
                //因暂时不支持lognum

                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                    ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", CustID);
                    ResponseMsg.AppendFormat("\"returnCode\":\"{0}\",", youhuiquan);
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "注册成功!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<CustID>{0}</CustID>", CustID);
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "注册成功!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
            else
            {
                // 账号注册失败
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-1");
                    ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", "");
                    ResponseMsg.AppendFormat("\"returnCode\":\"{0}\",", "");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "注册失败!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<CustID>{0}</CustID>", "");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-1");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "注册失败!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }
        else
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-11");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "天翼账号注册失败!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-11");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "天翼账号注册失败!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        return(ResponseMsg.ToString());
    }
Example #9
0
    protected void register_Click(object sender, EventArgs e)
    {
        Response.AddHeader("P3P", "CP=CAO PSA OUR");

        SPID      = Request["SPID"] == null ? ConstHelper.DefaultInstance.BesttoneSPID : HttpUtility.HtmlDecode(Request["SPID"]);
        ReturnUrl = Request["ReturnUrl"] == null ? ConstHelper.DefaultInstance.BesttoneLoginPage : HttpUtility.HtmlDecode(Request["ReturnUrl"]);

        log(String.Format("【Web注册】:SPID:{0},ReturnUrl:{1}", SPID, ReturnUrl));
        string password  = Request.Form["password"].ToString().Trim();
        string telephone = Request.Form["mobile"].ToString().Trim();
        string phonecode = Request.Form["checkCode"].ToString().Trim();

        log(String.Format("mobile:{0},password:{1},phonecode:{2}", telephone, password, phonecode));
        string ErrMsg = "";
        int    Result;


        if (CommonUtility.IsEmpty(password))
        {
            hintPassword.InnerHtml = "密码不能为空格"; // 这里如何控制样式
            return;
        }

        if (ViewState["phonestate"] == null)
        {
            ViewState["phonestate"] = Request.Form["phonestate"].ToString();
            string a = (string)ViewState["phonestate"];
        }

        if (((string)ViewState["phonestate"]).Equals("0"))
        {
            //判断手机验证码
            Result = PhoneBO.SelSendSMSMassage("", telephone, phonecode, out ErrMsg);
            if (Result != 0)
            {
                hintCode.InnerHtml = "手机验证码错误,请重新输入";  // 这里如何控制样式
                return;
            }
        }

        TimeStamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        Result    = UserRegistry.quickUserRegistryWeb(SPID, password, telephone, (string)ViewState["phonestate"], out CustID, out ErrMsg);
        if (Result != 0)
        {
            CommonBizRules.ErrorHappenedRedircet(Result, ErrMsg, "用户注册", this.Context);
            return;
        }

        SPInfoManager spInfo = new SPInfoManager();
        Object        SPData = spInfo.GetSPData(this.Context, "SPData");
        string        key    = spInfo.GetPropertyBySPID(SPID, "SecretKey", SPData);
        string        Digest = CryptographyUtil.GenerateAuthenticator(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg, key);
        string        temp   = SPID + "$" + CryptographyUtil.Encrypt(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg + "$" + Digest, key);
        string        RegistryResponseValue = HttpUtility.UrlEncode(temp);

        log(String.Format("key:{0},Digest:{1},temp:{2},RegistryResponseValue:{3}", key, Digest, temp, RegistryResponseValue));
        //给用户写cookie
        UserToken UT   = new UserToken();
        string    key2 = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);

        string RealName = telephone;
        string UserName = telephone;
        string NickName = telephone;

        //                                           CustID, RealName, UserName, NickName, OuterID, CustType, string LoginAuthenName, string LoginAuthenType,string key, out string ErrMsg
        string UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, "", "42", UserName, "1", key2, out ErrMsg);
        string CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];

        PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);

        //通知积分平台
        CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg);
        //记登录日志
        CommonBizRules.WriteDataCustAuthenLog(SPID, CustID, "35", "0", "", "2", Result, ErrMsg);

        log(String.Format("【返回之前】:SPID:{0},ReturnUrl:{1}", SPID, ReturnUrl));


        string hid_openAccount = Request.Form["hid_openAccount"].ToString().Trim();

        log(String.Format("开户选项:{0}", hid_openAccount));



        if (ReturnUrl.IndexOf("?") > 0)
        {
            if ("1".Equals(hid_openAccount))
            {
                // 这里要 跳回 调用方,并告知 CreateBesttoneAccount.aspx,让其重定向到该地址
                //Response.Write(" <A   id= 'kh '   href= 'CreateBesttoneAccount.aspx?mobile=" + telephone + "&ReturnUrl=" + ReturnUrl + "'   target= '_top '> </A> <script language='javascript' type='text/javascript'> document.getElementById('kh').click(); </script> ");
                //return;
                //Response.Redirect("CreateBesttoneAccount.aspx?mobile=" + telephone + "&ReturnUrl=" + ReturnUrl);
                Response.Redirect(ReturnUrl + "&RegistryResponse=" + RegistryResponseValue + "&registBesttoneAccount=true", true);
            }
            else
            {
                Response.Redirect(ReturnUrl + "&RegistryResponse=" + RegistryResponseValue, true);
            }


            //Response.Redirect(ReturnUrl  + "&RegistryResponse=" + RegistryResponseValue, true);
            //CommonBizRules.SuccessRedirect(ReturnUrl + "&RegistryResponse=" + RegistryResponseValue, "成功注册", this.Context);
        }
        else
        {
            if ("1".Equals(hid_openAccount))
            {
                // 这里要 跳回 调用方,并告知 CreateBesttoneAccount.aspx,让其重定向到该地址
                //Response.Write(" <A   id= 'kh '   href= 'CreateBesttoneAccount.aspx?mobile=" + telephone + "&ReturnUrl=" + ReturnUrl + "'   target= '_top '> </A> <script language='javascript' type='text/javascript'> document.getElementById('kh').click(); </script> ");
                //return;
                //Response.Redirect("CreateBesttoneAccount.aspx?mobile=" + telephone + "&ReturnUrl=" + ReturnUrl);
                Response.Redirect(ReturnUrl + "?RegistryResponse=" + RegistryResponseValue + "&registBesttoneAccount=true", true);
            }
            else
            {
                Response.Redirect(ReturnUrl + "?RegistryResponse=" + RegistryResponseValue, true);
            }

            //CommonBizRules.SuccessRedirect(ReturnUrl + "?RegistryResponse=" + RegistryResponseValue, "成功注册", this.Context);
        }
    }
Example #10
0
    protected void register_Click(object sender, EventArgs e)
    {
        StringBuilder strLog = new StringBuilder();

        try
        {
            logger.Info("RegisterAllInOne-注册来源:" + HttpContext.Current.Request.RawUrl);
            Response.AddHeader("P3P", "CP=CAO PSA OUR");
            strLog.AppendFormat("----------------------注册事件开始:------------------\r\n");
            strLog.AppendFormat("SPID:{0}\r\n", SPID);
            strLog.AppendFormat("ReturnUrl:{0}\r\n", ReturnUrl);
            PassWord = Request.Form["password"].ToString().Trim();
            strLog.AppendFormat("PassWord:{0}\r\n", PassWord);
            Mobile = Request.Form["mobile"].ToString().Trim();
            strLog.AppendFormat("mobile:{0}\r\n", Mobile);
            CheckPhoneCode = Request.Form["checkCode"].ToString().Trim();
            strLog.AppendFormat("checkCode:{0}\r\n", CheckPhoneCode);
            Email    = Request.Form["email"].ToString().Trim();
            UserName = Request.Form["userName"].ToString().Trim();

            strLog.AppendFormat("ViewState[phonestate]:{0}\r\n", ViewState["phonestate"]);
            strLog.AppendFormat("Request.Form[phonestate]:{0}\r\n", Request.Form["phonestate"]);
            if (ViewState["phonestate"] == null)
            {
                ViewState["phonestate"] = Request.Form["phonestate"].ToString();
                string a = (string)ViewState["phonestate"];
            }

            if (((string)ViewState["phonestate"]).Equals("0"))
            {
                strLog.AppendFormat("phonestate==0\r\n");
                //判断手机验证码
                string needCheckCode = "0";  //ConfigurationManager.AppSettings["needCheckCode"];
                strLog.AppendFormat("判断手机验证码\r\n");
                //strLog.AppendFormat("needCheckCode:{0}\r\n}", needCheckCode);
                if ("0".Equals(needCheckCode))
                {
                    //strLog.AppendFormat("needCheckCode==0");
                    Result = PhoneBO.SelSendSMSMassage("", Mobile, CheckPhoneCode, out ErrMsg);
                    if (Result != 0)
                    {
                        strLog.AppendFormat("手机验证码验证错误\r\n");
                        hintCode.InnerHtml = "手机验证码错误,请重新输入";  // 这里如何控制样式
                        return;
                    }
                    strLog.AppendFormat("手机验证码验证无误\r\n");
                }
                //strLog.AppendFormat("does not needCheckCode:{0}\r\n}", needCheckCode);
            }
            //strLog.AppendFormat("phonestate!=0 \r\n");
            strLog.AppendFormat("-----------------quickUserRegistryWeb  begin------------------\r\n");
            Result = UserRegistry.quickUserRegistryWebV3(SPID, PassWord, Mobile, (string)ViewState["phonestate"], UserName, Email, out CustID, out ErrMsg);
            if (Result != 0)
            {
                strLog.AppendFormat("注册失败!\r\n");
                CommonBizRules.ErrorHappenedRedircet(Result, ErrMsg, "用户注册", this.Context);
                return;
            }

            strLog.AppendFormat("注册成功!\r\n");
            //短信通知
            // string VoicePwdSPID = System.Configuration.ConfigurationManager.AppSettings["VoicePwd_SPID"];
            // int SIP1 = VoicePwdSPID.IndexOf(SPID);
            String SMS_Message = String.Empty;
            // if (SIP1 >= 0)
            //  {
            SMS_Message = "恭喜您成为号码百事通会员!请妥善保管您的密码;如需帮助请联系:4008-118114。";
            //通知短信网关
            //CommonBizRules.SendMessageV3(Mobile, SMS_Message, SPID);   //2013-11-19 注释掉
            //   }

            strLog.AppendFormat("检查邮箱是否需要发送\r\n");
            if (!String.IsNullOrEmpty(Email))
            {
                SendEmail(CustID, Email);
            }

            strLog.AppendFormat("写Cookie\r\n");
            String        TimeStamp             = DateTime.Now.ToString("yyyy-MM-dd HH:ta:ss");
            SPInfoManager spInfo                = new SPInfoManager();
            Object        SPData                = spInfo.GetSPData(this.Context, "SPData");
            String        key                   = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
            String        Digest                = CryptographyUtil.GenerateAuthenticator(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg, key);
            String        temp                  = SPID + "$" + CryptographyUtil.Encrypt(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg + "$" + Digest, key);
            String        RegistryResponseValue = HttpUtility.UrlEncode(temp);

            //给用户写cookie
            UserToken UT             = new UserToken();
            String    RealName       = Mobile;
            String    NickName       = Mobile;
            string    UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, "", "42", UserName, "1", key, out ErrMsg);
            string    CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
            PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);
            //通知积分平台
            //strLog.AppendFormat("通知积分平台,CustID:{0}\r\n", CustID);

            CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg);
            strLog.AppendFormat("写入数据库日志\r\n");
            //记登录日志
            CommonBizRules.WriteDataCustAuthenLog(SPID, CustID, "35", "0", "", "2", Result, ErrMsg);
            strLog.AppendFormat("-----------------quickUserRegistryWeb  end------------------\r\n");

            strLog.AppendFormat("是否开户\r\n");
            strLog.AppendFormat("--------------------openBestToneAccount begin------------------------\r\n");
            String hid_openAccount = Request.Form["hid_openAccount"].ToString().Trim();
            //strLog.AppendFormat("hid_openAccount:{0}\r\n", hid_openAccount);
            if ("1".Equals(hid_openAccount))
            {
                strLog.AppendFormat("hid_openAccount==1 需要开户\r\n");
                // 开户要做的事情  需要前面注册获得的custID
                string BindedBestpayAccount = "";
                string CreateTime           = "";
                strLog.AppendFormat("先查看该CustID:{0}头上是否有账户\r\n", CustID);
                int IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg);
                //strLog.AppendFormat("查看结果:IsBesttoneAccountBindV5Result:{0},BindedBestpayAccount:{1},CreateTime:{2},ErrMsg:{3}\r\n", IsBesttoneAccountBindV5Result, BindedBestpayAccount, CreateTime, ErrMsg);
                if (IsBesttoneAccountBindV5Result == 0)
                {
                    //strLog.AppendFormat("IsBesttoneAccountBindV5Result==0,该CustID:{0}头上有账户BindedBestpayAccount:{1}\r\n", CustID, BindedBestpayAccount);
                    Response.Redirect("ErrorInfo.aspx?ErrorInfo=该账户绑定关系未解除,请联系管理人员!");
                }
                strLog.AppendFormat("该CustID:{0}头上无绑定账户\r\n", CustID);
                String      TransactionID = BesttoneAccountHelper.CreateTransactionID();
                AccountItem ai            = new AccountItem();
                string      ResponseCode  = "";
                BestToneAccount = Request.Form["mobile"].ToString().Trim();
                //strLog.AppendFormat("开户账号:{0}\r\n", BestToneAccount);
                realName = Request.Form["realName"].ToString().Trim();
                //strLog.AppendFormat("realName:{0}\r\n", realName);
                certnum = Request.Form["certnum"].ToString().Trim();
                //strLog.AppendFormat("certnum:{0}\r\n", certnum);
                strLog.AppendFormat("去翼支付查看该账号是否已经存在\r\n");
                int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(BestToneAccount, out ai, out ResponseCode, out ErrMsg);
                //strLog.AppendFormat("查看结果 QueryBesttoneAccountResult:{0},ResponseCode:{1},ErrMsg:{2}\r\n", QueryBesttoneAccountResult, ResponseCode, ErrMsg);
                if (QueryBesttoneAccountResult == 0)
                {
                    if ("200010".Equals(ResponseCode))   // 未开户
                    {
                        strLog.AppendFormat("200010-未开户\r\n");
                        strLog.AppendFormat("准备开户\r\n");
                        //strLog.AppendFormat("开户前日志参数:SPID:{0},TransactionID:{1},CustID:{2},BestToneAccount:{3}\r\n", SPID, TransactionID, BestToneAccount);
                        UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg);
                        //strLog.AppendFormat("日志结果 ErrMsg:{0} \r\n", ErrMsg);
                        strLog.AppendFormat("开户...\r\n");

                        Result = BesttoneAccountHelper.RegisterBesttoneAccount(BestToneAccount, realName, BestToneAccount, "", sex, "1", certnum, TransactionID, out ErrMsg);
                        //strLog.AppendFormat("开户结果:Result:{0},ErrMsg:{1},TransactionID:{2}\r\n", Result, ErrMsg, TransactionID);
                        if (Result == 0)
                        {
                            //strLog.AppendFormat("开户成功\r\n,准备去将账户{0}绑定到{1}上\r\n", BestToneAccount, CustID);
                            int BindResult = UserRegistry.CreateBesttoneAccount(SPID, CustID, BestToneAccount, out ErrMsg);
                            //strLog.AppendFormat("绑定结果:BindResult:{0},ErrMsg:{1}上\r\n", BindResult, ErrMsg);
                            if (BindResult == 0)
                            {
                                strLog.AppendFormat("开户后日志\r\n");
                                UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg);
                                int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, certnum, out ErrMsg);
                                //strLog.AppendFormat("开户后日志结果:ErrMsg:{0}\r\n", ErrMsg);
                                Response.Redirect("NewOpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0&RegistryResponse=" + HttpUtility.UrlEncode(RegistryResponseValue), true);
                            }
                            else
                            {
                                Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                            }
                        }
                        else
                        {
                            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                        }
                    }
                    else
                    {
                        // 账户已存在
                        strLog.AppendFormat("账户已经存在\r\n");
                        strLog.AppendFormat("仅仅做绑定\r\n");
                        UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg);

                        int BindResult = UserRegistry.CreateBesttoneAccount(SPID, CustID, BestToneAccount, out ErrMsg);
                        //strLog.AppendFormat("绑定结果:ErrMsg:{0}\r\n", ErrMsg);
                        if (BindResult == 0)
                        {
                            UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg);
                            int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, certnum, out ErrMsg);
                            Response.Redirect("NewOpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0&RegistryResponse=" + HttpUtility.UrlEncode(RegistryResponseValue), true);
                        }
                        else
                        {
                            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                        }
                    }
                }
                else
                {
                    Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                }
            }
            //不需要开户
            //这里应该先到一个结果页面,并将ReturnUrl传给结果页面,结果页面倒计时3秒后自动跳转到ReturnUrl,根据注册和开户跳转到不同的结果页面
            if (ReturnUrl.IndexOf("?") > 0)
            {
                Response.Redirect(ReturnUrl + "&RegistryResponse=" + RegistryResponseValue, false);
            }
            else
            {
                Response.Redirect(ReturnUrl + "?RegistryResponse=" + RegistryResponseValue, false);
            }
        }
        catch (Exception ex)
        {
            strLog.AppendFormat(ex.ToString());
            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ex.ToString());
        }
        finally
        {
            log(strLog.ToString());
        }
    }
Example #11
0
    protected void btn_OK_Click(object sender, EventArgs e)
    {
        if (CertificateType.Value != "")
        {
            certno.Style.Value  = "display:block";
            certnoL.Style.Value = "display:block";
        }
        else
        {
            certno.Style.Value  = "display:none";
            certnoL.Style.Value = "display:none";
        }
        this.areaInfoList.Value = resulttxt.Value.ToString();
        SPID      = Request["SPID"] == null ? ConstHelper.DefaultInstance.BesttoneSPID : HttpUtility.HtmlDecode(Request["SPID"]);
        ReturnUrl = Request["ReturnUrl"] == null ? ConstHelper.DefaultInstance.BesttoneLoginPage : HttpUtility.HtmlDecode(Request["ReturnUrl"]);

        string username = Request.Form["username"].ToString().Trim();
        string fullname = Request.Form["fullname"].ToString().Trim();
        string password = Request.Form["password"].ToString().Trim();

        if (CommonUtility.IsEmpty(password))
        {
            err_password.InnerHtml = "密码不能为空格";
            return;
        }
        string telephone = Request.Form["telephone"].ToString().Trim();
        string phonecode = Request.Form["phone_code"].ToString().Trim();

        if (ViewState["phonestate"] == null)
        {
            ViewState["phonestate"] = Request.Form["phonestate"].ToString();
            string a = (string)ViewState["phonestate"];
        }

        string email            = Request.Form["email"].ToString().Trim();
        string NickName         = Request.Form["NickName"].ToString();
        string CertificateType1 = Request.Form["CertificateType"].ToString();
        string certnoS          = Request.Form["certno"].ToString().Trim();
        string sex         = Request.Form["sex"].ToString();
        string birthday    = Request.Form["birthday"].ToString().Trim();
        string EduLevel    = Request.Form["EduLevel"].ToString().Trim();
        string IncomeLevel = Request.Form["IncomeLevel"].ToString();
        string Province    = stext.Value.ToString();
        string Area        = resulttxt.Value.ToString();
        string ErrMsg      = "";
        int    Result;

        //判断用户名是否存在
        if (CustBasicInfo.IsExistUser(username) != 0)
        {
            err_username.InnerHtml = "该用户名已经存在";

            return;
        }


        if (((string)ViewState["phonestate"]).Equals("0"))
        {
            //判断手机验证码
            Result = PhoneBO.SelSendSMSMassage("", telephone, phonecode, out ErrMsg);
            if (Result != 0)
            {
                err_phone_code.InnerHtml = "手机验证码错误,请重新输入";

                return;
            }

            //判断页面验证码
            if (!CommonUtility.ValidateValidateCode(HttpUtility.HtmlDecode(Request.Form["page_code"].ToString().Trim().ToUpper()), this.Context))
            {
                err_page_code.InnerHtml = "页面验证码错误,请重新输入";

                return;
            }
        }

        //当为认证邮箱时,判断是否已经被绑定
        if (Chk_Mail.Checked && !CommonUtility.IsEmpty(email))
        {
            Result = SetMail.EmailSel("", email, SPID, out ErrMsg);
            if (Result != 0)
            {
                err_email.InnerHtml = "该邮箱已经被其他用户绑定";

                return;
            }
            emailstate = "0";
        }

        TimeStamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        Result    = UserRegistry.getUserRegistryWeb(SPID, username, fullname, password, telephone, (string)ViewState["phonestate"], email, emailstate,
                                                    NickName, CertificateType1, certnoS, sex, birthday, EduLevel, IncomeLevel, Province, Area, out CustID, out ErrMsg);
        if (Result != 0)
        {
            //跳转至错误页面
            if (Result == -30002)
            {
                Err_certno.InnerHtml = ErrMsg;
            }
            else
            {
                CommonBizRules.ErrorHappenedRedircet(Result, ErrMsg, "用户注册", this.Context);
            }

            return;
        }

        SPInfoManager spInfo = new SPInfoManager();
        Object        SPData = spInfo.GetSPData(this.Context, "SPData");
        string        key    = spInfo.GetPropertyBySPID(SPID, "SecretKey", SPData);
        string        Digest = CryptographyUtil.GenerateAuthenticator(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg, key);
        string        temp   = SPID + "$" + CryptographyUtil.Encrypt(TimeStamp + "$" + CustID + "$" + Result + "$" + ErrMsg + "$" + Digest, key);
        string        RegistryResponseValue = HttpUtility.UrlEncode(temp);

        //给用户写cookie
        UserToken UT             = new UserToken();
        string    key2           = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
        string    UserTokenValue = UT.GenerateUserToken(CustID, fullname, username, NickName, "", "42", username, "1", key2, out ErrMsg);
        string    CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];

        PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);

        //给客户认证邮箱发EMAIL
        string m   = CommonBizRules.EncryptEmailURl(CustID, email, this.Context);
        string url = "点击完成认证:<a href='" + m + "'>" + m + "</a>";

        if (Chk_Mail.Checked && !CommonUtility.IsEmpty(email))
        {
            DateTime datetime = DateTime.Now;
            SetMail.InsertEmailSendMassage(CustID, "1", url, "", 1, email, datetime, "", "中国电信号码百事通:激活邮箱", 0, out ErrMsg);
        }

        //通知积分平台
        CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg);
        //记登录日志
        CommonBizRules.WriteDataCustAuthenLog(SPID, CustID, "35", "0", "", "2", Result, ErrMsg);

        //跳转至成功页面
        if (ReturnUrl.IndexOf("?") > 0)
        {
            CommonBizRules.SuccessRedirect(ReturnUrl + "&RegistryResponse=" + RegistryResponseValue, "成功注册", this.Context);
        }
        else
        {
            CommonBizRules.SuccessRedirect(ReturnUrl + "?RegistryResponse=" + RegistryResponseValue, "成功注册", this.Context);
        }
    }
Example #12
0
    public String SetAuthenPhone(String SPID, String CustID, String Phone, String AuthenCode)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        #region

        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(CustID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(Phone))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "Phone不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "Phone不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(AuthenCode))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "AuthenCode不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "AuthenCode不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        #endregion

        try
        {
            String msg    = String.Empty;
            int    Result = PhoneBO.SelSendSMSMassage(CustID, Phone, AuthenCode, out msg); // 校验手机验证码
            if (Result == 0)
            {
                Result = PhoneBO.PhoneSetV2(SPID, CustID, Phone, "2", "2", out msg);
            }
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", Result);
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", msg);
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", Result);
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", msg);
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        catch (Exception ecp)
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-1000");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ecp.ToString());
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-1000");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ecp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
    }
    public String FindBackPassWordByMobile(String SPID, String Phone, String AuthenCode, String PassWord)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        #region
        if (CommonUtility.IsEmpty(SPID))
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        //if (CommonUtility.IsEmpty(CustID))
        //{

        //    ResponseMsg.Length = 0;
        //    if ("json".Equals(wt))
        //    {
        //        ResponseMsg.Append("{");
        //        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
        //        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
        //        ResponseMsg.Append("}");
        //    }
        //    else
        //    {
        //        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        //        ResponseMsg.Append("<PayPlatRequestParameter>");
        //        ResponseMsg.Append("<PARAMETERS>");
        //        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
        //        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
        //        ResponseMsg.Append("</PARAMETERS>");
        //        ResponseMsg.Append("</PayPlatRequestParameter>");
        //    }
        //    return ResponseMsg.ToString();
        //}

        if (CommonUtility.IsEmpty(Phone))
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "Phone不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "Phone不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(AuthenCode))
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "AuthenCode不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "AuthenCode不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (String.IsNullOrEmpty(PassWord))
        {
            PassWord = "******";
        }

        #endregion
        try
        {
            String t_custid = PhoneBO.IsAuthenPhone(Phone, SPID, out ErrMsg);
            if (String.IsNullOrEmpty(t_custid))
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "验证手机有误!手机未注册");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "验证手机有误!手机未注册");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }

            //if (!CustID.Equals(t_custid))
            //{

            //    ResponseMsg.Length = 0;
            //    if ("json".Equals(wt))
            //    {
            //        ResponseMsg.Append("{");
            //        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "993");
            //        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "客户CustID和验证手机有误");
            //        ResponseMsg.Append("}");
            //    }
            //    else
            //    {
            //        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            //        ResponseMsg.Append("<PayPlatRequestParameter>");
            //        ResponseMsg.Append("<PARAMETERS>");
            //        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "993");
            //        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "客户CustID和验证手机有误");
            //        ResponseMsg.Append("</PARAMETERS>");
            //        ResponseMsg.Append("</PayPlatRequestParameter>");
            //    }
            //    return ResponseMsg.ToString();
            //}

            //验证码校验
            Result = PhoneBO.SelSendSMSMassage(t_custid, Phone, AuthenCode, out ErrMsg);
            if (Result != 0)
            {
                //Result.ErrMsg = "验证码验证失败:" + Result.ErrMsg;
                //return Result;

                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "992");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "验证码验证失败");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "992");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "验证码验证失败");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }

            //修改密码
            Result             = PassWordBO.SetPassword(SPID, t_custid, PassWord, "2", "", out ErrMsg);
            ResponseMsg.Length = 0;
            if (Result == 0)
            {
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "密码重置成功!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "密码重置成功!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
            else
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-2508");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "密码重置失败");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-2508");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "密码重置失败");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }
        catch (Exception exp)
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-2508");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "密码重置失败" + exp.ToString());
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-2508");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "密码重置失败" + exp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        return(ResponseMsg.ToString());
    }
Example #14
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        StringBuilder strLog = new StringBuilder();
        String        Url    = "";

        try
        {
            PassWord       = Request.Form["password"].ToString().Trim();
            Mobile         = Request.Form["mobile"].ToString().Trim();
            CheckPhoneCode = Request.Form["checkCode"].ToString().Trim();
            strLog.AppendFormat("接收到password:{0},Mobile:{1},CheckPhoneCode:{2}\r\n", PassWord, Mobile, CheckPhoneCode);


            string UserName = "";
            string Email    = "";

            if (ViewState["phonestate"] == null)
            {
                strLog.AppendFormat("phonestate=null\r\n");
                ViewState["phonestate"] = Request.Form["phonestate"].ToString();
                string a = (string)ViewState["phonestate"];
            }
            if (((string)ViewState["phonestate"]).Equals("0"))
            {
                Result = PhoneBO.SelSendSMSMassage("", Mobile, CheckPhoneCode, out ErrMsg);
                if (Result != 0)
                {
                    strLog.AppendFormat("手机验证码校验未通过!\r\n");
                    return;
                }
            }

            strLog.AppendFormat("手机验证码校验通过!\r\n");
            Result = UserRegistry.quickUserRegistryWebV4(SPID, PassWord, Mobile, (string)ViewState["phonestate"], UserName, Email, Device, out CustID, out ErrMsg);
            if (Result != 0)
            {
                strLog.AppendFormat("注册失败!\r\n");
                return;
            }
            strLog.AppendFormat("注册成功!CustID:{0}\r\n", CustID);
            String hid_openAccount = Request.Form["hid_openAccount"].ToString().Trim();
            if ("1".Equals(hid_openAccount))
            {
                strLog.AppendFormat("开户过程\r\n");
                string BindedBestpayAccount = "";
                string CreateTime           = "";

                int IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg);
                if (IsBesttoneAccountBindV5Result == 0)
                {
                    Response.Redirect("ErrorInfo.aspx?ErrorInfo=该账户绑定关系未解除,请联系管理人员!");
                }
                String      TransactionID   = BesttoneAccountHelper.CreateTransactionID();
                AccountItem ai              = new AccountItem();
                string      ResponseCode    = "";
                string      BestToneAccount = Request.Form["mobile"].ToString().Trim();
                realName = Request.Form["realName"].ToString().Trim();
                certnum  = Request.Form["certnum"].ToString().Trim();
                int QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(BestToneAccount, out ai, out ResponseCode, out ErrMsg);
                if (QueryBesttoneAccountResult == 0)
                {
                    if ("200010".Equals(ResponseCode))   // 未开户
                    {
                        strLog.AppendFormat("该号码未开过户:\r\n");
                        UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg);
                        Result = BesttoneAccountHelper.RegisterBesttoneAccount(BestToneAccount, realName, BestToneAccount, "", sex, "1", certnum, TransactionID, out ErrMsg);
                        if (Result == 0)
                        {
                            strLog.AppendFormat("开户成功:\r\n");
                            int BindResult = UserRegistry.CreateBesttoneAccount(SPID, CustID, BestToneAccount, out ErrMsg);
                            if (BindResult == 0)
                            {
                                UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg);
                                int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, certnum, out ErrMsg);
                                //
                                //Response.Redirect("NewOpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0&RegistryResponse=" + HttpUtility.UrlEncode(RegistryResponseValue), true);
                            }
                            else
                            {
                                Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                            }
                        }
                        else
                        {
                            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                        }
                    }
                    else
                    {
                        UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg);
                        int BindResult = UserRegistry.CreateBesttoneAccount(SPID, CustID, BestToneAccount, out ErrMsg);
                        if (BindResult == 0)
                        {
                            UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, BestToneAccount, out ErrMsg);
                            int retWriteBack = UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, realName, certnum, out ErrMsg);
                            //Response.Redirect("NewOpenAccountResult.aspx?SPTokenRequest=" + HttpUtility.UrlEncode(SPTokenRequest) + "&CreateBesttoneAccountResult=0&RegistryResponse=" + HttpUtility.UrlEncode(RegistryResponseValue), true);
                        }
                        else
                        {
                            Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                        }
                    }
                }
                else
                {
                    Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                }
            }

            if (ReturnUrl.IndexOf("?") > 0)
            {
                Url = ReturnUrl + "&CustID=" + CustID + "&welcomeName=" + Mobile;
            }
            else
            {
                Url = ReturnUrl + "?CustID=" + CustID + "&welcomeName=" + Mobile;
            }

            Response.Redirect(Url, true);
        }
        catch (Exception ex)
        {
            strLog.AppendFormat(ex.ToString());
        }
        finally
        {
            log(strLog.ToString());
        }
    }
Example #15
0
    public String UserRegisterClient(String SPID, String AuthenPhone, String Password, String Email, String Sex, String RealName, String Device)
    {
        StringBuilder ResponseMsg = new StringBuilder();

        #region 数据校验

        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(AuthenPhone))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "AuthenPhone不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "AuthenPhone不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        Result = PhoneBO.SelSendSMSMassage("", AuthenPhone, CheckPhoneCode, out ErrMsg);
        if (Result != 0)
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "手机验证码验证错误!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "手机验证码验证错误!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        String T_CustID = String.Empty;

        if (!CommonBizRules.HasBesttoneAccount(this.Context, AuthenPhone, out T_CustID, out ErrMsg))
        {
            if (!String.IsNullOrEmpty(T_CustID))
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "990");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", AuthenPhone + "该手机号码已经被别的客户作为号码百事通账户!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "990");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", AuthenPhone + "该手机号码已经被别的客户作为号码百事通账户!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }
        #endregion

        #region   开始注册

        try
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandTimeout = 15;
            cmd.CommandType    = CommandType.StoredProcedure;
            cmd.CommandText    = "dbo.up_Customer_V3_Interface_UserRegistryClient"; // 不带RegistrationSouce参数
            //cmd.CommandText = "dbo.up_Customer_V3_Interface_UserRegistryClientV2";   // 带RegistrationSouce参数  2.0后做

            int RegistrationSouce = 2; // 默认是web注册

            if ("android".Equals(Device))
            {
                RegistrationSouce = 11;  // 客户端 且 android
            }

            if ("ios".Equals(Device))
            {
                RegistrationSouce = 12;  // 客户端 且 ios
            }

            SqlParameter parSPID = new SqlParameter("@SPID", SqlDbType.VarChar, 8);
            parSPID.Value = SPID;
            cmd.Parameters.Add(parSPID);

            SqlParameter parUserType = new SqlParameter("@UserType", SqlDbType.VarChar, 2);
            parUserType.Value = "42";
            cmd.Parameters.Add(parUserType);

            SqlParameter parPassword = new SqlParameter("@Password", SqlDbType.VarChar, 50);
            if (String.IsNullOrEmpty(Password))
            {
                parPassword.Value = CryptographyUtil.Encrypt("111111");
            }
            else
            {
                parPassword.Value = CryptographyUtil.Encrypt(Password);
            }
            cmd.Parameters.Add(parPassword);


            SqlParameter parUProvinceID = new SqlParameter("@UProvinceID", SqlDbType.VarChar, 2);
            parUProvinceID.Value = "02";
            cmd.Parameters.Add(parUProvinceID);

            SqlParameter parAreaCode = new SqlParameter("@AreaCode", SqlDbType.VarChar, 6);
            parAreaCode.Value = "021";
            cmd.Parameters.Add(parAreaCode);

            SqlParameter parRealName = new SqlParameter("@RealName", SqlDbType.VarChar, 50);
            if (String.IsNullOrEmpty("RealName"))
            {
                parRealName.Value = "";
            }
            else
            {
                parRealName.Value = RealName;
            }
            cmd.Parameters.Add(parRealName);

            SqlParameter parUserName = new SqlParameter("@UserName", SqlDbType.VarChar, 50);
            if (String.IsNullOrEmpty(UserName))
            {
                parUserName.Value = "";
            }
            else
            {
                parUserName.Value = UserName;
            }
            cmd.Parameters.Add(parUserName);

            SqlParameter parAuthenPhone = new SqlParameter("@AuthenPhone", SqlDbType.VarChar, 15);
            parAuthenPhone.Value = AuthenPhone;
            cmd.Parameters.Add(parAuthenPhone);

            SqlParameter parEmail = new SqlParameter("@Email", SqlDbType.VarChar, 20);
            if (String.IsNullOrEmpty(Email))
            {
                parEmail.Value = Email;
            }
            else
            {
                parEmail.Value = "";
            }
            cmd.Parameters.Add(parEmail);


            //SqlParameter parRegistrationSource = new SqlParameter("@RegistrationSource", SqlDbType.Int);
            //parRegistrationSource.Value = RegistrationSouce;
            //cmd.Parameters.Add(parRegistrationSource);

            SqlParameter parSex = new SqlParameter("@Sex", SqlDbType.VarChar, 1);
            if (String.IsNullOrEmpty(Sex))
            {
                parSex.Value = "2";
            }
            else
            {
                parSex.Value = Sex;
            }
            cmd.Parameters.Add(parSex);

            SqlParameter parResult = new SqlParameter("@Result", SqlDbType.Int);
            parResult.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(parResult);

            SqlParameter parErrMsg = new SqlParameter("@ErrMsg ", SqlDbType.VarChar, 256);
            parErrMsg.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(parErrMsg);

            SqlParameter paroCustID = new SqlParameter("@oCustID ", SqlDbType.VarChar, 16);
            paroCustID.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(paroCustID);

            DBUtility.Execute(cmd, DBUtility.BestToneCenterConStr);

            Result = int.Parse(parResult.Value.ToString());
            ErrMsg = parErrMsg.Value.ToString();
            CustID = paroCustID.Value.ToString();

            ResponseMsg.Length = 0;
            if (Result == 0)
            {
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", CustID);
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "注册成功!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "注册成功!");
                    ResponseMsg.AppendFormat("<CustID>{0}</CustID>", CustID);
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
            else
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-2508");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ErrMsg);
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-2508");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ErrMsg);
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
            }
        }
        catch (Exception exp)
        {
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-2508");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", exp.ToString());
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "-2508");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", exp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
        }
        #endregion



        return(ResponseMsg.ToString());
    }
    /// <summary>
    ///
    /// </summary>
    /// <param name="SPID"></param>
    /// <param name="CustID"></param>
    /// <param name="Phone"></param>
    /// <param name="CheckPhoneCode"></param>
    /// <param name="wt"></param>
    /// <returns></returns>
    public String OpenBesttoneAccount(String SPID, String CustID, String Phone, String IDCard, String RealName, String ContactTel, String Email, String Sex, String AuthenCode, String wt)
    {
        //返回参数
        String ErrMsg = String.Empty;
        Int32  Result = ErrorDefinition.CIP_IError_Result_UnknowError_Code;

        StringBuilder ResponseMsg = new StringBuilder();


        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "995");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "SPID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(CustID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "CustID不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "996");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "CustID不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(Phone))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "Phone不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "Phone不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(IDCard))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "IDCard不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "998");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "IDCard不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(RealName))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "RealName不能为空!");
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "999");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "RealName不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        //验证码校验
        Result = PhoneBO.SelSendSMSMassage(CustID, Phone, AuthenCode, out ErrMsg);
        if (Result != 0)
        {
            // 验证码未校验通过  return
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1000");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ErrMsg);
                ResponseMsg.Append("}");
            }
            else
            {
                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                ResponseMsg.Append("<PayPlatRequestParameter>");
                ResponseMsg.Append("<PARAMETERS>");
                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1000");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ErrMsg);
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        else
        {
            String t_custid = PhoneBO.IsAuthenPhone(Phone, SPID, out ErrMsg);
            // t_custid 可以为空,但不能是别人的custid,可以为空是说明此客户无认证电话
            if (!String.IsNullOrEmpty(t_custid))
            {
                if (CustID != t_custid)
                {
                    //是别人的手机号,不能用来开户  return
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1000");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", Phone + "(" + CustID + ")是别人的手机号(" + t_custid + "),不能用来开户!");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1000");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "是别人的手机号,不能用来开户!");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return(ResponseMsg.ToString());
                }
            }


            if (!CommonUtility.CheckIDCard(IDCard))
            {
                //身份证不合法! return
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1001");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "身份证不合法!");
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1001");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "身份证不合法!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }

            try
            {
                String             TransactionID        = CreateTransactionID();
                BesttoneAccountDAO _besttoneAccount_dao = new BesttoneAccountDAO();
                //strLog.AppendFormat("select * from besttoneaccount where custid={0}\r\n", CustID);
                BesttoneAccount besttoneAccountEntity = _besttoneAccount_dao.QueryByCustID(CustID);


                AccountItem ai = new AccountItem();
                String      QueryBAResponseCode = "";

                if (besttoneAccountEntity == null)   // 未绑定
                {
                    //去翼支付查
                    int QueryBesttoneAccountResult = QueryBesttoneAccount(Phone, out ai, out QueryBAResponseCode, out ErrMsg);

                    //if (QueryBesttoneAccountResult == 0)
                    //{
                    if ("200010".Equals(QueryBAResponseCode))                                                     // 未开户
                    {
                        UserRegistry.BeforeCreateBesttoneAccount(SPID, TransactionID, CustID, Phone, out ErrMsg); //日志
                        RegisterBesttoneAccount(Phone, RealName, ContactTel, Email, Sex, "1", IDCard, TransactionID, out ErrMsg);
                        UserRegistry.CreateBesttoneAccount(SPID, CustID, Phone, out ErrMsg);                      //建立绑定关系
                        UserRegistry.AfterCreateBesttoneAccount(SPID, TransactionID, CustID, Phone, out ErrMsg);  //日志
                        UserRegistry.WriteBackBestToneAccountToCustInfo(SPID, CustID, RealName, IDCard, out ErrMsg);
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "开户成功,绑定成功!");
                            ResponseMsg.Append("}");
                        }
                        else
                        {
                            ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                            ResponseMsg.Append("<PayPlatRequestParameter>");
                            ResponseMsg.Append("<PARAMETERS>");
                            ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                            ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "开户成功,绑定成功!");
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                        return(ResponseMsg.ToString());
                    }
                    else
                    {       //可能在开过户
                        if ("000000".Equals(QueryBAResponseCode))
                        {
                            //绑定操作
                            UserRegistry.CreateBesttoneAccount(SPID, CustID, Phone, out ErrMsg);
                            UserRegistry.OnlyBindingBesttoneAccount(SPID, TransactionID, CustID, Phone, out ErrMsg);

                            ResponseMsg.Length = 0;
                            if ("json".Equals(wt))
                            {
                                ResponseMsg.Append("{");
                                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
                                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "仅仅绑定成功!");
                                ResponseMsg.Append("}");
                            }
                            else
                            {
                                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                                ResponseMsg.Append("<PayPlatRequestParameter>");
                                ResponseMsg.Append("<PARAMETERS>");
                                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "0");
                                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "仅仅绑定成功!");
                                ResponseMsg.Append("</PARAMETERS>");
                                ResponseMsg.Append("</PayPlatRequestParameter>");
                            }
                            return(ResponseMsg.ToString());
                        }
                        else
                        {
                            //账户状态可能存在异常  return

                            ResponseMsg.Length = 0;
                            if ("json".Equals(wt))
                            {
                                ResponseMsg.Append("{");
                                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1002");
                                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "账户状态可能存在异常!");
                                ResponseMsg.Append("}");
                            }
                            else
                            {
                                ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                                ResponseMsg.Append("<PayPlatRequestParameter>");
                                ResponseMsg.Append("<PARAMETERS>");
                                ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1002");
                                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "账户状态可能存在异常!");
                                ResponseMsg.Append("</PARAMETERS>");
                                ResponseMsg.Append("</PayPlatRequestParameter>");
                            }
                            return(ResponseMsg.ToString());
                        }
                    }
                    //}
                    //else
                    //{
                    ////账户查询过程中发生异常  return
                    //ResponseMsg.Length = 0;
                    //if ("json".Equals(wt))
                    //{
                    //    ResponseMsg.Append("{");
                    //    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1003");
                    //    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "账户查询过程中发生异常!");
                    //    ResponseMsg.Append("}");
                    //}
                    //else
                    //{
                    //    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    //    ResponseMsg.Append("<PayPlatRequestParameter>");
                    //    ResponseMsg.Append("<PARAMETERS>");
                    //    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1003");
                    //    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "账户查询过程中发生异常!");
                    //    ResponseMsg.Append("</PARAMETERS>");
                    //    ResponseMsg.Append("</PayPlatRequestParameter>");
                    //}
                    //return ResponseMsg.ToString();
                    //}
                }
                else
                {
                    //该手机号码已经开过户,账户所绑定的custid不管是不是自己的,都不允许再开户
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1004");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "该手机号码已经开过户!");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1004");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "该手机号码已经开过户!");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return(ResponseMsg.ToString());
                }
            }
            catch (Exception ecp)
            {
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1005");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ecp.ToString());
                    ResponseMsg.Append("}");
                }
                else
                {
                    ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                    ResponseMsg.Append("<PayPlatRequestParameter>");
                    ResponseMsg.Append("<PARAMETERS>");
                    ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "1005");
                    ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ecp.ToString());
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }

        // 开户的前置条件
        //1.必须先登录(说明是合法号百客户,有CUSTID)
        //2.手机验证码校验  (如果是接口,仅校验手机验证码,如果是页面,则需校验页面验证码?)
        //3.检查手机号码是否是别人的登录账号 (登录后获得的custid和custphone 的custid比对)
        //4.验证身份证号是否合法
        //5.检查手机号码是否是别人的支付账户 (是否已经存在绑定关系,如果是,是否是绑定在自己的custid下)
        //6.去翼支付检查该手机号码是否开过户(直接调翼支付账户查询)

        //开户

        //IF 校验码未通过
        //    重定向到错误页面(如果是接口,则返回错误提示)
        //ELSE
        //      IF 根据PHONE 获得的CUSTID不是 登录CUSTID
        //           非法开户,重定向到错误页面 (如果是接口,则返回错误提示)  --
        //      ELSE
        //            IF PHONE 存在于账户绑定关系
        //    IF 账户对应的CUSTID 与登录后获得的CUSTID 不匹配   -- 说明该手机号码已经被别的客户开成账户了
        //           该手机号码已经被别的客户开成账户了,重定向到错误页面,如果是接口,则返回错误提示信息
        //                ELSE
        //                      该手机已经开过户,不需要再开户
        //    END
        //           ELSE
        //                     IF 翼支付没能能查到该手机的账户信息 --说明的确未开户
        //                              验证身份证号是否合法
        //                               开户 (调用翼支付开户接口)
        //                                插入绑定关系表
        //                     END
        //           END
        //       END
        //END
        return(ResponseMsg.ToString());
    }