Example #1
0
 public void CheckMoney(HttpContext context)
 {
     int GameId = int.Parse(context.Request["GameId"]);
     int Type = int.Parse(context.Request["Type"]);
     string SelMoney = context.Request["SelMoney"];
     string TxtMoney = context.Request["TxTMoney"];
     int PayType = int.Parse(context.Request["PayType"]);
     Games game = new Games();
     GamesManager gm = new GamesManager();
     game = gm.GetGame(GameId);
     float Money = string.IsNullOrEmpty(TxtMoney) ? float.Parse(SelMoney.Trim()) : float.Parse(TxtMoney.Trim());
     float PayMoney = 0;
     switch (PayType)
     {
         case 7:
             PayMoney = Money / 10;
             break;
         case 5:
         case 9:
             PayMoney = Money * 0.8F;
             break;
         case 2:
         case 3:
         case 4:
             PayMoney = Money * 0.9F;
             break;
         default:
             PayMoney = Money;
             break;
     }
     string GameMoney = Type == 1 ? PayMoney * game.GameMoneyScale + "游戏币" : PayMoney * 10 + "平台币";
     context.Response.Write(Money + "|" + GameMoney);
 }
Example #2
0
 /// <summary>
 /// 验证订单
 /// </summary>
 /// <param name="GameId">游戏Id</param>
 /// <param name="ServerId">服务器Id</param>
 /// <param name="Type">充值类型</param>
 /// <param name="PayTypeId">充值方式</param>
 /// <param name="UserName">充值目标账户</param>
 /// <param name="Money">充值金额</param>
 /// <param name="AdminUserName">充值操作用户</param>
 /// <returns></returns>
 public Boolean CheckOrder(string GameId, int ServerId, int Type, int PayTypeId, string UserName, float Money, string AdminUserName)
 {
     GameUserManager gum = new GameUserManager();
     GamesManager gm = new GamesManager();
     if (!string.IsNullOrEmpty(UserName))                                    //验证用户名不能为空
     {
         if (gum.IsGameUser(UserName))                                       //验证用户是否存在
         {
             if (Type == 1 && ServerId > 0)                                   //验证区是否选择区服
             {
                 GameUserInfo gui = gm.GetGameUserInfo(int.Parse(GameId), gum.GetGameUser(UserName).Id, ServerId);
                 if (gui.Message == "Success") //验证用户是否在所选区服中存在角色
                 {
                     if (PayTypeId == 6)                                         //验证手动充值必须满足的一些条件
                     {
                         if (Money >= 1 && Money % 1 == 0)                       //订单金额必须大于等于1且必须为1的整数
                         {
                             return true;
                         }
                         else
                         {
                             throw new Exception("您输入的金额有误!");
                         }
                     }
                     else if (PayTypeId == 7)                                    //验证平台币充值必须满足的一些条件
                     {
                         if (Money >= 10 && Money % 10 == 0)                     //订单金额必须大于等于10且必须为10的整数
                         {
                             if (gum.GetGameUser(AdminUserName).Money >= Money)   //玩家平台币余额必须大于等于充值金额
                             {
                                 return true;
                             }
                             else
                             {
                                 throw new Exception("您的余额不足!");
                             }
                         }
                         else
                         {
                             throw new Exception("您输入的金额有误!");
                         }
                     }
                     else                                                        //验证其他充值方式必须满的一些条件
                     {
                         if (Money >= 5 && Money % 1 == 0)                       //订单金额必须大于等于5且必须为1的整数
                         {
                             return true;
                         }
                         else
                         {
                             throw new Exception("您输入的金额有误!");
                         }
                     }
                 }
                 else
                 {
                     throw new Exception(gui.Message);
                 }
             }
             else if (Type == 2)
             {
                 if (PayTypeId == 6)                                         //验证手动充值必须满足的一些条件
                 {
                     if (Money >= 1 && Money % 1 == 0)                       //订单金额必须大于等于1且必须为1的整数
                     {
                         return true;
                     }
                     else
                     {
                         throw new Exception("您输入的金额有误!");
                     }
                 }
                 else                                                        //验证其他充值方式必须满的一些条件
                 {
                     if (Money >= 5 && Money % 1 == 0)                       //订单金额必须大于等于5且必须为1的整数
                     {
                         return true;
                     }
                     else
                     {
                         throw new Exception("您输入的金额有误!");
                     }
                 }
             }
             else
             {
                 throw new Exception("请选择游戏服务器!");
             }
         }
         else
         {
             throw new Exception("用户不存在!");
         }
     }
     else
     {
         throw new Exception("用户名不能为空!");
     }
 }
