Пример #1
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);
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder strLog = new StringBuilder();

        ParseSPTokenRequest();
        if (!IsPostBack)
        {
            strLog.AppendFormat("ChangePayPassword2-Page_Load");
            if (Result == 0)
            {
                strLog.AppendFormat(String.Format("CustID:{0},SPID{1},HeadFooter{2}", CustID, SPID, HeadFooter));
                if ("yes".Equals(HeadFooter))
                {
                    this.header.Visible = true;
                    this.footer.Visible = true;
                }
                else
                {
                    this.header.Visible = false;
                    this.footer.Visible = false;
                }

                string BindedBestpayAccount = "";
                string CreateTime           = "";
                IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg);
                if (IsBesttoneAccountBindV5Result == 0)
                {
                    if (!String.IsNullOrEmpty(BindedBestpayAccount))
                    {
                        BesttoneAccount = BindedBestpayAccount;
                    }
                }

                strLog.AppendFormat(String.Format("phoneNum:{0}", BesttoneAccount));
                oldPassWord     = Request.Form["oldPassWord"];
                newPassWord     = Request.Form["newPassWord"];
                confirmPassWord = Request.Form["confirmPassWord"];
            }
            else
            {
                Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
            }
            log(strLog.ToString());
        }
    }
Пример #3
0
    public int UnBindOrUnRegister = -1;  // 未绑定或者为开通账户 当该值为0时代表该用户为绑定或者未开通

    protected void Page_Load(object sender, EventArgs e)
    {
        ParseSPTokenRequest();
        if (Result == 0)
        {
            int QueryResult = CIP2BizRules.IsBesttoneAccountBindV3(CustID, out BesttoneAccount, out ErrMsg);
            if (QueryResult == BesttoneAccountStatus.UnBind_OR_UnRegister)
            {
                CreateNewSPTokenRequest();
                // 转到 绑定和开通混合页面
                Response.Redirect("BindingAndRegister.aspx?SPTokenRequest=" + newSPTokenRequest);
            }
            else
            {
                // 转到 账户中心页面
                Response.Redirect("BesttoneAccountMain.aspx?SPTokenReuest=" + SPTokenRequest);
            }
        }
    }
Пример #4
0
    protected void Button3_Click(object sender, EventArgs e)
    {
//        BTUCenterForCRM crm = new BTUCenterForCRM();
//        Linkage.BestTone.Interface.Rule.AuthenRecord[] res = new Linkage.BestTone.Interface.Rule.AuthenRecord[1];
//        Linkage.BestTone.Interface.Rule.AuthenRecord re = new Linkage.BestTone.Interface.Rule.AuthenRecord();
//        res[0] = re;


//        crm.CustInfoUpload("14", "5044876", "09", "8631591101012099", "1", "新华通讯社福建分社",
//"", "福州市华林路新华通讯社福建分社", "", "133582760310000001", "4", "591", "2", "", "1", res, "");

        string strMSG = "";

        //CIP2BizRules.InsertCustInfoNotify("10058", "0", "35888888", "yyyyy", "0", out strMSG);
        CIP2BizRules.newCardCustomerInfoExport("92", "10058", "0", "yyyyy", "0", out strMSG, "");
        ////BestToneUCenterForBizTour face = new BestToneUCenterForBizTour();
        ////face.PhoneBind("21", "35000000", "2009-10-10", "8600100680036000", "54545", "13857881111");
        //BestToneUCenterForBizTour ff = new BestToneUCenterForBizTour();
        //ff.PhoneBind("21","35000000","2009-10-10","8600100680036000","54545","13857881111");
    }
Пример #5
0
    public void updateCustInfo()
    {
        string custid      = HttpUtility.HtmlDecode(Request.QueryString["custid"].ToString());
        string realname    = HttpUtility.HtmlDecode(Request.QueryString["realname"].ToString());
        string nickname    = HttpUtility.HtmlDecode(Request.QueryString["nickname"].ToString());
        string certificate = HttpUtility.HtmlDecode(Request.QueryString["certificate"].ToString());
        string certno      = HttpUtility.HtmlDecode(Request.QueryString["certno"].ToString());
        string sex         = HttpUtility.HtmlDecode(Request.QueryString["sex"].ToString());
        string birthday    = HttpUtility.HtmlDecode(Request.QueryString["birthday"].ToString());
        string Edu         = HttpUtility.HtmlDecode(Request.QueryString["Edu"].ToString());
        string Income      = HttpUtility.HtmlDecode(Request.QueryString["Income"].ToString());
        string pro         = HttpUtility.HtmlDecode(Request.QueryString["pro"].ToString());
        string area        = HttpUtility.HtmlDecode(Request.QueryString["area"].ToString());
        string spid        = HttpUtility.HtmlDecode(Request.QueryString["spid"].ToString());

        k = CustBasicInfo.UpdateCustInfoById(custid, pro, area, certificate, certno, realname, sex, nickname, DateTime.Now, birthday, Edu, Income, out Msg);
        if (k == 0)
        {
            CIP2BizRules.InsertCustInfoNotify(custid, "2", spid, "", "0", out Msg); // 通知积分商城
            CIP2BizRules.NotifyBesttoneAccountInfo(spid, custid, out Msg);          // 通知融合支付
        }
        Response.Write(k);
    }
Пример #6
0
    /// <summary>
    /// 开始UDBSSO功能
    /// </summary>
    protected void ProcessUnifyPlatformReturn()
    {
        StringBuilder strMsg = new StringBuilder();
        Int32         Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String        ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

        try
        {
            #region 获取参数并验证

            SPID      = Request["SPID"];
            ReturnUrl = Request["ReturnUrl"] == null ? String.Empty : Request["ReturnUrl"];
            LSID      = Request["LSID"];
            appId     = Request["appId"];
            paras     = Request["paras"];
            sign      = Request["sign"];

            string unifyPlatform_appId        = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;     //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appId"];
            string unifyPlatform_appSecretKey = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret; //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appSecretKey"];


            strMsg.AppendFormat("【验证参数,DateTime:{0}】:SPID:{1},LSID:{2},ReturnUrl:{3},appId:{4},paras:{5},sign:{6}\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), SPID, LSID, ReturnUrl, appId, paras, sign);

            string unifyPlatformResponse = CryptographyUtil.XXTeaDecrypt(paras, unifyPlatform_appSecretKey);
            strMsg.AppendFormat("unifyPlatformResponse:{0}\r\n", unifyPlatformResponse);
            string newsign = CryptographyUtil.HMAC_SHA1(unifyPlatform_appId + paras, unifyPlatform_appSecretKey);
            strMsg.AppendFormat("newsign:{0},sign:{1}\r\n", newsign, sign);
            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            if (!newsign.Equals(sign))
            {
                Redirect("ErrMsg", "签名不正确");
            }

            //paras {result,accessToken,timeStamp,userId,productUid,loginNum,nickName,userIconUrl,userIconUrl2,userIconUrl3,isThirdAccount}
            string result         = "";
            string accessToken    = "";
            string timeStamp      = "";
            string userId         = "";
            string productUid     = "";
            string loginNum       = "";
            string nickName       = "";
            string userIconUrl    = "";
            string userIconUrl2   = "";
            string userIconUrl3   = "";
            string isThirdAccount = "";


            Dictionary <String, String> parames = new Dictionary <string, string>();
            strMsg.Append("开始解析unifyPlatformResponse\r\n");
            try
            {
                parames = splitParameters(unifyPlatformResponse);
                strMsg.AppendFormat("params:{0}\r\n", parames);
            }
            catch (Exception exp)
            {
                strMsg.AppendFormat(exp.ToString());
            }
            strMsg.Append("解析unifyPlatformResponse完毕\r\n");
            foreach (KeyValuePair <String, String> p in parames)
            {
                if (p.Key.Equals("result"))
                {
                    result = p.Value;
                    strMsg.AppendFormat("result:{0}\r\n", result);
                }
                if (p.Key.Equals("accessToken"))
                {
                    accessToken = p.Value;
                    strMsg.AppendFormat("accessToken:{0}\r\n", accessToken);
                }
                if (p.Key.Equals("timeStamp"))
                {
                    timeStamp = p.Value;
                    strMsg.AppendFormat("timeStamp:{0}\r\n", timeStamp);
                }
                if (p.Key.Equals("userId"))
                {
                    userId = p.Value;
                    strMsg.AppendFormat("userId:{0}\r\n", userId);
                }
                if (p.Key.Equals("productUid"))
                {
                    productUid = p.Value;
                    strMsg.AppendFormat("productUid:{0}\r\n", productUid);
                }
                if (p.Key.Equals("loginNum"))
                {
                    loginNum = p.Value;
                    strMsg.AppendFormat("loginNum:{0}\r\n", loginNum);
                }
                if (p.Key.Equals("nickName"))
                {
                    nickName = p.Value;
                    strMsg.AppendFormat("nickName:{0}\r\n", nickName);
                }
                if (p.Key.Equals("userIconUrl"))
                {
                    userIconUrl = p.Value;
                    strMsg.AppendFormat("userIconUrl:{0}\r\n", userIconUrl);
                }
                if (p.Key.Equals("userIconUrl2"))
                {
                    userIconUrl2 = p.Value;
                    strMsg.AppendFormat("userIconUrl2:{0}\r\n", userIconUrl2);
                }
                if (p.Key.Equals("userIconUrl3"))
                {
                    userIconUrl3 = p.Value;
                    strMsg.AppendFormat("userIconUrl3:{0}\r\n", userIconUrl3);
                }
                if (p.Key.Equals("isThirdAccount"))
                {
                    isThirdAccount = p.Value;
                    strMsg.AppendFormat("isThirdAccount:{0}\r\n", isThirdAccount);
                }
            }
            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);

            #endregion

            #region 根据UDBTkcket到UDB查询用户信息

            strMsg.Append("【开始查询信息】:");

            UnifyAccountInfo accountInfo = new UnifyAccountInfo();
            String           clientIp    = System.Configuration.ConfigurationManager.AppSettings["CIP2_clientIp"];//? 通过f5出去的,这样获得地址不对
            if (String.IsNullOrEmpty(clientIp))
            {
                clientIp = Request.UserHostAddress;
            }

            String clientAgent = Request.UserAgent;
            ////根据UDBTicket到UDB查询用户信息
            //Result = _UDBMBoss.AccountInfoQuery(UDBSPID, UDBSPID, UDBTicket, UDBKey, out accountInfo, out ErrMsg);
            if ("0".Equals(result) && !String.IsNullOrEmpty(accessToken))
            {
                string p_version    = UDBConstDefinition.DefaultInstance.UnifyPlatformVersion; //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_version"];
                string p_clientType = UDBConstDefinition.DefaultInstance.UnifyPlatformClientType;
                Result = _UDBMBoss.UnifyPlatformGetUserInfo(unifyPlatform_appId, unifyPlatform_appSecretKey, p_version, p_clientType, accessToken, clientIp, clientAgent, out accountInfo, out ErrMsg);
            }

            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);

            if ("0".Equals(result) && Result == 0)   // 认证成功 并且根据accesstoken查客户信息成功
            {
                String CustID, OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
                //检测对应用户是否在号百系统,不在,则注册进来
                strMsg.Append("【开始注册到号百】:");
                CustID = String.Empty;

                Regex regMobile = new Regex(@"^1[345678]\d{9}$");
                Regex regEmail  = new Regex(@"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$");
                Regex regCard   = new Regex(@"^(\d{9}|\d{16})$");

                string AuthenType = "1";
                strMsg.AppendFormat("accountInfo.username:{0}\r\n", accountInfo.userName);
                strMsg.AppendFormat("acountInfo.userId:{0},accountInfo.pUserId:{1}\r\n", accountInfo.userId, accountInfo.pUserId);
                if (regMobile.IsMatch(accountInfo.userName))
                {
                    AuthenType = "2";
                }
                if (regEmail.IsMatch(accountInfo.userName))
                {
                    AuthenType = "4";
                }
                if (regCard.IsMatch(accountInfo.userName))
                {
                    AuthenType = "3";
                }

                if ("2".Equals(AuthenType))
                {
                    //Result = UserRegistry.getUserRegistryUnifyPlatform(accountInfo, out CustID, out ErrMsg);
                    String OperType = "1"; // 注册
                    String Password = "";  // 从综合平台注册过来,密码是不知道的
                    RealName = "";
                    Result   = CIP2BizRules.BindCustInfoUnifyPlatform("02", "021", accountInfo.mobileName,
                                                                      accountInfo.emailName, RealName, Password, accountInfo.userId, SPID, OperType, out CustID, out ErrMsg);
                }
                else
                {
                    Result = -7766;
                }

                //Result = UserRegistry.getUserRegistryUnifyPlatform(accountInfo, out CustID, out ErrMsg);

                strMsg.AppendFormat("Result:{0},CustID:{1}\r\n", Result, CustID);
                strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                //注册成功
                if (Result == 0)
                {
                    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);
                    strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                    if (Result != 0)
                    {
                        strMsg.Append(",ErrMsg:客户不存在" + CustID);
                        //客户不存在
                        Redirect("ErrMsg", "客户不存在");
                    }

                    ////登录tab写入cookie
                    //PageUtility.SetCookie("LoginTabCookie", "UDBTab", 8760);

                    strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                    //生成Ticket
                    ticket = CommonBizRules.CreateTicket();
                    Result = CIPTicketManager.insertCIPTicket(ticket, SPID, CustID, RealName, UserName, NickName, OuterID, "UDBTicket", Convert.ToString(accountInfo.userId), UDBBusiness.ConvertAuthenType(Convert.ToString(accountInfo.userType)), out ErrMsg);
                    strMsg.AppendFormat("【生成ticket】:Result:{0},Ticket:{1}", Result, ticket);
                    strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                    if (Result != 0)
                    {
                        strMsg.Append(",ErrMsg:Ticket生成失败" + ticket);
                        Redirect("ErrMsg", "Ticket生成失败");
                    }
                    strMsg.Append(",Message:生成ticket成功,返回业务系统\r\n");
                    ReturnUrl = Request["ReturnUrl"];
                    strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                    strMsg.AppendFormat("Response.Redirect to {0}\r\n", ReturnUrl);

                    //埋综合平台token 6.1 add
                    //String UnifyPlatformCookieName = ConfigurationManager.AppSettings["UnifyPlatformCookieName"];
                    //string AuthenName = UserName;
                    //AuthenType = "2";
                    //SPInfoManager spInfo = new SPInfoManager();
                    //Object SPData = spInfo.GetSPData(this.Context, "SPData");
                    //string key = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
                    //UserToken UT = new UserToken();
                    //string UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, OuterID, CustType, AuthenName, AuthenType, key, out ErrMsg);
                    //string CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
                    //PageUtility.SetCookie(UserTokenValue, UnifyPlatformCookieName, this.Page);
                    //埋综合平台token 6.1 end
                }
                else
                {
                    strMsg.Append(",ErrMsg:用户注册到号百失败");
                    Redirect("ErrMsg", "用户注册到号百失败" + ErrMsg);
                }
            }
            else
            {
                strMsg.Append(",ErrMsg:查询用户信息失败");
                Redirect("ErrMsg", "查询用户信息失败");
            }

            #endregion
        }
        catch (Exception ex)
        {
            strMsg.AppendFormat(",ErrMsg:{0}", ex.Message);
        }
        finally
        {
            WriteLog(strMsg.ToString());
        }
    }
