예제 #1
0
        public void ProcessRequest(HttpContext context)
        {
            string    DataString        = CommonTools.GetRequest(context);
            JsonEMail newPhoneLoginInfo = LitJson.JsonMapper.ToObject <JsonEMail>(DataString);
            string    MyConn            = System.Configuration.ConfigurationManager.AppSettings["DBAccounts"];
//             string MyConn = "server=103.105.58.140;uid=testdb;pwd=123abc;database=RYAccountsDB;Trusted_Connection=no";
            SqlConnection MyConnection = new SqlConnection(MyConn);

            try
            {
                MyConnection.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = MyConnection;
                cmd.CommandText = "GSP_MB_AccountsEmailAdd";
                cmd.Parameters.Add(new SqlParameter("@dwUserID", newPhoneLoginInfo.dwUserID));
                cmd.Parameters.Add(new SqlParameter("@szTitle", newPhoneLoginInfo.szTitle));
                cmd.Parameters.Add(new SqlParameter("@nType", newPhoneLoginInfo.nType));
                cmd.Parameters.Add(new SqlParameter("@nSatus", newPhoneLoginInfo.nStatus));
                cmd.Parameters.Add(new SqlParameter("@szMessage", newPhoneLoginInfo.szMessage));
                cmd.Parameters.Add(new SqlParameter("@szSender", newPhoneLoginInfo.szSender));
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.ExecuteNonQuery();
                CommonTools.SendStringToClient(context, 0, "Suss");
            }
            catch (Exception exp)
            {
                CommonTools.SendStringToClient(context, 1, "ErrorJson:" + exp.Message.ToString() + "-" + exp.StackTrace.ToString());
            }
            finally
            {
                MyConnection.Close();
            }
        }
예제 #2
0
        public static void AddEmail(JsonEMail newPhoneLoginInfo)
        {
            var prams = new List <DbParameter>();

            prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("dwUserID", newPhoneLoginInfo.dwUserID));
            prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szTitle", newPhoneLoginInfo.szTitle));
            prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("nType", newPhoneLoginInfo.nType));
            prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("nSatus", newPhoneLoginInfo.nStatus));
            prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szMessage", newPhoneLoginInfo.szMessage));
            prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szDescribe", newPhoneLoginInfo.szTitle));
            prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szSender", newPhoneLoginInfo.szSender));

            FacadeManage.aideAccountsFacade.DataProvider.GetDbHelper().RunProc("GSP_MB_AccountsEmailAdd", prams);
        }
예제 #3
0
        public void ProcessRequest(HttpContext context)
        {
            MailRetureCode newMailRetureCode = new MailRetureCode();
            string         DataString        = CommonTools.GetRequest(context);
            UserAccount    newPhoneLoginInfo = LitJson.JsonMapper.ToObject <UserAccount>(DataString);
            string         MyConn            = System.Configuration.ConfigurationManager.AppSettings["DBAccounts"];
//             string MyConn = "server=103.105.58.140;uid=testdb;pwd=123abc;database=RYAccountsDB;Trusted_Connection=no";
            SqlConnection MyConnection = new SqlConnection(MyConn);

            try
            {
                MyConnection.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = MyConnection;
                cmd.CommandText = "GSP_MB_AccountsEmailRead";
                cmd.Parameters.Add(new SqlParameter("@dwUserID", newPhoneLoginInfo.dwUserID));
                cmd.Parameters.Add(new SqlParameter("@szDescribe", ""));

                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataReader _SqlDataReader = cmd.ExecuteReader();
                while (_SqlDataReader.Read())
                {
                    JsonEMail newJsonEMail = new JsonEMail();
                    newJsonEMail.dwUserID = newPhoneLoginInfo.dwUserID;
                    newJsonEMail.dwMail   = int.Parse(_SqlDataReader.GetSqlValue(0).ToString());
                    //newJsonEMail.dwMail = _SqlDataReader.GetInt32(1);
                    newJsonEMail.szTitle    = _SqlDataReader.GetSqlValue(2).ToString();
                    newJsonEMail.nType      = int.Parse(_SqlDataReader.GetSqlValue(3).ToString());
                    newJsonEMail.nStatus    = int.Parse(_SqlDataReader.GetSqlValue(4).ToString());
                    newJsonEMail.szSendTime = _SqlDataReader.GetSqlValue(5).ToString();
                    newJsonEMail.szMessage  = _SqlDataReader.GetSqlValue(6).ToString();
                    newJsonEMail.szMessage  = newJsonEMail.szMessage.Replace("\\n", "\n");
                    newJsonEMail.szSender   = _SqlDataReader.GetSqlValue(7).ToString();

                    newMailRetureCode.emails.Add(newJsonEMail);
                }
                _SqlDataReader.Close();
                CommonTools.SendStringToClient(context, newMailRetureCode);
                return;
            }
            catch (Exception exp)
            {
                newMailRetureCode.code = 1;
                CommonTools.SendStringToClient(context, 1, "ErrorJson:" + exp.Message.ToString() + "-" + exp.StackTrace.ToString());
            }
            finally
            {
                MyConnection.Close();
            }
        }
