예제 #1
0
 public void DoCz(HttpContext context)
 {
     string GameId = context.Request["GameId"].Trim();
     int ServerId = int.Parse(context.Request["ServerId"].Trim());
     int Type = int.Parse(context.Request["Type"].Trim());
     float Money = float.Parse(context.Request["Money"].Trim());
     OrderManager om = new OrderManager();
     GamesManager gm = new GamesManager();
     string PWD = context.Request["PWD"].Trim();
     string Bz = context.Request["Bz"].Trim();
     string UserList = context.Request["UserList"];
     string[] Result = UserList.Substring(0, UserList.LastIndexOf('|')).Split('|');
     if (mm.GetMasterByCz(GetUser(context).UserName, DESEncrypt.Md5(PWD, 32)) == null)
     {
         context.Response.Write("fali");
     }
     else
     {
         if (!string.IsNullOrEmpty(Bz))
         {
             string ResHtml = "";
             foreach (string UserName in Result)
             {
                 Orders order = new Orders();
                 if (UserName != "undefined" && !string.IsNullOrEmpty(UserName.Trim()))
                 {
                     try
                     {
                         order = om.GetOrder("J", GameId, ServerId, Type, 6, UserName, Money, GetUser(context).UserName);
                         order.State = 1;
                         order.Ip = Bz;
                         if (om.AddOrder(order))
                         {
                             ResHtml += "<span>您的订单<span style=\"color:Red\">" + order.OrderNo + "</span>已处理。<span style=\"color:Red\">" + gm.PayManager(order.OrderNo) + "</span></span><br/>";
                         }
                         else
                         {
                             ResHtml += "<span>您的订单<span style=\"color:Red\">" + order.OrderNo + "</span>已处理。<span style=\"color:Red\">添加订单失败!</span></span><br/>";
                         }
                     }
                     catch (Exception e)
                     {
                         ResHtml += "<span>您的订单处理异常!<span style=\"color:Red\">" + e.Message + "</span><br/>";
                     }
                 }
             }
             context.Response.Write(ResHtml);
         }
         else
         {
             context.Response.Write("BzIsNull");
         }
     }
 }
예제 #2
0
        public void zfbeOrder(HttpContext context)
        {
            Orders order = new Orders();
            string OrderNo = context.Request["OrderNo"];
            OrderManager om = new OrderManager();
            order = om.GetOrder(OrderNo);
            if (order.PayTypeId == 8)
            {
                //支付类型
                string payment_type = "1";
                //必填,不能修改
                //服务器异步通知页面路径
                string notify_url = ConfigurationManager.AppSettings["zfbmsg"].ToString();
                //需http://格式的完整路径,不能加?id=123这类自定义参数

                //页面跳转同步通知页面路径
                string return_url = ConfigurationManager.AppSettings["zfbreurl"].ToString();
                //需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/

                //卖家支付宝帐户
                string seller_email = ConfigurationManager.AppSettings["zfbuser"].ToString();
                //必填

                //商户订单号
                string out_trade_no = order.OrderNo;
                //商户网站订单系统中唯一订单号,必填

                //订单名称

                string subject = order.Type == 1 ? "5577yx平台游戏币" : "5577yx平台币" + "充值";
                //必填

                //付款金额
                string total_fee = order.PayMoney.ToString();
                //必填

                //订单描述

                string body = order.GameName + order.ServerName;
                //商品展示地址
                string show_url = "";
                //需以http://开头的完整路径,例如:http://www.xxx.com/myorder.html

                //防钓鱼时间戳
                string anti_phishing_key = Common.Submit.Query_timestamp();
                //若要使用请调用类文件submit中的query_timestamp函数

                //客户端的IP地址
                string exter_invoke_ip = "";
                //非局域网的外网IP地址,如:221.0.0.1

                //把请求参数打包成数组
                SortedDictionary<string, string> sParaTemp = new SortedDictionary<string, string>();
                sParaTemp.Add("partner", Config.Partner);
                sParaTemp.Add("_input_charset", Config.Input_charset.ToLower());
                sParaTemp.Add("service", "create_direct_pay_by_user");
                sParaTemp.Add("payment_type", payment_type);
                sParaTemp.Add("notify_url", notify_url);
                sParaTemp.Add("return_url", return_url);
                sParaTemp.Add("seller_email", seller_email);
                sParaTemp.Add("out_trade_no", out_trade_no);
                sParaTemp.Add("subject", subject);
                sParaTemp.Add("total_fee", total_fee);
                sParaTemp.Add("body", body);
                sParaTemp.Add("show_url", show_url);
                sParaTemp.Add("anti_phishing_key", anti_phishing_key);
                sParaTemp.Add("exter_invoke_ip", exter_invoke_ip);
                //建立请求
                string sHtmlText = Submit.BuildRequest(sParaTemp, "post", "确认");
                context.Response.Write(sHtmlText);
            }
            else
            {
                context.Response.Write("NoZfb");
            }
        }
예제 #3
0
 public void MakeOrder(HttpContext context)
 {
     int Type = int.Parse(context.Request["Type"]);
     int GameId = int.Parse(context.Request["GameId"]);
     int ServerId = int.Parse(context.Request["ServerId"]);
     string SelMoney = context.Request["SelMoney"];
     string TxtMoney = context.Request["TxtMoney"];
     string UserName = context.Request["UserName"].Trim();
     string Bank = context.Request["Bank"];
     int PayType = int.Parse(context.Request["PayType"]);
     Orders order = new Orders();
     OrderManager om = new OrderManager();
     GameUserManager gum = new GameUserManager();
     GamesManager gm = new GamesManager();
     GameUser gu = new GameUser();
     try
     {
         gu = gum.GetGameUser((int)context.Session[Keys.SESSION_USER]);
     }
     catch (Exception)
     {
         if (PayType == 7)
         {
             context.Response.Write("/Home/Login");
             return;
         }
     }
     float PayMoney = 0;
     string OrderCode = Type == 1 ? "G" : "P";
     try
     {
         if (!string.IsNullOrEmpty(TxtMoney))
         {
             PayMoney = float.Parse(TxtMoney.Trim());
         }
         else
         {
             PayMoney = float.Parse(SelMoney);
         }
         order = om.GetOrder(OrderCode, GameId.ToString(), ServerId, Type, PayType, UserName, PayMoney, gu.UserName);
         if (PayType == 7)
         {
             if (om.AddOrder(order))
             {
                 string Result = gm.PayManager(order.OrderNo);
                 context.Response.Write("您的订单" + order.OrderNo + "已经处理。处理结果:" + Result + "|Error");
                 return;
             }
             else
             {
                 context.Response.Write("添加订单失败!|Error");
                 return;
             }
         }
         else
         {
             if (om.AddOrder(order))
             {
                 context.Response.Write("/PayCenter/PayOrder?Order=" + DESEncrypt.encryptstring1(order.OrderNo) + "&Bank=" + Bank + "|Success");
             }
             else
             {
                 context.Response.Write("添加订单失败!|Error");
                 return;
             }
         }
     }
     catch (Exception e)
     {
         context.Response.Write(e.Message + "|Error");
         return;
     }
 }