Пример #7
0
    protected void UnifyAccountCheck()
    {
        StringBuilder strLog = new StringBuilder();
        Int32         Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String        ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

        try
        {
            SPID        = Request["SPID"];
            ReturnUrl   = Request["ReturnUrl"] == null ? String.Empty : Request["ReturnUrl"];
            AccessToken = Request["accessToken"];
            appId       = Request["appId"];
            paras       = Request["paras"];
            sign        = Request["sign"];
            strLog.AppendFormat("SPID:{0},ReturnUrl:{1},appId:{2},paras:{3},sign:{4},AccessToken:{5}\r\n", SPID, ReturnUrl, appId, paras, sign, AccessToken);
            //查综合平台客户信息
            strLog.Append("查询综合平台客户信息\r\n");
            if (!String.IsNullOrEmpty(AccessToken))
            {
                UnifyAccountInfo accountInfo = new UnifyAccountInfo();
                String           clientIp    = System.Configuration.ConfigurationManager.AppSettings["CIP2_clientIp"];//? 通过f5出去的,这样获得地址不对
                if (String.IsNullOrEmpty(clientIp))
                {
                    clientIp = Request.UserHostAddress;
                }

                String clientAgent                = Request.UserAgent;
                String unifyPlatform_appId        = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;     //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appId"];
                String unifyPlatform_appSecretKey = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret; //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appSecretKey"];
                String p_version    = UDBConstDefinition.DefaultInstance.UnifyPlatformVersion;                 //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_version"];
                String p_clientType = UDBConstDefinition.DefaultInstance.UnifyPlatformClientType;
                Result = _UDBMBoss.UnifyPlatformGetUserInfo(unifyPlatform_appId, unifyPlatform_appSecretKey, p_version, p_clientType, AccessToken, clientIp, clientAgent, out accountInfo, out ErrMsg);
                strLog.AppendFormat("查询综合平台返回:Result:{0},ErrMsg:{1},UserID:{2}\r\n", Result, ErrMsg, Convert.ToString(accountInfo.userId));
                if (Result == 0 && !String.IsNullOrEmpty(Convert.ToString(accountInfo.userId)))  //这个地方跟登录回来不一致,登录回来是根据loginnum去匹配
                {
                    ///////////////
                    #region 开始注册到号百
                    String CustID, OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
                    CustID = String.Empty;
                    Regex  regMobile  = new Regex(@"^1[345678]\d{9}$");
                    Regex  regEmail   = new Regex(@"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$");
                    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("123456"); //通过页面注册进来的,不知道密码,给一个默认密码
                    //通过统一注册页面过来的,注册为号百的 “非认证用户”,通过语音注册进来的,注册为号百的 “认证用户”
                    String OperType = "1";                                       // 注册 ,
                    if (!String.IsNullOrEmpty(MobileName) || !String.IsNullOrEmpty(EmailName))
                    {
                        strLog.Append("【开始注册或者绑定到号百】:\r\n");
                        Result = CIP2BizRules.BindCustInfoUnifyPlatform("02", "021", MobileName, EmailName, RealName, EncrytpPassWord, accountInfo.userId, SPID, OperType, out CustID, out ErrMsg);
                        strLog.Append("【开始注册或者绑定到号百的结果】:\r\n");
                        strLog.AppendFormat("Result:{0},CustID:{1},ErrMsg:{2}\r\n", Result, CustID, ErrMsg);
                        //注册成功
                        if (Result == 0)
                        {
                            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);
                            strLog.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                            if (Result != 0)
                            {
                                strLog.Append(",ErrMsg:客户不存在" + CustID);
                                Redirect("ErrMsg", "客户不存在");
                            }
                            strLog.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                            //生成Ticket
                            ticket = CommonBizRules.CreateTicket();
                            Result = CIPTicketManager.insertCIPTicket(ticket, SPID, CustID, RealName, UserName, NickName, OuterID, "UDBTicket", Convert.ToString(accountInfo.userId), "42", out ErrMsg);
                            //insertAccessToken
                            strLog.AppendFormat("【生成ticket】:Result:{0},Ticket:{1}", Result, ticket);
                            strLog.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                            if (Result != 0)
                            {
                                strLog.Append(",ErrMsg:Ticket生成失败" + ticket);
                                Redirect("ErrMsg", "Ticket生成失败");
                            }
                            strLog.Append(",Message:生成ticket成功,返回业务系统\r\n");
                            ReturnUrl = Request["ReturnUrl"];
                            strLog.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                            strLog.AppendFormat("Response.Redirect to {0}\r\n", ReturnUrl);
                            Response.Redirect(ReturnUrl, false);
                        }
                    }
                    else
                    {
                        Result = -7766;
                        ErrMsg = "MobileName,或者EmailName为空,所以不注册号百客户";
                        strLog.Append("MobileName,或者EmailName为空,所以不注册号百客户\r\n");
                        Redirect("ErrMsg", "MobileName,或者EmailName为空,所以不注册号百客户");
                    }
                    strLog.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                    //下面删掉一大段
                    #endregion
                    //////////////
                }
                else
                { //查询综合平台客户信息失败,或者account.userid为空
                    strLog.Append("查询综合平台客户信息失败,或者account.userid为空\r\n");
                    Redirect("ErrMsg", "查询综合平台客户信息失败,或者account.userid为空");
                }
            }
            else
            { //accesstoken没有返回
                strLog.Append("综合平台accesstoken没有返回\r\n");
                Redirect("ErrMsg", "综合平台accesstoken没有返回户");
            }
        }
        catch (Exception e)
        {
            strLog.AppendFormat("异常:{0}\r\n", e.ToString());
        }
        finally
        {
            log(strLog.ToString());
        }
    }
Пример #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());
    }
Пример #9
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());
    }
Пример #10
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());
        }
    }
Пример #11
0
    public String ModifyCustBasicInfo(string SPID, string CustID, string RealName, string CertificateCode, string CertificateType, string Sex, string Email)
    {
        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(RealName) &&
            CommonUtility.IsEmpty(CertificateCode) &&
            CommonUtility.IsEmpty(CertificateType) &&
            CommonUtility.IsEmpty(Sex))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                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>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改信息参数不能全为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        #endregion
        try
        {
            Result = CustBasicInfo.UpdateCustinfo(SPID, CustID, RealName, CertificateCode, CertificateType, Sex, Email, out ErrMsg);
            if (Result == 0)
            {
                //通知积分平台
                CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg);
                // 这里要判断该客户是否已经开过户,如果是开户的,并且修改了身份证的才同步
                //CIP2BizRules.NotifyBesttoneAccountInfo(SPID, CustID, 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
            {
                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-989");
                    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>", "-989");
                    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}\",", "-989");
                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>", "-989");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", exp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        return(ResponseMsg.ToString());
    }
Пример #12
0
    protected void Modify_Click(object sender, EventArgs e)
    {
        ///////////////////////////////////////////
        StringBuilder strLog = new StringBuilder();

        try
        {
            String oldPassWord          = Request.Form["oldPassWord"];
            String newPassWord          = Request.Form["newPassWord"];
            String confirmPassWord      = Request.Form["confirmPassWord"];
            string BindedBestpayAccount = "";
            string CreateTime           = "";
            IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg);
            if (IsBesttoneAccountBindV5Result == 0)
            {
                if (!String.IsNullOrEmpty(BindedBestpayAccount))
                {
                    BesttoneAccount = BindedBestpayAccount;
                }
            }

            strLog.AppendFormat("【开始修改密码,事件:{0}】", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            strLog.AppendFormat("参数:oldPassWord:{0},newPassWord:{1},confirmPassWord:{2},BesttonePayAccount:{3}", oldPassWord, newPassWord, confirmPassWord, BesttoneAccount);

            BestPayEncryptService bpes = new BestPayEncryptService();
            string e_oldPassWord       = "";
            string e_newPassWord       = "";
            string e_confirmPassWord   = "";

            AccountItem ai      = new AccountItem();
            String      ResCode = "";
            int         QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(BesttoneAccount, out ai, out ResCode, out ErrMsg);
            if (QueryBesttoneAccountResult == 0)
            {
                if (ai != null)
                {
                    e_oldPassWord     = bpes.encryptNoKey(oldPassWord, ai.AccountNo);
                    e_newPassWord     = bpes.encryptNoKey(newPassWord, ai.AccountNo);
                    e_confirmPassWord = bpes.encryptNoKey(confirmPassWord, ai.AccountNo);

                    strLog.AppendFormat("e_oldPassWord{0},e_newPassWord{1},e_confirmPassWord{2}", e_oldPassWord, e_newPassWord, e_confirmPassWord);

                    int ModifyBestPayPasswordResult = BesttoneAccountHelper.ModifyBestPayPassword(ai.AccountNo, e_oldPassWord, e_newPassWord, e_confirmPassWord, out ErrMsg);

                    if (ModifyBestPayPasswordResult == 0)
                    {
                        success = "0";
                    }
                    else
                    {
                        strLog.Append(",失败3");
                        Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                    }
                }
                else
                {
                    strLog.Append(",失败2");
                    Response.Redirect("ErrorInfo.aspx?ErrorInfo=账户信息未获取");
                }
            }
            else
            {
                strLog.Append(",失败1");
                Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
            }
        }
        catch (System.Exception ex)
        {
            log(ex.ToString());
        }
        finally
        {
            log(strLog.ToString());
        }
    }