예제 #4
0
        public void ProcessRequest(HttpContext context)
        {
            RetureCode   newRetureCode = new RetureCode();
            Stream       sm            = context.Request.InputStream;
            StreamReader inputData     = new StreamReader(sm);
            string       DataString    = inputData.ReadToEnd();

            try
            {
                BindPhoneNum newPhoneLoginInfo = LitJson.JsonMapper.ToObject <BindPhoneNum>(DataString);
                CodeData     _CodeData         = PhoneCode.GPhoneCode.CheckCode(newPhoneLoginInfo.CountryCode,
                                                                                newPhoneLoginInfo.PhoneNum, newPhoneLoginInfo.PhoneCode);
                if (_CodeData == null)
                {
                    newRetureCode.code = 4;
                    newRetureCode.msg  = "无效验证码";
                    PhoneCodeLogin.SendStringToClient(context, LitJson.JsonMapper.ToJson(newRetureCode));
                    return;
                }
                string Passw = CommonTools.CreatePassWord(12);
                if (BindAccount(newPhoneLoginInfo.AccountId,
                                _CodeData.PhoneNum, CommonTools.GetMD5Hash(Passw), newPhoneLoginInfo.Mac, newRetureCode))
                {
                    newRetureCode.code = 0;
                    newRetureCode.msg  = Passw;
                    AppleInapp.AddScoreByBinding(300, newPhoneLoginInfo.AccountId);
                    JsonEMail newJsonEMail = new JsonEMail();
                    newJsonEMail.dwUserID  = newPhoneLoginInfo.AccountId;
                    newJsonEMail.nStatus   = 0;
                    newJsonEMail.szTitle   = "绑定成功";
                    newJsonEMail.szMessage = "绑定成功手机号,赠送3.00";
                    newJsonEMail.szSender  = "系统";
                    newJsonEMail.nType     = 0;
                    newJsonEMail.nStatus   = 0;
                    EmailAdd.AddEmail(newJsonEMail);
                }
            }
            catch (Exception exp)
            {
                newRetureCode.code = 100;
                newRetureCode.msg  = DataString + "--" + exp.Message.ToString() + "-" + exp.StackTrace;
            }
            PhoneCodeLogin.SendStringToClient(context, LitJson.JsonMapper.ToJson(newRetureCode));
        }