Example #3
0
        /// <summary>
        /// 验证订单
        /// </summary>
        /// <param name="GameId">游戏Id</param>
        /// <param name="ServerId">服务器Id</param>
        /// <param name="Type">充值类型</param>
        /// <param name="PayTypeId">充值方式</param>
        /// <param name="UserName">充值目标账户</param>
        /// <param name="Money">充值金额</param>
        /// <param name="AdminUserName">充值操作用户</param>
        /// <returns></returns>
        public Boolean CheckOrder(string GameId, int ServerId, int Type, int PayTypeId, string UserName, float Money, string AdminUserName)
        {
            GameUserManager gum = new GameUserManager();
            GamesManager    gm  = new GamesManager();

            if (!string.IsNullOrEmpty(UserName))                                    //验证用户名不能为空
            {
                if (gum.IsGameUser(UserName))                                       //验证用户是否存在
                {
                    if (Type == 1 && ServerId > 0)                                  //验证区是否选择区服
                    {
                        GameUserInfo gui = gm.GetGameUserInfo(int.Parse(GameId), gum.GetGameUser(UserName).Id, ServerId);
                        if (gui.Message == "Success")             //验证用户是否在所选区服中存在角色
                        {
                            if (PayTypeId == 6)                   //验证手动充值必须满足的一些条件
                            {
                                if (Money >= 1 && Money % 1 == 0) //订单金额必须大于等于1且必须为1的整数
                                {
                                    return(true);
                                }
                                else
                                {
                                    throw new Exception("您输入的金额有误!");
                                }
                            }
                            else if (PayTypeId == 7)                                    //验证平台币充值必须满足的一些条件
                            {
                                if (Money >= 10 && Money % 10 == 0)                     //订单金额必须大于等于10且必须为10的整数
                                {
                                    if (gum.GetGameUser(AdminUserName).Money >= Money)  //玩家平台币余额必须大于等于充值金额
                                    {
                                        return(true);
                                    }
                                    else
                                    {
                                        throw new Exception("您的余额不足!");
                                    }
                                }
                                else
                                {
                                    throw new Exception("您输入的金额有误!");
                                }
                            }
                            else                                                        //验证其他充值方式必须满的一些条件
                            {
                                if (Money >= 5 && Money % 1 == 0)                       //订单金额必须大于等于5且必须为1的整数
                                {
                                    return(true);
                                }
                                else
                                {
                                    throw new Exception("您输入的金额有误!");
                                }
                            }
                        }
                        else
                        {
                            throw new Exception(gui.Message);
                        }
                    }
                    else if (Type == 2)
                    {
                        if (PayTypeId == 6)                                         //验证手动充值必须满足的一些条件
                        {
                            if (Money >= 1 && Money % 1 == 0)                       //订单金额必须大于等于1且必须为1的整数
                            {
                                return(true);
                            }
                            else
                            {
                                throw new Exception("您输入的金额有误!");
                            }
                        }
                        else                                                        //验证其他充值方式必须满的一些条件
                        {
                            if (Money >= 5 && Money % 1 == 0)                       //订单金额必须大于等于5且必须为1的整数
                            {
                                return(true);
                            }
                            else
                            {
                                throw new Exception("您输入的金额有误!");
                            }
                        }
                    }
                    else
                    {
                        throw new Exception("请选择游戏服务器!");
                    }
                }
                else
                {
                    throw new Exception("用户不存在!");
                }
            }
            else
            {
                throw new Exception("用户名不能为空!");
            }
        }
Example #4
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;
     }
 }
Example #5
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");
         }
     }
 }