Пример #13
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        XMLExchange xMLExchange = new XMLExchange();
        string      RealName, UserName, NickName, OutID, CustType, CustID, RealName1 = "";
        string      ErrMsg = "";
        int         Result = -1;
        string      rStr   = "<ContractRoot><TcpCont><ActionCode>1</ActionCode><TransactionID>1000000020201006182031463789</TransactionID><RspTime>20100618110036</RspTime><Response><RspType>0</RspType><RspCode>0000</RspCode><RspDesc>成功</RspDesc></Response></TcpCont><SvcCont><QryInfoRsp><InfoTypeID>31</InfoTypeID><InfoCont><CustInfo><BelongInfo><ProvinceCode>609001</ProvinceCode><ProvinceName>北京</ProvinceName><CityCode>010</CityCode><CityName>北京市</CityName></BelongInfo><PartyCodeInfo><CodeType>15</CodeType><CodeValue>200003412729</CodeValue><CityCode>010</CityCode></PartyCodeInfo><IdentityInfo><IdentType>1</IdentType><IdentNum>110221198109288314</IdentNum></IdentityInfo><CustName>杨悦</CustName><CustBrand>14</CustBrand><CustGroup>12</CustGroup><CustServiceLevel>14</CustServiceLevel><CustAddress>北京市昌平区东关南里33号楼1单元6号</CustAddress></CustInfo><PointInfo><PointType>1</PointType><PointValueSum>2188</PointValueSum><PointValue>2176</PointValue><PointTime>30000101</PointTime><PointItems><PointItemID>1</PointItemID><PointItemName>消费积分</PointItemName><PointItemValue>520</PointItemValue><PointItemTime>30000101</PointItemTime></PointItems><PointItems><PointItemID>3</PointItemID><PointItemName>奖励积分</PointItemName><PointItemValue>65</PointItemValue><PointItemTime>30000101</PointItemTime></PointItems><PointItems><PointItemID>4</PointItemID><PointItemName>其它积分</PointItemName><PointItemValue>1591</PointItemValue><PointItemTime>30000101</PointItemTime></PointItems><PointItems><PointItemID>5</PointItemID><PointItemName>机场贵宾厅服务免费总次数</PointItemName><PointItemValue>0</PointItemValue><PointItemTime>30000101</PointItemTime></PointItems><PointItems><PointItemID>6</PointItemID><PointItemName>机场贵宾厅服务剩余免费总次数</PointItemName><PointItemValue>0</PointItemValue><PointItemTime>30000101</PointItemTime></PointItems><PointItems><PointItemID>7</PointItemID><PointItemName>火车站贵宾厅服务免费总次数</PointItemName><PointItemValue>0</PointItemValue><PointItemTime>30000101</PointItemTime></PointItems><PointItems><PointItemID>8</PointItemID><PointItemName>火车站贵宾厅服务剩余免费总次数</PointItemName><PointItemValue>0</PointItemValue><PointItemTime>30000101</PointItemTime></PointItems></PointInfo></InfoCont></QryInfoRsp></SvcCont></ContractRoot>";

        try{
            QryCustInfoReturn qryCustInfoReturn = xMLExchange.AnalysisQryCustInfoXML(rStr);

            if (qryCustInfoReturn.TcpCont.Response.RspType == "0")
            {
                RealName = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustName;
                UserName = "";
                NickName = "";
                OutID    = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CodeValue;

                //10	政企客户 10
                //11	家庭客户 20
                //12	个人客户 30
                //99	其它客户 90

                switch (qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustGroup)
                {
                case "10":
                    CustType = "10";
                    break;

                case "11":
                    CustType = "20";
                    break;

                case "12":
                    CustType = "30";
                    break;

                case "99":
                    CustType = "90";
                    break;

                default:
                    CustType = "90";
                    break;
                }


                CustID = "";


                /*0	  统一客户标识码 9
                 * 1	  身份证         0
                 * 2	  军官证         2
                 * 3	  护照           3
                 * 4	  港澳台通行证   6
                 * 5	  部队干部离休证 9
                 * 6	  工商营业执照   9
                 * 7	  单位证明       9
                 * 9	  驾驶证         9
                 * 10	  学生证         9
                 * 11	  教师证         9
                 * 12	  户口本/居住证  9
                 * 13	  老人证         9
                 * 14	  士兵证         1
                 * 15	  组织机构代码证 9
                 * 17	  工作证         9
                 * 18	  暂住证         9
                 * 19	  电信识别编码   9
                 * 20	  集团客户标识码 9
                 * 21	  VIP卡          9
                 * 99	  其它           9
                 *
                 * 0-身份证
                 * 1-士兵证
                 * 2-军官证
                 * 3-护照
                 * 4-保留
                 * 5-台胞证
                 * 6-港澳通行证
                 * 7-国际海员证
                 * 9-其它
                 * 10-部队干部离休证
                 * 11-工商营业执照
                 * 12-单位证明
                 * 13-驾驶证
                 * 14-学生证
                 * 15-教师证
                 * 16-户口本/居住证
                 * 17-老人证
                 * 18-组织机构代码证
                 * 19-工作证
                 * 20-暂住证
                 * 21-电信识别编码
                 * 22-集团客户标识码
                 * 23-VIP卡
                 * 24-警官证
                 *
                 */
                string IdentType = "";


                switch (qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentType)
                {
                case "0":
                    IdentType = "25";
                    break;

                case "1":
                    IdentType = "0";
                    break;

                case "2":
                    IdentType = "2";
                    break;

                case "3":
                    IdentType = "3";
                    break;

                case "4":
                    IdentType = "6";
                    break;

                case "5":
                    IdentType = "10";
                    break;

                case "6":
                    IdentType = "11";
                    break;

                case "7":
                    IdentType = "12";
                    break;

                case "9":
                    IdentType = "13";
                    break;

                case "10":
                    IdentType = "14";
                    break;

                case "11":
                    IdentType = "15";
                    break;

                case "12":
                    IdentType = "16";
                    break;

                case "13":
                    IdentType = "17";
                    break;

                case "14":
                    IdentType = "1";
                    break;

                case "15":
                    IdentType = "18";
                    break;

                case "17":
                    IdentType = "19";
                    break;

                case "18":
                    IdentType = "20";
                    break;

                case "19":
                    IdentType = "21";
                    break;

                case "20":
                    IdentType = "22";
                    break;

                case "21":
                    IdentType = "23";
                    break;

                case "22":
                    IdentType = "24";
                    break;

                default:
                    IdentType = "9";
                    break;
                }


                if (RealName1 != "")
                {
                    RealName = RealName1;
                }

                //全国CRM用户注册到号百
                Result = UserRegistry.getUserRegistryCrm("",
                                                         qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.CityCode,
                                                                   //"021",
                                                         CustType, //客户类型
                                                         IdentType,
                                                         qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentNum,
                                                         RealName,
                                                         qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustServiceLevel,
                                                         "2",//未知
                                                         OutID,
                                                         "",
                                                         qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustAddress,
                                                         out CustID,
                                                         out ErrMsg);

                if (Result != 0)
                {
                    //err_code.InnerHtml = ErrMsg;
                }
                CIP2BizRules.InsertCustInfoNotify(CustID, "2", "", "", "0", out ErrMsg);
            }
            else
            {
                ErrMsg = "错误类型及编码:" + qryCustInfoReturn.TcpCont.Response.RspType
                         + "应答代码:" + qryCustInfoReturn.TcpCont.Response.RspCode
                         + "描述:" + qryCustInfoReturn.TcpCont.Response.RspDesc;

                //return -1;
                int rspcode = -1;
                try
                {
                    rspcode = int.Parse(qryCustInfoReturn.TcpCont.Response.RspCode);
                }
                catch { }
            }
        }
        catch (Exception ex1)
        {
            ErrMsg = ex1.Message.ToString();
            Result = -29999;
        }
    }
Пример #14
0
    public String UpdatePwd(String SPID, String accessToken, String password, String nPassword)
    {
        StringBuilder strMsg      = new StringBuilder();
        StringBuilder ResponseMsg = new StringBuilder();

        Result = ErrorDefinition.IError_Result_UnknowError_Code;
        ErrMsg = ErrorDefinition.IError_Result_UnknowError_Msg;
        strMsg.AppendFormat("接收参数 SPID:{0},accessToken:{1},password:{2},nPassword:{3}\r\n", SPID, accessToken, password, nPassword);

        #region 数据校验
        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            ResponseMsg.Append("{");
            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
            ResponseMsg.Append("}");
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(accessToken) && CommonUtility.IsEmpty(CustID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            ResponseMsg.Append("{");
            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "accessToken和CustID不能为空!");
            ResponseMsg.Append("}");
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(password))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            ResponseMsg.Append("{");
            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "password不能为空!");
            ResponseMsg.Append("}");
            return(ResponseMsg.ToString());
        }

        if (CommonUtility.IsEmpty(nPassword))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            ResponseMsg.Append("{");
            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "nPassword不能为空!");
            ResponseMsg.Append("}");
            return(ResponseMsg.ToString());
        }



        #endregion

        String appId       = String.Empty;
        String appSecret   = String.Empty;
        String version     = String.Empty;
        String clientType  = String.Empty;
        String clientIp    = String.Empty;
        String clientAgent = String.Empty;

        #region  获取综合平台接入参数

        try
        {
            appId       = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;
            appSecret   = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret;
            version     = UDBConstDefinition.DefaultInstance.UnifyPlatformVersion;
            clientType  = UDBConstDefinition.DefaultInstance.UnifyPlatformClientType;
            clientIp    = HttpContext.Current.Request.UserHostAddress;
            clientAgent = HttpContext.Current.Request.UserAgent;
            strMsg.AppendFormat("获取综合平台接入参数:appId:{0},appSecret:{1},version:{2},clientType:{3},clientIp:{4},clientAgent:{5}\r\n", appId, appSecret, version, clientType, clientIp, clientAgent);
        }
        catch (Exception e)
        {
            ResponseMsg.Length = 0;
            ResponseMsg.Append("{");
            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "获取综合平台参数异常:" + e.ToString());
            ResponseMsg.Append("}");
            return(ResponseMsg.ToString());
        }
        #endregion
        String jsonResult = String.Empty;
        string sign       = String.Empty;
        try
        {
            #region

            if (CommonUtility.IsEmpty(accessToken) && !CommonUtility.IsEmpty(CustID))
            {
                Result = CIP2BizRules.FetchAccessTokenFromCustID(CustID, out accessToken, out ErrMsg);
            }

            if (Result != 0 || CommonUtility.IsEmpty(accessToken))
            {
                ResponseMsg.Length = 0;
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-10");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "accesstoken没拿到,修改密码失败");
                ResponseMsg.Append("}");
                return(ResponseMsg.ToString());
            }
            string paras      = String.Empty;
            string format     = "json";
            string parameters = "accessToken=" + accessToken + "&password="******"&nPassword="******"&clientIp=" + clientIp + "&clientAgent=" + clientAgent;
            strMsg.AppendFormat("parameters:={0}\r\n", parameters);
            paras = CryptographyUtil.XXTeaEncrypt(parameters, appSecret);
            strMsg.AppendFormat("paras:={0}\r\n", paras);
            sign = CryptographyUtil.HMAC_SHA1(appId + clientType + format + version + paras, appSecret);
            strMsg.AppendFormat("sign:={0}\r\n", sign);
            NameValueCollection postData = new NameValueCollection();
            postData.Add("appId", appId);
            postData.Add("version", version);
            postData.Add("clientType", clientType);
            postData.Add("paras", paras);
            postData.Add("sign", sign);
            postData.Add("format", format);

            WebClient webclient = new WebClient();
            webclient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");//采取POST方式必须加的header,如果改为GET方式的话就去掉这句话即可
            byte[] responseData = webclient.UploadValues(UDBConstDefinition.DefaultInstance.UnifyPlatformUpdatePwdUrl, "POST", postData);
            jsonResult = System.Text.Encoding.UTF8.GetString(responseData);
            strMsg.AppendFormat("jsonResult:{0}\r\n", jsonResult);
            #endregion

            Dictionary <string, string> result_dic = JsonConvert.DeserializeObject <Dictionary <string, string> >(jsonResult);
            int    result   = -1;
            String s_result = String.Empty;
            String msg      = String.Empty;
            result_dic.TryGetValue("msg", out msg);
            result_dic.TryGetValue("result", out s_result);
            result             = Convert.ToInt32(s_result);
            ResponseMsg.Length = 0;
            ResponseMsg.Append("{");
            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "0");
            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", msg);
            ResponseMsg.Append("}");
            return(ResponseMsg.ToString());
        }
        catch (Exception e)
        {
            ResponseMsg.Length = 0;
            ResponseMsg.Append("{");
            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-10");
            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", e.ToString());
            ResponseMsg.Append("}");
            return(ResponseMsg.ToString());
        }


        return(ResponseMsg.ToString());
    }
Пример #15
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());
        }
    }