예제 #5
0
        public static bool PostInApp(bool bTest, int UserId, string json, out int _ReturnSoce, out string msg)
        {
            _ReturnSoce = 0;
            msg         = "";
            string returnmessage = "";

            try
            {
                LitJson.JsonData newData = new LitJson.JsonData();
                newData["receipt-data"] = json;
                json = newData.ToJson();
                byte[] postBytes = Encoding.UTF8.GetBytes(json);
                System.Net.WebRequest request = null;
                if (bTest)
                {
                    request = System.Net.HttpWebRequest.Create("https://sandbox.itunes.apple.com/verifyReceipt");
                }
                else
                {
                    request = System.Net.HttpWebRequest.Create("https://buy.itunes.apple.com/verifyReceipt");
                }
                request.Method        = "POST";
                request.ContentType   = "application/json";
                request.ContentLength = postBytes.Length;
                using (var stream = request.GetRequestStream())
                {
                    stream.Write(postBytes, 0, postBytes.Length);
                    stream.Flush();
                }
                var    sendresponse     = request.GetResponse();
                string sendresponsetext = "";
                using (var streamReader = new StreamReader(sendresponse.GetResponseStream()))
                {
                    sendresponsetext = streamReader.ReadToEnd().Trim();
                }
                returnmessage = sendresponsetext;
                if (returnmessage.Length < 50)
                {
                    msg = "验证失败";
                    return(false);
                }
                AppleReturnData _AppleReturnData = LitJson.JsonMapper.ToObject <AppleReturnData>(sendresponsetext);
//                 if (_AppleReturnData.receipt.bundle_id != "com.c2dxluagm.RoyalHall")
//                 {
//                     msg = "bundle_id 不正确";
//                     return false;
//                 }
                string[] productString = _AppleReturnData.receipt.in_app[0].product_id.Split('.');
                if (productString.Length <= 2)
                {
                    msg = "验证失败";
                    return(false);
                }
                int Price = 0;
                int.TryParse(productString[productString.Length - 1], out Price);
                Price = Price * 100;
                bool rlt = AddSorce(UserId, Price, _AppleReturnData, out _ReturnSoce);
                if (!rlt)
                {
                    msg = "已经验证过了";
                }

                JsonEMail newEmail = new JsonEMail();
                newEmail.dwUserID   = UserId;
                newEmail.nStatus    = 0;
                newEmail.szTitle    = "支付成功";
                newEmail.szMessage  = "IOS内购交易:支付成功[" + (Price / 100).ToString() + ".00]";
                newEmail.szSender   = "系统";
                newEmail.szSendTime = DateTime.Now.ToString();
                EmailAdd.AddEmail(newEmail);

                return(rlt);
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
            return(false);
        }
예제 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            System.IO.StreamReader sm = new System.IO.StreamReader(Request.InputStream);
            string MoneyRequestStr    = sm.ReadToEnd();

            Debug.Log("AliNotify_url", MoneyRequestStr);


            /* 实际验证过程建议商户添加以下校验。
             * 1、商户需要验证该通知数据中的out_trade_no是否为商户系统中创建的订单号,
             * 2、判断total_amount是否确实为该订单的实际金额(即商户订单创建时的金额),
             * 3、校验通知中的seller_id(或者seller_email) 是否为out_trade_no这笔单据的对应的操作方(有的时候,一个商户可能有多个seller_id/seller_email)
             * 4、验证app_id是否为该商户本身。
             */
            Dictionary <string, string> sArray = GetRequestPost();
            Debug.Log("AliNotify_url-sArray", sArray.Count.ToString());

            if (sArray.Count != 0)
            {
                bool flag = true;
                //bool flag = AlipaySignature.RSACheckV1(sArray, config.alipay_public_key, config.charset, config.sign_type, false);
                if (flag)
                {
                    //交易状态
                    //判断该笔订单是否在商户网站中已经做过处理
                    //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                    //请务必判断请求时的total_amount与通知时获取的total_fee为一致的
                    //如果有做过处理,不执行商户的业务程序

                    //注意:
                    //退款日期超过可退款期限后(如三个月可退款),支付宝系统发送该交易状态通知
                    string trade_status = Request.Form["trade_status"];
                    string out_trade_no = Request.Form["out_trade_no"]; //商户订单号
                    string total_fee    = Request.Form["total_amount"]; //交易金额
                    string buyer_id     = Request.Form["buyer_id"];     //买家支付宝用户号
                    string buyer_email  = Request.Form["buyer_email"];  //买家支付宝账号
                    string trade_no     = Request.Form["trade_no"];     //支付宝交易号

                    /*
                     * string notify_id = Request.Form["notify_id"];//通知校验ID
                     * string sign = Request.Form["sign"];//签名
                     * string subject = Request.Form["subject"];//商品名称
                     * string quantity = Request.Form["quantity"];//购买数量
                     * string price = Request.Form["price"];//商品单价
                     * string body = Request.Form["body"];//商品描述
                     * string gmt_create = Request.Form["gmt_create"];//交易创建时间
                     * string gmt_payment = Request.Form["gmt_payment"];//交易付款时间
                     * */
                    PayData _Data = PayData.Find(out_trade_no, PayType.ALI_PAY);
                    if (_Data == null)
                    {
                        Debug.Log("Not find out_trade_no", out_trade_no);
                        _Data = PayData.Find(trade_no, PayType.ALI_PAY);
                    }
                    if (_Data == null || _Data.Status == 1)
                    {
                        Debug.Log("Not find trade_no", trade_no);
                        return;
                    }
                    _Data.Status = 1;

                    //     @dwUserID INT,								-- 用户 I D
                    //  @szTradeNo NVARCHAR(50),						-- 用户密码
                    //  @szPayTime NVARCHAR(50),					-- 连接地址
                    //  @fAmount float,					-- 机器标识
                    //  @PayStatus NVARCHAR(50),				-- 绑定帐号
                    //  @szBuyer_ID  NVARCHAR(50),
                    //  @szBuyer_Email  NVARCHAR(50),
                    //
                    var prams = new List <DbParameter>();
                    prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("dwUserID", _Data.UserId));
                    prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szTradeNo", out_trade_no));
                    prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szPayTime", DateTime.Now.ToString()));
                    prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("fAmount", _Data.Amount));
                    prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("PayStatus", 1));
                    prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szBuyer_ID", buyer_id));
                    prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szBuyer_Email", ""));
                    prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szPayType", PayType.ALI_PAY));
                    prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("strErrorDescribe", "suss"));

                    FacadeManage.aideAccountsFacade.DataProvider.GetDbHelper().RunProc("GSP_GP_AccountPay", prams);


                    //     public int dwUserID;    // 用户 I D
                    //     public int dwMail;      //邮件ID
                    //     public string szTitle = "邮件名称";  // 邮件名称
                    //     public int nType;       // 邮件类型
                    //     public int nStatus;      // 邮件状态
                    //     public string szSendTime=""; //收件时间 
                    //     public string szMessage="";// 邮件消息
                    //     public string szSender="";  //发件人

                    JsonEMail newEmail = new JsonEMail();
                    newEmail.dwUserID   = _Data.UserId;
                    newEmail.nStatus    = 0;
                    newEmail.szTitle    = "支付成功";
                    newEmail.szMessage  = "支付宝交易:支付成功[" + _Data.Amount.ToString() + "]";
                    newEmail.szSender   = "系统";
                    newEmail.szSendTime = DateTime.Now.ToString();

                    if (trade_status == "TRADE_FINISHED")
                    {
                        //判断该笔订单是否在商户网站中已经做过处理
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //如果有做过处理,不执行商户的业务程序

                        //注意:
                        //该种交易状态只在两种情况下出现
                        //1、开通了普通即时到账,买家付款成功后。
                        //2、开通了高级即时到账,从该笔交易成功时间算起,过了签约时的可退款时限(如:三个月以内可退款、一年以内可退款等)后。

                        // 金币入库
                        //                         ShareDetialInfo detailInfo = new ShareDetialInfo();
                        //                         detailInfo.OrderID = out_trade_no;
                        //                         detailInfo.IPAddress = Utility.UserIP;
                        //                         detailInfo.PayAmount = Convert.ToDecimal(total_fee);
                        //                         FacadeManage.aideTreasureFacade.FilliedMobile(detailInfo);
                        float xx = float.Parse(total_fee);
                        WebApplication1.AppleInapp.AddScore((int)(xx * 100), _Data.UserId, trade_no);
                        WebApplication1.EmailAdd.AddEmail(newEmail);
                    }
                    else if (trade_status == "TRADE_SUCCESS")
                    {
                        //判断该笔订单是否在商户网站中已经做过处理
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //如果有做过处理,不执行商户的业务程序

                        //注意:
                        //该种交易状态只在一种情况下出现——开通了高级即时到账,买家付款成功后。

                        // 金币入库
                        //                         ShareDetialInfo detailInfo = new ShareDetialInfo();
                        //                         detailInfo.OrderID = out_trade_no;
                        //                         detailInfo.IPAddress = Utility.UserIP;
                        //                         detailInfo.PayAmount = Convert.ToDecimal(total_fee);
                        //                         FacadeManage.aideTreasureFacade.FilliedMobile(detailInfo);
//                             WebApplication1.AppleInapp.AddScore((int)float.Parse(total_fee), _Data.UserId);

                        float xx = float.Parse(total_fee);
                        WebApplication1.AppleInapp.AddScore((int)(xx * 100), _Data.UserId, trade_no);


                        WebApplication1.EmailAdd.AddEmail(newEmail);
                    }
                    else
                    {
                    }

                    Response.Write("success");
                }
                else
                {
                    Response.Write("fail");
                }
            }
        }
        catch (Exception exp)
        {
            Debug.LogException(exp);
        }
    }