Пример #16
0
    public String UnifyAccountBinding(String SPID, String CustID, String AccessToken, String OperType)
    {
        StringBuilder strLog      = new StringBuilder();
        StringBuilder ResponseMsg = new StringBuilder();

        Result = ErrorDefinition.IError_Result_UnknowError_Code;
        ErrMsg = ErrorDefinition.IError_Result_UnknowError_Msg;

        strLog.AppendFormat("接收参数 SPID:{0},CustID:{1},AccessToken:{2},OperType:{3}\r\n", SPID, CustID, AccessToken, OperType);

        #region 数据校验
        if (CommonUtility.IsEmpty(SPID))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            ResponseMsg.Append("{");
            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "995");
            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "SPID不能为空!");
            ResponseMsg.Append("}");
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(AccessToken))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            ResponseMsg.Append("{");
            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "AccessToken不能为空!");
            ResponseMsg.Append("}");
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(OperType))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            ResponseMsg.Append("{");
            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "OperType不能为空!");
            ResponseMsg.Append("}");
            return(ResponseMsg.ToString());
        }
        #endregion

        String appId       = String.Empty;
        String appSecret   = String.Empty;
        String version     = String.Empty;
        String clientType  = String.Empty;
        String clientIp    = String.Empty;
        String clientAgent = String.Empty;


        try
        {
            try
            {
                appId       = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;
                appSecret   = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret;
                version     = UDBConstDefinition.DefaultInstance.UnifyPlatformVersion;
                clientType  = UDBConstDefinition.DefaultInstance.UnifyPlatformClientType;
                clientIp    = HttpContext.Current.Request.UserHostAddress;
                clientAgent = HttpContext.Current.Request.UserAgent;
                strLog.AppendFormat("获取综合平台接入参数:appId:{0},appSecret:{1},version:{2},clientType:{3},clientIp:{4},clientAgent:{5}\r\n", appId, appSecret, version, clientType, clientIp, clientAgent);
            }
            catch (Exception e)
            {
                ResponseMsg.Length = 0;
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "获取综合平台参数异常:" + e.ToString());
                ResponseMsg.Append("}");
                return(ResponseMsg.ToString());
            }

            UnifyAccountInfo accountInfo = new UnifyAccountInfo();
            strLog.Append("根据accesstoken去综合平台查询\r\n");

            try
            {
                UDBMBOSS _UDBMBoss = new UDBMBOSS();
                Result = _UDBMBoss.UnifyPlatformGetUserInfo(appId, appSecret, version, clientType, AccessToken, clientIp, clientAgent, out accountInfo, out ErrMsg);
                strLog.AppendFormat("根据accesstoken去综合平台查询结果,Result:{0},ErrMsg{1}\r\n", Result, ErrMsg);
                if (accountInfo != null)
                {
                    strLog.AppendFormat("account.userId:{0},accountInfo.userName:{1},accountInfo.province:{2},accountInfo.city:{3},accountInfo.mobileName:{4},accountInfo.emailName:{5},accountInfo.gender:{6}\r\n", accountInfo.userId, accountInfo.userName, accountInfo.province, accountInfo.city, accountInfo.mobileName, accountInfo.emailName, accountInfo.gender);
                }
            }
            catch (Exception e)
            {
                ResponseMsg.Length = 0;
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "根据accesstoken去综合平台查询:" + e.ToString());
                ResponseMsg.Append("}");
                return(ResponseMsg.ToString());
            }

            strLog.Append("建立绑定关系\r\n");
            try
            {
                if (Result == 0 && accountInfo != null && !String.IsNullOrEmpty(Convert.ToString(accountInfo.userId)))
                {
                    Result = CIP2BizRules.BindCustInfoUnifyPlatform("02", "021", accountInfo.mobileName,
                                                                    accountInfo.emailName, accountInfo.nickName, "", accountInfo.userId, SPID, OperType, out CustID, out ErrMsg);
                    strLog.AppendFormat("绑定结果Result:{0},Errmsg:{1}\r\n", Result, ErrMsg);

                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", Result);
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\",", ErrMsg);
                    ResponseMsg.AppendFormat("\"CustID\":\"{0}\",", CustID);
                    ResponseMsg.AppendFormat("\"UserID\":\"{0}\"", accountInfo.userId);
                    ResponseMsg.Append("}");
                    strLog.AppendFormat("返回json:{0}\r\n", ResponseMsg.ToString());
                }
            }
            catch (Exception e)
            {
                ResponseMsg.Length = 0;
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "1000");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "建立绑定关系失败:" + e.ToString());
                ResponseMsg.Append("}");
                return(ResponseMsg.ToString());
            }
        }
        catch (Exception ex)
        {
            strLog.AppendFormat("ex:{0}\r\n", ex.ToString());
            ResponseMsg.Length = 0;
            ResponseMsg.Append("{");
            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
            ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", ":" + ex.ToString());
            ResponseMsg.Append("}");
            return(ResponseMsg.ToString());
        }
        finally
        {
            log(strLog.ToString());
        }
        return(ResponseMsg.ToString());
    }
Пример #17
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);
        }
    }
Пример #18
0
    public String ChangePayPassword(String SPID, String CustID, String oldPassWord, String newPassWord, String confirmPassWord, String wt)
    {
        Int32         Result      = ErrorDefinition.CIP_IError_Result_UnknowError_Code;
        String        ErrMsg      = ErrorDefinition.CIP_IError_Result_UnknowError_Msg;
        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(oldPassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "oldPassword不能为空!");
                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>", "oldPassword不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }



        if (CommonUtility.IsEmpty(newPassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "newPassword不能为空!");
                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>", "newPassword不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }


        if (CommonUtility.IsEmpty(confirmPassWord))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "996");
                ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "confirmPassWord不能为空!");
                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>", "confirmPassWord不能为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }

        #endregion

        try
        {
            string BindedBestpayAccount = "";
            string CreateTime           = "";
            Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg);

            if (Result == 0 && !String.IsNullOrEmpty(BindedBestpayAccount))
            {
                BestPayEncryptService bpes = new BestPayEncryptService();
                string e_oldPassWord       = "";
                string e_newPassWord       = "";
                string e_confirmPassWord   = "";

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

                int QueryBesttoneAccountResult = BesttoneAccountInfoQuery(BindedBestpayAccount, out ai, out ResCode, out ErrMsg);
                if (QueryBesttoneAccountResult == 0)
                {
                    if (ai != null)
                    {
                        e_oldPassWord     = bpes.encryptNoKey(oldPassWord, ai.AccountNo);
                        e_newPassWord     = bpes.encryptNoKey(newPassWord, ai.AccountNo);
                        e_confirmPassWord = bpes.encryptNoKey(confirmPassWord, ai.AccountNo);

                        //strLog.AppendFormat("e_oldPassWord{0},e_newPassWord{1},e_confirmPassWord{2}", e_oldPassWord, e_newPassWord, e_confirmPassWord);

                        int ModifyBestPayPasswordResult = ModifyBestPayPassword(ai.AccountNo, e_oldPassWord, e_newPassWord, e_confirmPassWord, out ErrMsg);

                        if (ModifyBestPayPasswordResult == 0)
                        {
                            //success = "0";

                            // 返回错误信息
                            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
                        {
                            //strLog.Append(",失败3");
                            //Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);

                            // 返回错误信息
                            ResponseMsg.Length = 0;
                            if ("json".Equals(wt))
                            {
                                ResponseMsg.Append("{");
                                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "9916");
                                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>", "9916");
                                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改密码失败!");
                                ResponseMsg.Append("</PARAMETERS>");
                                ResponseMsg.Append("</PayPlatRequestParameter>");
                            }
                            return(ResponseMsg.ToString());
                        }
                    }
                    else
                    {
                        //strLog.Append(",失败2");
                        //Response.Redirect("ErrorInfo.aspx?ErrorInfo=账户信息未获取");

                        // 返回错误信息
                        ResponseMsg.Length = 0;
                        if ("json".Equals(wt))
                        {
                            ResponseMsg.Append("{");
                            ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "9917");
                            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>", "9917");
                            ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改密码失败!账户信息未能获取");
                            ResponseMsg.Append("</PARAMETERS>");
                            ResponseMsg.Append("</PayPlatRequestParameter>");
                        }
                        return(ResponseMsg.ToString());
                    }
                }
                else
                {
                    //strLog.Append(",失败1");
                    //Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);

                    // 返回错误信息
                    ResponseMsg.Length = 0;
                    if ("json".Equals(wt))
                    {
                        ResponseMsg.Append("{");
                        ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "9918");
                        ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "修改密码失败2!");
                        ResponseMsg.Append("}");
                    }
                    else
                    {
                        ResponseMsg.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
                        ResponseMsg.Append("<PayPlatRequestParameter>");
                        ResponseMsg.Append("<PARAMETERS>");
                        ResponseMsg.AppendFormat("<ErrCode>{0}</ErrCode>", "9918");
                        ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改密码失败2!");
                        ResponseMsg.Append("</PARAMETERS>");
                        ResponseMsg.Append("</PayPlatRequestParameter>");
                    }
                    return(ResponseMsg.ToString());
                }
            }
            else
            {
                // 未开通账户


                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "9919");
                    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>", "9919");
                    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}\",", "9920");
                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>", "9920");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", ecp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        return(ResponseMsg.ToString());
    }
Пример #19
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string            rStr              = "<ContractRoot><TcpCont><ActionCode>1</ActionCode><TransactionID>1000000020201005136604177019</TransactionID><RspTime>20100513094916</RspTime><Response><RspType>9</RspType><RspCode>9016</RspCode><RspDesc>调用落地方异常:An error occurred whilst performing a socket operation: getsockopt</RspDesc></Response></TcpCont></ContractRoot>";
        string            CustType          = "";
        string            RealName          = "";
        string            UserName          = "";
        string            NickName          = "";
        string            OutID             = "";
        XMLExchange       xMLExchange       = new XMLExchange();
        QryCustInfoReturn qryCustInfoReturn = xMLExchange.AnalysisQryCustInfoXML(rStr);

        if (qryCustInfoReturn.TcpCont.Response.RspType == "0")
        {
            RealName = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustName;
            UserName = "";
            NickName = "";
            OutID    = qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.PartyCodeInfo.CodeValue;

            //10	政企客户 10
            //11	家庭客户 20
            //12	个人客户 30
            //99	其它客户 90

            switch (qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustGroup)
            {
            case "10":
                CustType = "10";
                break;

            case "11":
                CustType = "20";
                break;

            case "12":
                CustType = "30";
                break;

            case "99":
                CustType = "90";
                break;

            default:
                CustType = "90";
                break;
            }


            string CustID = "";


            /*0	  统一客户标识码 9
             * 1	  身份证         0
             * 2	  军官证         2
             * 3	  护照           3
             * 4	  港澳台通行证   6
             * 5	  部队干部离休证 9
             * 6	  工商营业执照   9
             * 7	  单位证明       9
             * 9	  驾驶证         9
             * 10	  学生证         9
             * 11	  教师证         9
             * 12	  户口本/居住证  9
             * 13	  老人证         9
             * 14	  士兵证         1
             * 15	  组织机构代码证 9
             * 17	  工作证         9
             * 18	  暂住证         9
             * 19	  电信识别编码   9
             * 20	  集团客户标识码 9
             * 21	  VIP卡          9
             * 99	  其它           9
             *
             * 0-身份证
             * 1-士兵证
             * 2-军官证
             * 3-护照
             * 4-保留
             * 5-台胞证
             * 6-港澳通行证
             * 7-国际海员证
             * 9-其他
             */
            string IdentType = "";


            switch (qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentType)
            {
            case "1":
                IdentType = "0";
                break;

            case "4":
                IdentType = "6";
                break;

            case "14":
                IdentType = "1";
                break;

            case "2":
                IdentType = "2";
                break;

            case "3":
                IdentType = "3";
                break;

            default:
                IdentType = "9";
                break;
            }



            //全国CRM用户注册到号百
            //int  Result = UserRegistry.getUserRegistryCrm(UAProvinceID,
            //      qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.BelongInfo.CityCode,
            //      //"021",
            //      CustType,//客户类型
            //      IdentType,
            //      qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.IdentityInfo.IdentNum,
            //      RealName,
            //      qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustServiceLevel,
            //      "2",//未知
            //      OutID,
            //      System.Configuration.ConfigurationManager.AppSettings["ScoreBesttoneSPID"],
            //      qryCustInfoReturn.SvcCont.QryInfoRsp.InfoCont.CustInfo.CustAddress,
            //      out CustID,
            //     out  ErrMsg);

            //if (Result != 0)
            //{
            //    //err_code.InnerHtml = ErrMsg;
            //    return Result;
            //}
            string ErrMsg = "";
            CIP2BizRules.InsertCustInfoNotify(CustID, "2", System.Configuration.ConfigurationManager.AppSettings["ScoreBesttoneSPID"], "", "0", out ErrMsg);
        }
        else
        {
            string ErrMsg = "错误类型及编码:" + qryCustInfoReturn.TcpCont.Response.RspType
                            + "应答代码:" + qryCustInfoReturn.TcpCont.Response.RspCode
                            + "描述:" + qryCustInfoReturn.TcpCont.Response.RspDesc;

            //   return -1;
        }


        //string phone="";
        //this.Label1.Text=CommonBizRules.PhoneNumValid(this.Context, this.TextBox1.Text.Trim(), out phone)+"=="+phone;
    }
Пример #20
0
    protected void QueryAssertionByTicket()
    {
        MBOSSClass    mboss = new MBOSSClass();
        StringBuilder strLog = new StringBuilder();
        string        xml = "";
        int           Result = -19999;
        string        ErrMsg = String.Empty;
        string        UAProvinceID = "35";
        string        SPID = UAProvinceID + "999991";
        string        CustID = "", RealName = "", NickName = "", UserName = "", OutID = "", UserAccount = "", CustType = "", ProvinceID = "", AuthenName = "", AuthenType = "";
        string        AssertionAddress = String.Empty;
        string        SSOAddress       = String.Empty;
        string        SecretKey        = String.Empty;

        try
        {
            //获取到集团断言查询地址,这里要注意个问题,取地址是从数据库中去,测试库上的地址已经改为新的断言地址,在正式库上是否要改?
            Result = mboss.GetMBOSSAddress(this.Context, SPID, out AssertionAddress, out SSOAddress, out ErrMsg);
            if (Result != 0)
            {
                strLog.Append("没有获取到集团断言查询地址;\r\n");
                //SendJF();   没有获取到集团断言查询地址
                return;
            }
            PageUtility.SetCookie(AssertionAddress, "AssertionAddress", this.Page);
            PageUtility.SetCookie(SSOAddress, "SSOAddress", this.Page);
            //35000 20130808 5146985330
            string TransactionID = "35000" + DateTime.Now.ToString("yyyyMMdd") + Convert.ToString(LongRandom(1000000000, 9999999999, new Random()));                   //获取流水号
            //密钥
            Result = mboss.GetMBOSSSecretKey(this.Context, SPID, out SecretKey, out ErrMsg);
            if (Result != 0)
            {
                strLog.Append("没有获取到密钥;\r\n");
                //没有获取到密钥;
                return;
            }

            //断言
            MBOSSClass.BilByCompilingResult bil = new MBOSSClass.BilByCompilingResult();
            //查询断言并解析
            Result     = mboss.SendUATicket(UAProvinceID, SPID, UATicket, AssertionAddress, this.Context, "SPCAData", TransactionID, out bil, out xml, out ErrMsg);
            AuthenType = bil.AccountType;
            AuthenName = bil.AccountID;
            strLog.AppendFormat("断言查询返回的报文:{0}\r\n", xml);
            if (Result != 0)
            {
                //Response.Redirect("../ErrorInfo.aspx?Result=-19999&ErrorInfo=请从网厅登陆1&FunctionName=请从网厅登陆1", true);
                Response.Redirect("../ErrorInfo.aspx?Result=-19999&ErrorInfo=断言解析错误!", true);
                return;
            }


            //用户入库是否存在,没有则新增,有则update
            string dealType = String.Empty;
            int    type     = 0;
            string areaid   = String.Empty;

            Result = BTForBusinessSystemInterfaceRules.MUserAuthV2(SPID, UAProvinceID, bil.AccountID, bil.AccountType, bil.AccountInfos, Context,
                                                                   out ErrMsg, out CustID, out UserAccount, out CustType, out OutID, out ProvinceID,
                                                                   out RealName, out UserName, out NickName, out dealType, out type, out areaid);

            if (Result != 0)
            {
                Response.Redirect("../ErrorInfo.aspx?Result=" + Result + "&ErrorInfo=" + ErrMsg + "&FunctionName=请从网厅登陆4", true);
                return;
            }

            //如果客户信息不全,则去crm查询一把  这里要注意的是,必须根据集团返回的断言中的UAID 当成省码传给枢纽
            string TestStr = String.Empty;
            Result = CrmSSO.UserAuthCrm1(bil.ProvinceID, bil.AccountInfos[0].areaid, bil.AccountType, bil.AccountID, UAProvinceID, "", "0", UAProvinceID + "999991", this.Context, out RealName, out UserName, out NickName, out OutID, out CustType, out CustID, out ErrMsg, out TestStr);
            if (Result != 0)
            {
                Response.Redirect("../ErrorInfo.aspx?Result=" + Result + "&ErrorInfo=" + ErrMsg + "&FunctionName=请从网厅登陆5", true);
                return;
            }
            strLog.Append(Result + "==" + UAProvinceID + "=UAProvinceID;" + bil.AccountType + " =bil.AccountType;" + bil.AccountID + "=bil.AccountID;" + "" + "" + RealName + "=RealName;" + UserName + "=UserName;" + NickName + "=NickName;" + OutID + "=OutID;" + CustType + "=CustType;" + CustID + "=CustID1;" + ErrMsg + "=ErrMsg\r\n");
            if (dealType == "0")            //通知积分系统
            {
                CIP2BizRules.InsertCustInfoNotify(CustID, "2", System.Configuration.ConfigurationManager.AppSettings["ScoreBesttoneSPID"], "", "0", out ErrMsg);
            }

            //生成ticket
            Result = CIPTicketManager.insertCIPTicket(TransactionID, SPID, CustID, RealName, NickName, UserName, OutID, "", AuthenName, AuthenType, out ErrMsg);
            Response.Redirect(ReturnUrl + "?Ticket=" + TransactionID);
        }
        catch (Exception e)
        {
            strLog.AppendFormat(e.Message);
        }
        finally
        {
            try
            {
                CommonBizRules.WriteDataCustAuthenLog(SPID, CustID, ProvinceID, AuthenType, AuthenName, "2", Result, ErrMsg);
            }
            catch { }
        }
    }
Пример #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string CookieName  = "";
        string token       = "";
        string CustID      = "";
        string RealName    = "";
        string UserName    = "";
        string NickName    = "";
        string OuterID     = "";
        string CustType    = "";
        string AuthenName  = "";
        string AuthenType  = "";
        string RedirectUrl = "";
        string key         = "";
        string ErrMsg      = "";
        int    Result      = ErrorDefinition.IError_Result_UnknowError_Code;

        if (!this.IsPostBack)
        {
            CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
            token      = PageUtility.GetCookie(CookieName);
            if (String.IsNullOrEmpty(token))
            {
                Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=请先登录积分商城", true);
                return;
            }

            UserToken UT = new UserToken();
            key    = System.Configuration.ConfigurationManager.AppSettings["ScoreSystemSecret"];
            Result = UT.ParseScoreUserToken(token, key, out ProvinceID, out CustID, out RealName, out UserName, out NickName, out OuterID, out CustType, out AuthenName, out AuthenType, out ErrMsg);
            if (Result == 0)
            {
                string par_ProvinceID = Request["ProvinceID"];
                if (par_ProvinceID.Equals(ProvinceID))
                {
                    String Ticket = CommonBizRules.CreateTicket();
                    Result = CIPTicketManager.insertCIPTicket(Ticket, SPID, CustID, RealName, NickName, UserName, OuterID, "", AuthenName, AuthenType, out ErrMsg);

                    if (Result != 0)
                    {
                        Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=票据生成失败,请重新登录积分商城", true);
                        return;   // 重定向至哪里
                    }

                    // 根据ProvinceID 查出 Redirecturl

                    Result = CIP2BizRules.GetRedirectUrlByProvince(ProvinceID, out RedirectUrl, out ErrMsg);
                    if (Result == 0)
                    {
                        if (!String.IsNullOrEmpty(RedirectUrl))
                        {
                            if (RedirectUrl.IndexOf("?") > 0)
                            {
                                RedirectUrl = RedirectUrl + "&Ticket=" + Ticket;
                            }
                            else
                            {
                                RedirectUrl = RedirectUrl + "?Ticket=" + Ticket;
                            }
                        }
                        else
                        {
                            // 根据provinvce 获取redirecturl 为空 ,该转向哪里
                            Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=未配置该省的返回地址", true);
                        }
                    }
                    else
                    {
                        // 根据province获得url失败,该返回哪里?
                        Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=根据省ID获取返回地址失败", true);
                    }
                    Response.Redirect(RedirectUrl, true);
                }
                else
                {
                    Response.Redirect("../../ErrorInfo.aspx?Result=-19999&ErrorInfo=省ID不匹配当前token中的省ID", true);
                }
            }
            else   // token  存在但是解析失败
            {
                RedirectUrl = Request.Url.AbsoluteUri;
                Response.Redirect(RedirectUrl, true);
            }
        }
    }
Пример #22
0
    /// <summary>
    /// 开始UDBSSO功能
    /// </summary>
    protected void ProcessUnifyPlatformReturn()
    {
        StringBuilder strMsg = new StringBuilder();
        Int32         Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String        ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

        try
        {
            #region 获取参数并验证

            SPID      = Request["SPID"];
            ReturnUrl = Request["ReturnUrl"] == null ? String.Empty : Request["ReturnUrl"];
            LSID      = Request["LSID"];
            appId     = Request["appId"];
            paras     = Request["paras"];
            sign      = Request["sign"];

            string unifyPlatform_appId        = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;     //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appId"];
            string unifyPlatform_appSecretKey = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret; //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appSecretKey"];


            strMsg.AppendFormat("【验证参数,DateTime:{0}】:SPID:{1},LSID:{2},ReturnUrl:{3},appId:{4},paras:{5},sign:{6}\r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), SPID, LSID, ReturnUrl, appId, paras, sign);

            string unifyPlatformResponse = CryptographyUtil.XXTeaDecrypt(paras, unifyPlatform_appSecretKey);
            strMsg.AppendFormat("unifyPlatformResponse:{0}\r\n", unifyPlatformResponse);
            string newsign = CryptographyUtil.HMAC_SHA1(unifyPlatform_appId + paras, unifyPlatform_appSecretKey);
            strMsg.AppendFormat("newsign:{0},sign:{1}\r\n", newsign, sign);
            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            if (!newsign.Equals(sign))
            {
                Redirect("ErrMsg", "签名不正确");
            }

            //paras {result,accessToken,timeStamp,userId,productUid,loginNum,nickName,userIconUrl,userIconUrl2,userIconUrl3,isThirdAccount}
            string result         = "";
            string accessToken    = "";
            string timeStamp      = "";
            long   userId         = 0;
            string productUid     = "";
            string loginNum       = "";
            string nickName       = "";
            string userIconUrl    = "";
            string userIconUrl2   = "";
            string userIconUrl3   = "";
            string isThirdAccount = "";


            Dictionary <String, String> parames = new Dictionary <string, string>();
            strMsg.Append("开始解析unifyPlatformResponse\r\n");
            try
            {
                parames = splitParameters(unifyPlatformResponse);
                strMsg.AppendFormat("params:{0}\r\n", parames);
            }
            catch (Exception exp)
            {
                strMsg.AppendFormat(exp.ToString());
            }
            strMsg.Append("解析unifyPlatformResponse完毕\r\n");
            foreach (KeyValuePair <String, String> p in parames)
            {
                if (p.Key.Equals("result"))
                {
                    result = p.Value;
                    strMsg.AppendFormat("result:{0}\r\n", result);
                }
                if (p.Key.Equals("accessToken"))
                {
                    accessToken = p.Value;
                    strMsg.AppendFormat("accessToken:{0}\r\n", accessToken);
                }
                if (p.Key.Equals("timeStamp"))
                {
                    timeStamp = p.Value;
                    strMsg.AppendFormat("timeStamp:{0}\r\n", timeStamp);
                }
                if (p.Key.Equals("userId"))
                {
                    if (!String.IsNullOrEmpty(p.Value))
                    {
                        try
                        {
                            userId = userId = System.Int64.Parse(p.Value);
                        }
                        catch (Exception e)
                        {
                            userId = 0;
                        }
                    }
                    else
                    {
                        userId = 0;
                    }


                    strMsg.AppendFormat("userId:{0}\r\n", userId);
                }
                if (p.Key.Equals("productUid"))
                {
                    productUid = p.Value;
                    strMsg.AppendFormat("productUid:{0}\r\n", productUid);
                }
                if (p.Key.Equals("loginNum"))
                {
                    loginNum = p.Value;
                    strMsg.AppendFormat("loginNum:{0}\r\n", loginNum);
                }
                if (p.Key.Equals("nickName"))
                {
                    nickName = p.Value;
                    strMsg.AppendFormat("nickName:{0}\r\n", nickName);
                }
                if (p.Key.Equals("userIconUrl"))
                {
                    userIconUrl = p.Value;
                    strMsg.AppendFormat("userIconUrl:{0}\r\n", userIconUrl);
                }
                if (p.Key.Equals("userIconUrl2"))
                {
                    userIconUrl2 = p.Value;
                    strMsg.AppendFormat("userIconUrl2:{0}\r\n", userIconUrl2);
                }
                if (p.Key.Equals("userIconUrl3"))
                {
                    userIconUrl3 = p.Value;
                    strMsg.AppendFormat("userIconUrl3:{0}\r\n", userIconUrl3);
                }
                if (p.Key.Equals("isThirdAccount"))
                {
                    isThirdAccount = p.Value;
                    strMsg.AppendFormat("isThirdAccount:{0}\r\n", isThirdAccount);
                }
            }
            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);

            #endregion

            #region 开始注册到号百
            strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            if ("0".Equals(result) && !String.IsNullOrEmpty(accessToken) && !String.IsNullOrEmpty(loginNum))
            {
                String CustID, OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
                CustID = String.Empty;
                Regex  regMobile  = new Regex(@"^1[345678]\d{9}$");
                Regex  regEmail   = new Regex(@"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$");
                String MobileName = String.Empty;
                String EmailName  = String.Empty;
                RealName = loginNum;
                if (regMobile.IsMatch(loginNum))
                {
                    MobileName = loginNum;
                }

                if (regEmail.IsMatch(loginNum))
                {
                    EmailName = loginNum;
                }
                String EncrytpPassWord = CryptographyUtil.Encrypt("123456");
                String OperType        = "2"; //1注册、2登录、3单点登录、4帐号提升

                if (!String.IsNullOrEmpty(loginNum))
                {
                    strMsg.Append("【开始注册或绑定到号百】:\r\n");
                    Result = CIP2BizRules.BindCustInfoUnifyPlatform("02", "021", MobileName, EmailName, RealName, EncrytpPassWord, userId, SPID, OperType, out CustID, out ErrMsg);
                    strMsg.Append("【开始注册或绑定到号百的结果】:\r\n");
                    strMsg.AppendFormat("Result:{0},CustID:{1}<->UsesrID:{2},ErrMsg:{3}\r\n", Result, CustID, userId, ErrMsg);

                    //注册成功,种下cookie
                    if (Result == 0)
                    {
                        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);
                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        if (Result != 0)
                        {
                            strMsg.Append(",ErrMsg:客户不存在" + CustID);
                            //客户不存在
                            Redirect("ErrMsg", "客户不存在");
                        }

                        //登录tab写入cookie
                        PageUtility.SetCookie("LoginTabCookie", "UDBTab", 8760);

                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        //生成Ticket
                        ticket = CommonBizRules.CreateTicket();
                        if (userId != null && userId != 0)
                        {
                            OuterID = "123456";
                        }
                        Result = CIPTicketManager.insertCIPTicket(ticket, SPID, CustID, RealName, UserName, NickName, OuterID, "UDBTicket", Convert.ToString(userId), "42", out ErrMsg);
                        //insertAccessToken

                        if ((userId != 0) && !String.IsNullOrEmpty(CustID) && !String.IsNullOrEmpty(loginNum))
                        {
                            strMsg.Append("记录AccessToken\r\n");
                            strMsg.AppendFormat("CustID:{0}<->AccessToken:{1}\r\n", CustID, accessToken);
                            String Description = "web登录";
                            Result = CIP2BizRules.InsertAccessToken(SPID, HttpContext.Current.Request.UserHostAddress.ToString(), accessToken, Convert.ToString(userId), CustID, RealName, NickName, loginNum, OperType, Description, out ErrMsg);
                            strMsg.AppendFormat("InsertAccessToken:Result:{0},ErrMsg:{1}\r\n", Result, ErrMsg);
                        }
                        else
                        {
                            strMsg.Append("因为CustID为空,导致AccessToken无法记录,可能是绑定失败的原因\r\n");
                        }
                        strMsg.AppendFormat("【生成ticket】:Result:{0},Ticket:{1}", Result, ticket);
                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        if (Result != 0)
                        {
                            strMsg.Append(",ErrMsg:Ticket生成失败" + ticket);
                            Redirect("ErrMsg", "Ticket生成失败");
                        }
                        strMsg.Append(",Message:生成ticket成功,返回业务系统\r\n");
                        ReturnUrl = Request["ReturnUrl"];
                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        strMsg.AppendFormat("Response.Redirect to {0}\r\n", ReturnUrl);
                    }
                    else
                    {
                        strMsg.Append("绑定失败\r\n");
                    }
                }
                else
                {
                    Result = -7766;
                    ErrMsg = "loginNum为空,所以绑定或注册号百客户";
                    strMsg.Append("loginNum为空,所以绑定或注册号百客户\r\n");
                }
                strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            }

            //下面删掉一大段

            #endregion
        }
        catch (Exception ex)
        {
            strMsg.AppendFormat(",ErrMsg:{0}", ex.Message);
        }
        finally
        {
            WriteLog(strMsg.ToString());
        }
    }