예제 #7
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            var configPayKey = ConfigurationManager.AppSettings["payKey"];
            var paySecretKey = ConfigurationManager.AppSettings["paySecretKey"];

            var requestContent = new StringBuilder();

            foreach (var item in context.Request.Params.Keys)
            {
                requestContent.AppendFormat("{0}={1},", item, context.Request.Params[item.ToString()]);
            }
            Debug.Log("银行卡付款成功提醒", requestContent.ToString());

            //验证签名
            var payKey          = context.Request["payKey"];
            var productName     = context.Request["productName"];
            var orderNo         = context.Request["orderNo"];
            var amount          = context.Request["orderPrice"];
            var payWayCode      = context.Request["payWayCode"];
            var payPayCode      = context.Request["payPayCode"];
            var orderDate       = context.Request["orderDate"];
            var orderTime       = context.Request["orderTime"];
            var remark          = context.Request["remark"];
            var trxNo           = context.Request["trxNo"];
            var field1          = context.Request["field1"];
            var field2          = context.Request["field2"];
            var field3          = context.Request["field3"];
            var field4          = context.Request["field4"];
            var field5          = context.Request["field5"];
            var tradeStatus     = context.Request["tradeStatus"];
            var reqSign         = context.Request["sign"];
            var validateRequest = new BankPayRequest();

            validateRequest.AddParams("payKey", payKey);
            validateRequest.AddParams("productName", productName);
            validateRequest.AddParams("orderNo", orderNo);
            validateRequest.AddParams("orderPrice", amount);
            validateRequest.AddParams("payWayCode", payWayCode);
            validateRequest.AddParams("orderDate", orderDate);
            validateRequest.AddParams("orderTime", orderTime);
            validateRequest.AddParams("remark", remark);
            validateRequest.AddParams("trxNo", trxNo);
            validateRequest.AddParams("field1", field1);
            validateRequest.AddParams("field2", field2);
            validateRequest.AddParams("field3", field3);
            validateRequest.AddParams("field4", field4);
            validateRequest.AddParams("field5", field5);
            validateRequest.AddParams("tradeStatus", tradeStatus);
            var generatedSign = validateRequest.GetSign(paySecretKey);

            if (generatedSign.Equals(reqSign, StringComparison.InvariantCultureIgnoreCase))
            {
                WriteError("签名不匹配", context);
                return;
            }


            //验证参数
            if (payKey != configPayKey)
            {
                WriteError("商户不匹配", context);
                return;
            }
            var prams = new List <DbParameter>();

            prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szTradeNo", orderNo));
            var result = FacadeManage.aideAccountsFacade.DataProvider.GetDbHelper().RunProcObjectList <AccountPay>("GSP_GP_QueryAccountPay", prams);

            if (result != null && result.Count > 0)
            {
                if (result[0].PayStatus == 1)
                {
                    WriteError("此订单已经充值成功", context);
                    return;
                }
            }
            var request = new BankPayRequest();

            request.AddParams("payKey", payKey);
            request.AddParams("orderNo", orderNo);
            var sign = request.GetSign(paySecretKey);

            request.AddParams("sign", sign);
            var param = request.ToParams();
            var url   = "http://api.quanyinzf.com:8050/rb-pay-web-gateway/scanPay/orderQuery?" + param;
            //url = "http://47.75.201.136:9000/proxy.ashx?url=" + HttpUtility.UrlEncode(url);
            var httpRequest = HttpWebRequest.Create(url);

            httpRequest.Method = "GET";
            using (var reader = new StreamReader(httpRequest.GetResponse().GetResponseStream()))
            {
                var content = reader.ReadToEnd().Trim();
                var data    = JsonMapper.ToObject(content);
                if (data["result"].ToString() == "success")
                {
                    var payRes = data["pay_result"].ToString();
                    if (payRes != "payed")
                    {
                        WriteError("充值失败", context);
                        return;
                    }
                }
                else
                {
                    WriteError(data["result_msg"].ToString(), context);
                    return;
                }
            }

            var buyer_id = context.Request["payKey"];
            var payData  = PayData.Find(orderNo, PayType.BANK_CARD);

            if (tradeStatus == "SUCCESS")
            {
                JsonEMail newEmail = new JsonEMail();
                newEmail.dwUserID   = payData.UserId;
                newEmail.nStatus    = 0;
                newEmail.szTitle    = "支付成功";
                newEmail.szMessage  = "银行卡交易:支付成功[" + amount.ToString() + "]";
                newEmail.szSender   = "系统";
                newEmail.szSendTime = DateTime.Now.ToString();

                prams = new List <DbParameter>();
                prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("dwUserID", payData.UserId));
                prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szTradeNo", orderNo));
                prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szPayTime", DateTime.Now.ToString()));
                prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("fAmount", amount));
                prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("PayStatus", 1));
                prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szBuyer_ID", buyer_id));
                prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szBuyer_Email", ""));
                prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("szPayType", PayType.BANK_CARD));
                prams.Add(FacadeManage.aideTreasureFacade.DataProvider.GetDbHelper().MakeInParam("strErrorDescribe", "suss"));
                FacadeManage.aideAccountsFacade.DataProvider.GetDbHelper().RunProc("GSP_GP_AccountPay", prams);

                WebApplication1.AppleInapp.AddScore((int)(decimal.Parse(amount) * 100), payData.UserId, orderNo);
                WebApplication1.EmailAdd.AddEmail(newEmail);
            }

            context.Response.Write("success");
        }