Пример #23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Int32  Result = ErrorDefinition.BT_IError_Result_UnknowError_Code;
        String ErrMsg = ErrorDefinition.BT_IError_Result_UnknowError_Msg;

        StringBuilder strMsg = new StringBuilder();

        SPID = Request["SPID"];
        string appId = Request["appId"];
        string paras = Request["paras"];
        string sign  = Request["sign"];

        string unifyPlatform_appId        = UDBConstDefinition.DefaultInstance.UnifyPlatformAppId;     //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appId"];
        string unifyPlatform_appSecretKey = UDBConstDefinition.DefaultInstance.UnifyPlatformAppSecret; //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_appSecretKey"];

        strMsg.AppendFormat("返回参数:appId:{0},paras:{1},sign:{2}\r\n", appId, paras, sign);

        string unifyPlatformResponse = CryptographyUtil.XXTeaDecrypt(paras, unifyPlatform_appSecretKey);

        strMsg.AppendFormat("unifyPlatformResponse:{0}\r\n", unifyPlatformResponse);
        string newsign = CryptographyUtil.HMAC_SHA1(unifyPlatform_appId + paras, unifyPlatform_appSecretKey);

        strMsg.AppendFormat("newsign:{0},sign:{1}\r\n", newsign, sign);

        if (!newsign.Equals(sign))
        {
            Redirect("ErrMsg", "签名不正确");
        }

        string result         = "";
        string accessToken    = "";
        string timeStamp      = "";
        string userId         = "";
        string productUid     = "";
        string loginNum       = "";
        string nickName       = "";
        string userIconUrl    = "";
        string userIconUrl2   = "";
        string userIconUrl3   = "";
        string isThirdAccount = "";

        Dictionary <String, String> parames = new Dictionary <string, string>();

        strMsg.Append("开始解析unifyPlatformResponse\r\n");
        try
        {
            parames = splitParameters(unifyPlatformResponse);
            strMsg.AppendFormat("params:{0}\r\n", parames);
        }
        catch (Exception exp)
        {
            strMsg.AppendFormat(exp.ToString());
        }
        strMsg.Append("解析unifyPlatformResponse完毕\r\n");

        foreach (KeyValuePair <String, String> p in parames)
        {
            if (p.Key.Equals("result"))
            {
                result = p.Value;
                strMsg.AppendFormat("result:{0}\r\n", result);
            }
            if (p.Key.Equals("accessToken"))
            {
                accessToken = p.Value;
                strMsg.AppendFormat("accessToken:{0}\r\n", accessToken);
            }
            if (p.Key.Equals("timeStamp"))
            {
                timeStamp = p.Value;
                strMsg.AppendFormat("timeStamp:{0}\r\n", timeStamp);
            }
            if (p.Key.Equals("userId"))
            {
                userId = p.Value;
                strMsg.AppendFormat("userId:{0}\r\n", userId);
            }
            if (p.Key.Equals("productUid"))
            {
                productUid = p.Value;
                strMsg.AppendFormat("productUid:{0}\r\n", productUid);
            }
            if (p.Key.Equals("loginNum"))
            {
                loginNum = p.Value;
                strMsg.AppendFormat("loginNum:{0}\r\n", loginNum);
            }
            if (p.Key.Equals("nickName"))
            {
                nickName = p.Value;
                strMsg.AppendFormat("nickName:{0}\r\n", nickName);
            }
            if (p.Key.Equals("userIconUrl"))
            {
                userIconUrl = p.Value;
                strMsg.AppendFormat("userIconUrl:{0}\r\n", userIconUrl);
            }
            if (p.Key.Equals("userIconUrl2"))
            {
                userIconUrl2 = p.Value;
                strMsg.AppendFormat("userIconUrl2:{0}\r\n", userIconUrl2);
            }
            if (p.Key.Equals("userIconUrl3"))
            {
                userIconUrl3 = p.Value;
                strMsg.AppendFormat("userIconUrl3:{0}\r\n", userIconUrl3);
            }
            if (p.Key.Equals("isThirdAccount"))
            {
                isThirdAccount = p.Value;
                strMsg.AppendFormat("isThirdAccount:{0}\r\n", isThirdAccount);
            }
        }

        strMsg.Append("【综合平台 getUserInfo.do】:");

        UnifyAccountInfo accountInfo = new UnifyAccountInfo();
        String           clientIp    = System.Configuration.ConfigurationManager.AppSettings["CIP2_clientIp"];//? 通过f5出去的,这样获得地址不对

        if (String.IsNullOrEmpty(clientIp))
        {
            clientIp = Request.UserHostAddress;
        }

        try
        {
            String clientAgent = Request.UserAgent;
            if ("0".Equals(result) && !String.IsNullOrEmpty(accessToken))                      // result = 0 说明已经处于登录状态 result = 1 说明处于未登录状态
            {
                string p_version    = UDBConstDefinition.DefaultInstance.UnifyPlatformVersion; //System.Configuration.ConfigurationManager.AppSettings["unifyPlatform_version"];
                string p_clientType = UDBConstDefinition.DefaultInstance.UnifyPlatformClientType;
                Result = _UDBMBoss.UnifyPlatformGetUserInfo(unifyPlatform_appId, unifyPlatform_appSecretKey, p_version, p_clientType, accessToken, clientIp, clientAgent, out accountInfo, out ErrMsg);

                if (Result == 0)  // 综合平台查询客户信息成功
                {
                    String CustID, OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
                    //检测对应用户是否在号百系统,不在,则注册进来
                    strMsg.Append("【开始注册到号百】:");
                    CustID = String.Empty;
                    System.Text.RegularExpressions.Regex regMobile = new System.Text.RegularExpressions.Regex(@"^1[345678]\d{9}$");
                    System.Text.RegularExpressions.Regex regEmail  = new System.Text.RegularExpressions.Regex(@"^[0-9a-zA-Z_\-\.]*[0-9a-zA-Z_\-]@[0-9a-zA-Z]+\.+[0-9a-zA-Z_\-.]+$");
                    System.Text.RegularExpressions.Regex regCard   = new System.Text.RegularExpressions.Regex(@"^(\d{9}|\d{16})$");

                    string AuthenType = "1";
                    strMsg.AppendFormat("accountInfo.username:{0}\r\n", accountInfo.userName);
                    strMsg.AppendFormat("acountInfo.userId:{0},accountInfo.pUserId:{1}\r\n", accountInfo.userId, accountInfo.pUserId);
                    if (regMobile.IsMatch(accountInfo.userName))
                    {
                        AuthenType = "2";
                    }
                    if (regEmail.IsMatch(accountInfo.userName))
                    {
                        AuthenType = "4";
                    }
                    if (regCard.IsMatch(accountInfo.userName))
                    {
                        AuthenType = "3";
                    }

                    if ("2".Equals(AuthenType))
                    {
                        //Result = UserRegistry.getUserRegistryUnifyPlatform(accountInfo, out CustID, out ErrMsg);
                        String OperType = "3"; // 注册
                        String Password = "";  // 从综合平台注册过来,密码是不知道的
                        RealName = "";
                        Result   = CIP2BizRules.BindCustInfoUnifyPlatform("02", "021", accountInfo.mobileName,
                                                                          accountInfo.emailName, RealName, Password, accountInfo.userId, SPID, OperType, out CustID, out ErrMsg);
                    }
                    else
                    {
                        Result = -7766;
                    }

                    //Result = UserRegistry.getUserRegistryUnifyPlatform(accountInfo, out CustID, out ErrMsg);


                    strMsg.AppendFormat("Result:{0},CustID:{1}\r\n", Result, CustID);
                    strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                    //注册成功
                    if (Result == 0)
                    {
                        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);
                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
                        if (Result != 0)
                        {
                            strMsg.Append(",ErrMsg:客户不存在" + CustID);
                            //客户不存在
                            Redirect("ErrMsg", "客户不存在");
                        }

                        //埋综合平台token
                        //String UnifyPlatformCookieName = ConfigurationManager.AppSettings["UnifyPlatformCookieName"];
                        //PageUtility.SetCookie(accessToken, UnifyPlatformCookieName, this.Page);

                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl + "?UnifyAccountCheckResult=0&SPID=35000000");

                        //埋号百token
                        string AuthenName = UserName;
                        AuthenType = "2";
                        SPInfoManager spInfo         = new SPInfoManager();
                        Object        SPData         = spInfo.GetSPData(this.Context, "SPData");
                        string        key            = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
                        UserToken     UT             = new UserToken();
                        string        UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, OuterID, CustType, AuthenName, AuthenType, key, out ErrMsg);
                        string        CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
                        PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);

                        //ReturnUrl = Request["ReturnUrl"] ;
                        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl + "?UnifyAccountCheckResult=0&SPID=35000000");
                        strMsg.AppendFormat("Response.Redirect to {0}\r\n", ReturnUrl + "?UnifyAccountCheckResult=0&SPID=35000000");
                        Response.Redirect(ReturnUrl + "?UnifyAccountCheckResult=0&SPID=35000000", false);
                    }
                    else
                    {
                        string CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
                        PageUtility.ExpireCookie(CookieName, this.Page);
                        Response.Redirect(ReturnUrl + "?UnifyAccountCheckResult=0&SPID=35000000", false);
                    }
                }
            }
            else  // 未登录
            {
                //清楚cookie (登录状态)
                string CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
                PageUtility.ExpireCookie(CookieName, this.Page);

                //PageUtility.ExpireCookie(UnifyPlatformCookieName, this.Page);

                Response.Redirect(ReturnUrl + "?UnifyAccountCheckResult=1&SPID=35000000", false);
            }

            //if ("0".Equals(result) && Result == 0)   // 认证成功 并且根据accesstoken查客户信息成功
            //{
            //    String CustID, OuterID, Status, CustType, CustLevel, RealName, UserName, NickName, CertificateCode, CertificateType, Sex, Email, EnterpriseID, ProvinceID, AreaID, RegistrationSource;
            //    //检测对应用户是否在号百系统,不在,则注册进来
            //    strMsg.Append("【开始注册到号百】:");
            //    Result = UserRegistry.getUserRegistryUnifyPlatform(accountInfo, out CustID, out ErrMsg);
            //    strMsg.AppendFormat("Result:{0},CustID:{1}\r\n", Result, CustID);
            //    strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            //    //注册成功
            //    if (Result == 0)
            //    {
            //        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);
            //        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            //        if (Result != 0)
            //        {
            //            strMsg.Append(",ErrMsg:客户不存在" + CustID);
            //            //客户不存在
            //            Redirect("ErrMsg", "客户不存在");
            //        }

            //        //埋综合平台token
            //        //String UnifyPlatformCookieName = ConfigurationManager.AppSettings["UnifyPlatformCookieName"];
            //        //PageUtility.SetCookie(accessToken, UnifyPlatformCookieName, this.Page);

            //        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);

            //        //埋号百token
            //        string AuthenName = UserName;
            //        string AuthenType = "2";
            //        SPInfoManager spInfo = new SPInfoManager();
            //        Object SPData = spInfo.GetSPData(this.Context, "SPData");
            //        string key = spInfo.GetPropertyBySPID("35000000", "SecretKey", SPData);
            //        UserToken UT = new UserToken();
            //        string UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, OuterID, CustType, AuthenName, AuthenType, key, out ErrMsg);
            //        string CookieName = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
            //        PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);
            //        //ReturnUrl = Request["ReturnUrl"] ;
            //        strMsg.AppendFormat("ReturnUrl: {0}\r\n", ReturnUrl);
            //        strMsg.AppendFormat("Response.Redirect to {0}\r\n", ReturnUrl);
            //        Response.Redirect(ReturnUrl, false);
            //    }
            //    else
            //    {
            //        strMsg.Append(",ErrMsg:用户注册到号百失败");

            //    }
            //}
        }
        catch (Exception excp)
        {
            strMsg.AppendFormat("异常:{0}\r\n", excp.ToString());
        }
        finally
        {
            WriteLog(strMsg.ToString());
        }
        //WriteLog(strMsg.ToString());
    }
Пример #24
0
    public String ModifyCustBasicInfo(string SPID, string CustID, string RealName, string NickName, string CertificateCode, string CertificateType, string Sex, string Email, string Birthday, string EducationLevel, string IncomeLevel, string ProvinceID, string AreaID, string Address, string Favorite, string HeadPic)
    {
        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(RealName) &&
            CommonUtility.IsEmpty(CertificateCode) &&
            CommonUtility.IsEmpty(CertificateType) &&
            CommonUtility.IsEmpty(Sex))
        {
            // 返回错误信息
            ResponseMsg.Length = 0;
            if ("json".Equals(wt))
            {
                ResponseMsg.Append("{");
                ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                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>", "997");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", "修改信息参数不能全为空!");
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }



        if (!CommonUtility.IsEmpty(EducationLevel))
        {
            if (EducationLevel.Equals("1") || EducationLevel.Equals("2") || EducationLevel.Equals("3") || EducationLevel.Equals("4") || EducationLevel.Equals("5") || EducationLevel.Equals("6"))
            {
            }
            else
            {
                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "997");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "教育水平能1-6!");
                    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>", "教育水平能1-6!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }

        if (!CommonUtility.IsEmpty(IncomeLevel))
        {
            if (IncomeLevel.Equals("1") || IncomeLevel.Equals("2") || IncomeLevel.Equals("3") || IncomeLevel.Equals("4") || IncomeLevel.Equals("5"))
            {
            }
            else
            {
                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "998");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "收入水平能1-5!");
                    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>", "收入水平能1-5!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }


        if (!CommonUtility.IsEmpty(CertificateType))
        {
            if (CertificateType.Equals("0") || CertificateType.Equals("1") || CertificateType.Equals("2") || CertificateType.Equals("3") || CertificateType.Equals("4") || CertificateType.Equals("5") || CertificateType.Equals("6") || CertificateType.Equals("7") || CertificateType.Equals("8") || CertificateType.Equals("9"))
            {
            }
            else
            {
                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "999");
                    ResponseMsg.AppendFormat("\"errmsg\":\"{0}\"", "证件类型只能0-9!");
                    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>", "证件类型只能0-9!");
                    ResponseMsg.Append("</PARAMETERS>");
                    ResponseMsg.Append("</PayPlatRequestParameter>");
                }
                return(ResponseMsg.ToString());
            }
        }

        // 省代码 地市代码校验

        #endregion
        try
        {
            Result = CustBasicInfo.UpdateCustinfo(SPID, CustID, RealName, CertificateCode, CertificateType, Sex, Email, out ErrMsg);
            if (Result == 0)
            {
                //通知积分平台
                CIP2BizRules.InsertCustInfoNotify(CustID, "2", SPID, "", "0", out ErrMsg);
                // 这里要判断该客户是否已经开过户,如果是开户的,并且修改了身份证的才同步
                //CIP2BizRules.NotifyBesttoneAccountInfo(SPID, CustID, 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
            {
                // 返回错误信息
                ResponseMsg.Length = 0;
                if ("json".Equals(wt))
                {
                    ResponseMsg.Append("{");
                    ResponseMsg.AppendFormat("\"errcode\":\"{0}\",", "-989");
                    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>", "-989");
                    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}\",", "-989");
                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>", "-989");
                ResponseMsg.AppendFormat("<ErrMsg>{0}</ErrMsg>", exp.ToString());
                ResponseMsg.Append("</PARAMETERS>");
                ResponseMsg.Append("</PayPlatRequestParameter>");
            }
            return(ResponseMsg.ToString());
        }
        return(ResponseMsg.ToString());
    }
Пример #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int    Result = 0;
        String ErrMsg = "";

        if (!this.IsPostBack)
        {
            if (CommonUtility.IsParameterExist("MERCHANTID", this.Page))
            {
                MERCHANTID = Request["MERCHANTID"];
            }
            if (CommonUtility.IsParameterExist("ORDERSEQ", this.Page))
            {
                ORDERSEQ = Request["ORDERSEQ"];
            }
            if (CommonUtility.IsParameterExist("TRANSDATE", this.Page))
            {
                TRANSDATE = Request["TRANSDATE"];
            }
            if (CommonUtility.IsParameterExist("AUTHCODE", this.Page))
            {
                AUTHCODE = Request["AUTHCODE"];
            }
            if (CommonUtility.IsParameterExist("ACCOUNT", this.Page))
            {
                ACCOUNT = Request["ACCOUNT"];
            }
            if (CommonUtility.IsParameterExist("USERACCOUNT", this.Page))
            {
                USERACCOUNT = Request["USERACCOUNT"];
            }
            if (CommonUtility.IsParameterExist("RTNCODE", this.Page))
            {
                RTNCODE = Request["RTNCODE"];
            }
            if (CommonUtility.IsParameterExist("MAC", this.Page))
            {
                MAC = Request["MAC"];
            }
            String BestpayKey = System.Configuration.ConfigurationManager.AppSettings["BestpayKey"];
            //MERCHANTID=0018888888&ORDERSEQ=20120626114801001&TRANSDATE=20120626&AUTHCODE=AV12346&ACCOUNT=18901951201&USERACCOUNT=xiakun &RTNCODE=0&KEY= KWSDAWAD
            String newMAC = GetMD5Hash("MERCHANTID=" + MERCHANTID + "&ORDERSEQ=" + ORDERSEQ + "&TRANSDATE=" + TRANSDATE + "&AUTHCODE=" + AUTHCODE + "&ACCOUNT=" + ACCOUNT + "&USERACCOUNT=" + USERACCOUNT + "&RTNCODE=" + RTNCODE + "&KEY=" + BestpayKey);
            if (MAC.Equals(newMAC))
            {
                // 1.在客户信息平台中绑定AUTHCODE->custid  //ACCOUNT=custid
                Result = CIP2BizRules.BindingBestpayAccount2BesttoneAccount("3", USERACCOUNT, ACCOUNT, out ErrMsg);
                if (Result == 0)
                {
                    Response.Write("00");
                    // 2.返回翼支付一个返回值
                }
                else
                {
                    Response.Write(Result);
                }


                // 3.通知精品商城
            }
        }
    }
Пример #26
0
    public CustInfoUploadResult CustInfoUpload(string ProvinceID, string ID, string CustType, string CustAccount, string CustLevel,
                                               string RealName, string ContactTel, string Address, string ZipCode, string CertificateCode,
                                               string CertificateType, string AreaID, string Sex, string Email, string dealType, AuthenRecord[] AuthenRecords, string ExtendField)
    {
        CustInfoUploadResult Result = new CustInfoUploadResult();
        string SPID = "";

        Result.Result           = ErrorDefinition.IError_Result_UnknowError_Code;
        Result.ErrorDescription = "";
        Result.ID          = ID;
        Result.ExtendField = "";
        Result.CustID      = "";
        string strXML = "";



        try
        {
            #region 数据校验

            if (CommonUtility.IsEmpty(ProvinceID))
            {
                Result.Result           = ErrorDefinition.BT_IError_Result_InValidProvinceID_Code;
                Result.ErrorDescription = "ProvinceID不能为空";
                return(Result);
            }


            if (CommonUtility.IsEmpty(CustType))
            {
                Result.Result           = ErrorDefinition.BT_IError_Result_InValidUserType_Code;
                Result.ErrorDescription = "CUstType不能为空";
                return(Result);
            }


            if (CommonUtility.IsEmpty(CustLevel))
            {
                Result.Result           = ErrorDefinition.BT_IError_Result_InValidCustLevel_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidCustLevel_Msg + ",不能为空";
                return(Result);
            }
            if (CustType.Length != 2)
            {
                Result.Result           = ErrorDefinition.BT_IError_Result_InValidUserType_Code;
                Result.ErrorDescription = "CustType无效,长度不为2";
                return(Result);
            }

            if (CommonUtility.IsEmpty(RealName))
            {
                Result.Result           = ErrorDefinition.BT_IError_Result_InValidPassword_Code;
                Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidRealName_Msg + ",不能为空";
                return(Result);
            }


            if (!CommonUtility.IsEmpty(ExtendField))
            {
                SPID = CommonBizRules.GetValueFromXmlStr(ExtendField, "SPID");
            }

            switch (CustType)
            {
            case "01":
                CustType = "14";
                break;

            case "02":
                CustType = "20";
                break;

            case "03":
                CustType = "12";
                break;

            case "09":
                CustType = "90";
                break;

            case "11":
                CustType = "30";
                break;

            case "00":
                CustType = "42";
                break;
            }


            Result.Result = BTForCrmBizRules.CustInfoUpload(ProvinceID, ID, CustType, CustAccount, CustLevel,
                                                            RealName, ContactTel, Address, ZipCode, CertificateCode,
                                                            CertificateType, AreaID, Sex, Email, dealType, ExtendField, AuthenRecords, SPID, out Result.CustID, out Result.ErrorDescription);

            if (Result.Result == 0)
            {
                //通知积分系统
                CIP2BizRules.InsertCustInfoNotify(Result.CustID, "2", System.Configuration.ConfigurationManager.AppSettings["ScoreBesttoneSPID"], "", dealType, out Result.ErrorDescription);
            }
            strXML = BTBizRules.GenerateResultXml(Result.Result.ToString(), Result.ErrorDescription);
            #endregion
        }
        catch (Exception ex)
        {
            Result.Result           = ErrorDefinition.IError_Result_System_UnknowError_Code;
            Result.ErrorDescription = ErrorDefinition.IError_Result_System_UnknowError_Msg + "," + ex.Message;
        }
        finally
        {
            #region WriteLog
            StringBuilder msg = new StringBuilder();
            msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n\r\n");
            msg.Append("Crm客户同步接口 " + DateTime.Now.ToString("u") + "\r\n");
            msg.Append(";ProvinceID - " + ProvinceID);
            msg.Append(";ID - " + ID);
            msg.Append(";CustType - " + CustType);
            msg.Append(";CustAccount - " + CustAccount);
            msg.Append(";CustLevel - " + CustLevel);
            msg.Append(";RealName - " + RealName);
            msg.Append(";ContactTel - " + ContactTel);
            msg.Append(";Address - " + Address);
            msg.Append(";ZipCode - " + ZipCode);
            msg.Append(";CertificateCode - " + CertificateCode);
            msg.Append(";CertificateType - " + CertificateType);
            msg.Append(";AreaID - " + AreaID);
            msg.Append(";Sex - " + Sex);
            msg.Append(";Email - " + Email);
            msg.Append(";dealType - " + dealType);
            msg.Append(";ExtendField - " + ExtendField);
            msg.Append(";strXML - " + strXML);

            if (AuthenRecords != null)
            {
                if (AuthenRecords.Length > 0)
                {
                    for (int i = 0; i < AuthenRecords.Length; i++)
                    {
                        msg.Append(";AuthenType - " + AuthenRecords[i].AuthenType);
                        msg.Append(";AuthenName - " + AuthenRecords[i].AuthenName);
                    }
                }
            }
            msg.Append(";ExtendField - " + ExtendField);
            msg.Append("\r\n");
            msg.Append("处理结果 - " + Result.Result);
            msg.Append("; 错误描述 - " + Result.ErrorDescription);
            msg.Append("; CustID - " + Result.CustID);
            msg.Append("; ID - " + Result.ID);
            msg.Append("; ErrorDescription - " + Result.ErrorDescription);
            msg.Append("; ExtendField - " + Result.ExtendField + "\r\n");
            msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n");

            BTUCenterInterfaceLog.CenterForCRM("CustInfoUpload", msg);
            #endregion
        }

        return(Result);
    }