예제 #8
0
        public static bool AddAccount(string PhoneName, string Password, string Mac, RetureCode newRetureCode, out int IntId)
        {
            IntId = -1;
            string insetsql = "";
            {
                {
                    insetsql = string.Format(@"INSERT INTO [RYAccountsDB].[dbo].[AccountsInfo]
           ([ProtectID]
           ,[PasswordID]
           ,[SpreaderID]
           ,[Accounts]
           ,[NickName]
           ,[RegAccounts]
           ,[UnderWrite]
           ,[PassPortID]
           ,[Compellation]
           ,[LogonPass]
           ,[InsurePass]
           ,[DynamicPass]
           ,[DynamicPassTime]
           ,[FaceID]
           ,[CustomID]
           ,[Present]
           ,[UserMedal]
           ,[Experience]
           ,[GrowLevelID]
           ,[LoveLiness]
           ,[UserRight]
           ,[MasterRight]
           ,[ServiceRight]
           ,[MasterOrder]
           ,[MemberOrder]
           ,[MemberOverDate]
           ,[MemberSwitchDate]
           ,[CustomFaceVer]
           ,[Gender]
           ,[Nullity]
           ,[NullityOverDate]
           ,[StunDown]
           ,[MoorMachine]
           ,[IsAndroid]
           ,[WebLogonTimes]
           ,[GameLogonTimes]
           ,[PlayTimeCount]
           ,[OnLineTimeCount]
           ,[LastLogonIP]
           ,[LastLogonDate]
           ,[LastLogonMobile]
           ,[LastLogonMachine]
           ,[RegisterIP]
           ,[RegisterDate]
           ,[RegisterMobile]
           ,[RegisterMachine]
           ,[RegisterOrigin]
           ,[PlatformID]
           ,[UserUin]
           ,[RankID]
           ,[AgentID])
     VALUES(
           0,
           0,
           0,
           '{0}',
           '{1}',
           '',
           '',
           '',
           '',
           '{2}',
           '',
           '',
           '',
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           0,
           '',
           '',
           '',
           '',
           '',
           '',
           '{0}',
           '{3}',
           0,
           0,
           '',
           0,
           0)", PhoneName, "游客", Password, Mac);
                }
            }
            string MyConn = System.Configuration.ConfigurationManager.AppSettings["DBAccounts"];

            SqlConnection MyConnection = new SqlConnection(MyConn);

            try
            {
                MyConnection.Open();
                {
                    string        selStr    = "select UserId from AccountsInfo where Accounts='" + PhoneName + "'";
                    SqlCommand    MyCommand = new SqlCommand(selStr, MyConnection);
                    SqlDataReader _Reader   = MyCommand.ExecuteReader();
                    if (!_Reader.Read())
                    {
                        _Reader.Close();
                    }
                    else
                    {
                        IntId = _Reader.GetInt32(0);
                        _Reader.Close();
                        string updateSql = " update AccountsInfo set LogonPass='******'";
                        updateSql += " where Accounts='" + PhoneName + "'";
                        SqlCommand UpdateCommand = new SqlCommand(updateSql, MyConnection);
                        UpdateCommand.ExecuteNonQuery();

                        return(true);
                    }
                }
                {
                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection  = MyConnection;
                    cmd.CommandText = "NET_PM_AddAccount";

                    cmd.Parameters.Add(new SqlParameter("@strAccounts", PhoneName));
                    cmd.Parameters.Add(new SqlParameter("@strNickName", "游客"));
                    cmd.Parameters.Add(new SqlParameter("@strLogonPass", Password));
                    cmd.Parameters.Add(new SqlParameter("@strInsurePass", ""));
                    cmd.Parameters.Add(new SqlParameter("@strDynamicPass", ""));
                    cmd.Parameters.Add(new SqlParameter("@strRegisterMachine", Mac));
                    cmd.Parameters.Add(new SqlParameter("@IsAndroid", "0"));
                    cmd.Parameters.Add(new SqlParameter("@dwFaceID", "0"));
                    cmd.Parameters.Add(new SqlParameter("@dwPhoneLoginScore", 300));
                    cmd.Parameters.Add(new SqlParameter("@strErrorDescribe", ""));

                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.ExecuteNonQuery();
                }
                {
                    string        selStr    = "select UserId from AccountsInfo where Accounts='" + PhoneName + "'";
                    SqlCommand    MyCommand = new SqlCommand(selStr, MyConnection);
                    SqlDataReader _Reader   = MyCommand.ExecuteReader();
                    if (!_Reader.Read())
                    {
                        Debug.Log("error", "error new phone login " + PhoneName);
                        _Reader.Close();
                    }
                    else
                    {
                        IntId = _Reader.GetInt32(0);
                        Debug.Log("suss", "suss new phone login " + IntId);
                        _Reader.Close();
                    }

                    JsonEMail newJsonEMail = new JsonEMail();
                    newJsonEMail.dwUserID  = IntId;
                    newJsonEMail.nStatus   = 0;
                    newJsonEMail.szTitle   = "绑定成功";
                    newJsonEMail.szMessage = "绑定成功手机号,赠送3.00";
                    newJsonEMail.szSender  = "系统";
                    newJsonEMail.nType     = 0;
                    newJsonEMail.nStatus   = 0;
                    EmailAdd.AddEmail(newJsonEMail);
                }

//                 {
//                     SqlCommand UpdateCommand = new SqlCommand(insetsql, MyConnection);
//                      UpdateCommand.ExecuteNonQuery();
//                 {
//                     string selStr = "select UserId from AccountsInfo where Accounts='" + PhoneName + "'";
//                     SqlCommand MyCommand = new SqlCommand(selStr, MyConnection);
//                     SqlDataReader _Reader = MyCommand.ExecuteReader();
//                     if (_Reader.Read())
//                     {
//                         IntId = _Reader.GetInt32(0);
//                     }
//                     _Reader.Close();
//                 }
                MyConnection.Close();
                MyConnection = null;
//                 AppleInapp.AddScore(300, IntId);
//                 }
                return(true);
            }
            catch (Exception ex)
            {
                newRetureCode.msg = ex.Message.ToString();
            }
            finally
            {
                if (MyConnection != null)
                {
                    MyConnection.Close();
                }
            }
            return(false);
        }