Пример #27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder strLog = new StringBuilder();

        try
        {
            if (!IsPostBack)
            {
                strLog.AppendFormat("BesttoneAccountMain");
                ParseSPTokenRequest();

                if (Result == 0)
                {
                    CreateSPTokenRequest();

                    //int QueryResult = 0;
                    strLog.AppendFormat("CustID:{0},SPID{1},HeadFooter{2}", CustID, SPID, HeadFooter);
                    if ("yes".Equals(HeadFooter))
                    {
                        this.header.Visible = true;
                        this.footer.Visible = true;
                    }
                    else
                    {
                        this.header.Visible = false;
                        this.footer.Visible = false;
                    }

                    //PhoneRecord[] phones = CustBasicInfo.getPhoneRecord(CustID, out QueryResult, out ErrMsg);
                    String qryPhone = "";
                    //if (QueryResult == 0 && phones != null && phones.Length > 0)                    {
                    //    strLog.AppendFormat("getPhoneRecord成功!");
                    //    phoneNum = phones[0].Phone;

                    //    strLog.AppendFormat("根据CustID获得手机号:CustID:{0},phoneNum:{1}", CustID, phoneNum);

                    string BindedBestpayAccount = "";
                    IsBesttoneAccountBindV5Result = CIP2BizRules.IsBesttoneAccountBindV5(CustID, out BindedBestpayAccount, out CreateTime, out ErrMsg);
                    strLog.AppendFormat("IsBesttoneAccountBindV5Result:{0},ErrMsg:{1},CustID:{2},CreateTime:{3},BindedBestpayAccount:{4}", IsBesttoneAccountBindV5Result, ErrMsg, CustID, CreateTime, BindedBestpayAccount);

                    // 0 代表 绑定
                    if (IsBesttoneAccountBindV5Result == 0)
                    {
                        AccountItem ai = new AccountItem();
                        BesttoneAccount = phoneNum;
                        BesttoneAccount = ai.AccountName;


                        if (!String.IsNullOrEmpty(BindedBestpayAccount))
                        {
                            qryPhone = BindedBestpayAccount;
                        }
                        else
                        {
                            qryPhone = phoneNum;
                        }


                        String ResponseCode = "";
                        int    QueryBesttoneAccountResult = BesttoneAccountHelper.BesttoneAccountInfoQuery(qryPhone, out ai, out ResponseCode, out ErrMsg);

                        Linkage.BestTone.Interface.Rule.CustInfo custInfo = new Linkage.BestTone.Interface.Rule.CustInfo();
                        int resultQuerycustInfo = BesttoneAccountHelper.QueryCustInfo(qryPhone, out custInfo, out ErrMsg);
                        if (resultQuerycustInfo == 0)
                        {
                            BesttoneAccount = custInfo.CustomerName;
                        }

                        if (QueryBesttoneAccountResult == 0)
                        {
                            if (ai != null)
                            {
                                //页面赋值

                                if ("0".Equals(ai.AccountStatus))
                                {
                                    //this.AccountStatus.InnerText = "未激活";
                                    BesttoneAccountStatus = "未激活";
                                }
                                else if ("1".Equals(ai.AccountStatus))
                                {
                                    //this.AccountStatus.InnerText = "正常";
                                    BesttoneAccountStatus = "正常";
                                }
                                else if ("2".Equals(ai.AccountStatus))
                                {
                                    //this.AccountStatus.InnerText = "挂失";
                                    BesttoneAccountStatus = "挂失";
                                }
                                else if ("3".Equals(ai.AccountStatus))
                                {
                                    //this.AccountStatus.InnerText = "冻结";
                                    BesttoneAccountStatus = "冻结";
                                }
                                else if ("4".Equals(ai.AccountStatus))
                                {
                                    //this.AccountStatus.InnerText = "锁定";
                                    BesttoneAccountStatus = "锁定";
                                }
                                else if ("9".Equals(ai.AccountStatus))
                                {
                                    //this.AccountStatus.InnerText = "已销户";
                                    BesttoneAccountStatus = "已销户";
                                }
                                else
                                {
                                    //this.AccountStatus.InnerText = "";
                                    BesttoneAccountStatus = "";
                                }

                                BesttoneAccountBalance = BesttoneAccountHelper.ConvertAmountToYuan(ai.AccountBalance);
                            }
                            else
                            {
                            }
                        }
                        else
                        {
                            if ("200010".Equals(ResponseCode))
                            {
                                BesttoneAccountStatus  = "账户未开通";
                                BesttoneAccountBalance = "0.00";
                            }
                        }
                    }


                    Int64 balance = 0;

                    // 最近交易查询

                    String txnType = "";       // 121020充值
                    //131010消费
                    //131030退费

                    String txnChannel = "02";      //WEB

                    int maxReturnRecord = 30;
                    int startRecord     = 1;
                    //int QueryAllTypeTxnResult = BesttoneAccountHelper.QueryAllTypeTxn(phoneNum, txnType, txnChannel, out txnItemList, out ErrMsg);

                    int QueryChargeResult = CIP2BizRules.QueryBestPayAllTxn(qryPhone, txnType, txnChannel, maxReturnRecord, startRecord, out txnItemList, out ErrMsg);

                    //txnType = "131090";

                    //}  // custphone query end
                    //else   // custphone query end
                    //{
                    //    strLog.AppendFormat("ErrMsg:{0}", ErrMsg);

                    //}  // custphone query end
                }
                else
                {
                    Response.Redirect("ErrorInfo.aspx?ErrorInfo=" + ErrMsg);
                }
            }
        }
        catch (System.Exception ex)
        {
            log(ex.ToString());
        }
        finally
        {
            log(strLog.ToString());
        }
    }
Пример #28
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);
        }
    }
    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());
        }
    }
Пример #30
0
    protected void ssoFunc()
    {
        string QH = System.Configuration.ConfigurationManager.AppSettings["HQList"];
        //上海,广州处理
        string UAOUTID = System.Configuration.ConfigurationManager.AppSettings["UAOUTIDLIst"];

        string UAProvinceID = Request.Cookies["UAProvinceID"].Value.ToString();

        //是否是SSO的省
        if (QH.IndexOf(UAProvinceID) < 0 && UAOUTID.IndexOf(UAProvinceID) < 0)
        {
            Response.Redirect("../ErrorInfo.aspx?Result=-19999&ErrorInfo=未开通单点登录&FunctionName=请从 http://jf.ct10000.com 直接登入集团积分商城", true);
            return;
        }

        MBOSSClass mboss            = new MBOSSClass();
        string     AssertionAddress = Request.Cookies["AssertionAddress"].Value.ToString();         //获取断言查询地址
        string     TransactionID    = Request.Cookies["TransactionID"].Value.ToString();            //获取流水号

        string xml    = "";
        int    result = -19999;
        string ErrMsg = "";

        string SPID = UAProvinceID + "999991";
        string CustID = "", RealName = "", NickName = "", UserName = "", OutID = "", UserAccount = "", CustType = "", ProvinceID = "", AuthenName = "", AuthenType = "";

        try
        {
            SPInfoManager spInfo = new SPInfoManager();
            Object        SPData = spInfo.GetSPData(this.Context, "SPData");
            //密钥
            string key = spInfo.GetPropertyBySPID(SPID, "SecretKey", SPData);
            //断言
            MBOSSClass.BilByCompilingResult bil = new MBOSSClass.BilByCompilingResult();
            //查询断言并解析
            result     = mboss.SendUATicket(UAProvinceID, SPID, UATicket, AssertionAddress, this.Context, "SPCAData", TransactionID, out bil, out xml, out ErrMsg);
            AuthenType = bil.AccountType;
            AuthenName = bil.AccountID;

            if (result != 0)
            {
                Response.Redirect("../ErrorInfo.aspx?Result=-19999&ErrorInfo=请从网厅登陆1&FunctionName=请从网厅登陆1", true);
                return;
            }
            //用户入库是否存在
            int    type           = 0;
            string p              = bil.AccountID;
            string dealType       = "";
            string areaid         = "";
            string jtUAProvinceID = "";

            log("UAProvinceID:集团ua:" + UAProvinceID);

            if ("35".Equals(UAProvinceID))
            {
                if (!"".Equals(bil.ProvinceID))
                {
                    jtUAProvinceID = bil.ProvinceID;
                }
                else
                {
                    jtUAProvinceID = UAProvinceID;
                }

                result = 0;
                type   = 1;
            }
            else
            {
                result = BTForBusinessSystemInterfaceRules.MUserAuthV2(SPID, UAProvinceID, bil.AccountID, bil.AccountType, bil.AccountInfos, Context,
                                                                       out ErrMsg, out CustID, out UserAccount, out CustType, out OutID, out ProvinceID,
                                                                       out RealName, out UserName, out NickName, out dealType, out type, out areaid);
                log(bil.ProvinceID + "-!35-BTForBusinessSystemInterfaceRules.MUserAuthV2:" + result + "-bil.ProvinceID=" + bil.ProvinceID + "-UAProvinceID=" + UAProvinceID + "-areaid=" + areaid + "-custid=" + CustID + "-OutID=" + OutID + "-ErrMsg=" + ErrMsg);
            }

            string CustID1   = CustID;
            string RealName1 = "";
            string UserName1 = "";
            string NickName1 = "";
            string CustType1 = "";
            log("MUserAuthV2:" + result + ";CustID=" + CustID + " @----@" + ErrMsg + "==" + type);
            if (result != 0)
            {
                Response.Redirect("../ErrorInfo.aspx?Result=-19999&ErrorInfo=" + ErrMsg + "&FunctionName=请从网厅登陆2", true);
                return;
            }
            //模式3情况下,获取证件号和类型
            string TestStr = "";
            if (type == 1)
            {
                string OutID1 = "";
                if (QH.IndexOf(UAProvinceID) >= 0)
                {
                    if (bil.AccountType == "9" || bil.AccountType == "10" || bil.AccountType == "11")
                    {
                        if (areaid != "")
                        {
                            bil.AccountID = areaid + "-" + bil.AccountID;
                        }
                    }
                }
                else if (UAOUTID.IndexOf(UAProvinceID) >= 0)
                {
                    bil.AccountID   = OutID;
                    bil.AccountType = "99";

                    RealName = bil.AccountID;
                }
                else
                {
                    if (bil.AccountType == "9" || bil.AccountType == "10" || bil.AccountType == "11")
                    {
                        string phone = "";
                        areaid = BTForBusinessSystemInterfaceRules.PhoneToArea(UAProvinceID, bil.AccountID, out phone);
                        if (areaid != "")
                        {
                            bil.AccountID = areaid + "-" + phone;
                        }
                    }
                }

                int result1 = -1234;
                if ("35".Equals(UAProvinceID))
                {
                    log("CrmSSO.UserAuthCrm1:provinceid=" + bil.ProvinceID + ";areacode:" + bil.AccountInfos[0].areaid + ";accountid:" + bil.AudienceID + "|TestStr=" + TestStr);
                    result1 = CrmSSO.UserAuthCrm1(bil.ProvinceID, bil.AccountInfos[0].areaid, bil.AccountType, bil.AccountID, p, "", "0", UAProvinceID + "999991", this.Context, out RealName1, out UserName1, out NickName1, out OutID1, out CustType1, out CustID1, out ErrMsg, out TestStr);
                }
                else
                {
                    result1 = CrmSSO.UserAuthCrm(UAProvinceID, bil.AccountType, bil.AccountID, p, "", "0", UAProvinceID + "999991", this.Context, out RealName1, out UserName1, out NickName1, out OutID1, out CustType1, out CustID1, out ErrMsg, out TestStr);
                }

                if (result1 == 0)
                {
                    OutID    = OutID1;
                    CustID   = CustID1;
                    CustType = CustType1;
                }
                else
                {
                    Response.Redirect("../ErrorInfo.aspx?Result=" + result1 + "&ErrorInfo=" + ErrMsg + "&FunctionName=请从网厅登陆5", true);
                    return;
                }
                UserName = RealName1;
                NickName = RealName1;
                log(result1 + "==" + UAProvinceID + "=UAProvinceID;" + bil.AccountType + " =bil.AccountType;" + bil.AccountID + "=bil.AccountID;" + "" + "" + RealName + "=RealName;" + UserName + "=UserName;" + NickName +
                    "=NickName;" + OutID + "=OutID;" + CustType + "=CustType;" + CustID + "=CustID1;" + ErrMsg + "=ErrMsg");
            }

            if (dealType == "0")             //通知积分系统
            {
                CIP2BizRules.InsertCustInfoNotify(CustID, "2", System.Configuration.ConfigurationManager.AppSettings["ScoreBesttoneSPID"], "", "0", out ErrMsg);
            }

            //生成cookie
            UserToken UT             = new UserToken();
            string    UserTokenValue = UT.GenerateUserToken(CustID, RealName, UserName, NickName, OutID, CustType, AuthenName, AuthenType, key, out ErrMsg);
            string    CookieName     = System.Configuration.ConfigurationManager.AppSettings["CookieName"];
            PageUtility.SetCookie(UserTokenValue, CookieName, this.Page);

            //生成ticket
            result = CIPTicketManager.insertCIPTicket(TransactionID, SPID, CustID, RealName, NickName, UserName, OutID, "", AuthenName, AuthenType, out ErrMsg);
            log("insertCIPTicket:" + ErrMsg + result);
            if (result != 0)
            {
                Response.Redirect("../ErrorInfo.aspx?Result=-19999&ErrorInfo=请从网厅登陆3&FunctionName=请从网厅登陆3", true);
                return;
            }

            string Url = Request.Cookies["ReturnURL"].Value.ToString(); // System.Configuration.ConfigurationManager.AppSettings["SSOReturnURL"]; ;

            PageUtility.ExpireCookie("ReturnURL", this.Page);
            PageUtility.ExpireCookie("SPID", this.Page);
            PageUtility.ExpireCookie("UAProvinceID", this.Page);
            PageUtility.ExpireCookie("TransactionID", this.Page);

            Response.Redirect(Url + "?Ticket=" + TransactionID);
        }
        catch (System.Exception ex)
        {
            ErrMsg = ex.Message;
        }
        finally
        {
            try
            {
                CommonBizRules.WriteDataCustAuthenLog(SPID, CustID, ProvinceID, AuthenType, AuthenName, "2", result, ErrMsg);
            }
            catch { }
        }
    }