Пример #1
0
 /// <summary>
 /// 生成一个订单
 /// </summary>
 /// <param name="OrderCode">订单标识码</param>
 /// <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">充值金额(RMB/元)</param>
 /// <param name="AdminUserName">操作员</param>
 /// <returns></returns>
 public Orders GetOrder(string OrderCode, string GameId, int ServerId, int Type, int PayTypeId, string UserName, float Money, string AdminUserName)
 {
     Thread.Sleep(8);
     Orders o = new Orders();
     if (CheckOrder(GameId, ServerId, Type, PayTypeId, UserName, Money, AdminUserName))
     {
         GameServerServers gss = new GameServerServers();
         GamesServers gs = new GamesServers();
         o.Type = Type;
         o.PayTypeId = PayTypeId;
         o.State = 0;
         o.UserName = UserName;
         o.PayTime = DateTime.Now;
         o.Ip = BBRequest.GetIP();
         if (!string.IsNullOrEmpty(AdminUserName))
         {
             o.AdminUserName = AdminUserName;
         }
         else
         {
             o.AdminUserName = "******";
         }
         if (PayTypeId == 7)
         {
             o.PMoney = o.PayMoney = Money / 10;
         }
         else
         {
             o.PMoney = o.PayMoney = Money;
         }
         if (Type == 1)
         {
             if (GameId.ToString().Length == 1)
             {
                 GameId = "00" + GameId;
             }
             else if (GameId.ToString().Length == 2)
             {
                 GameId = "0" + GameId;
             }
             o.OrderNo = OrderCode + DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond + GameId + gss.GetGameServer(ServerId).QuFu;
             o.GameId = int.Parse(GameId);
             o.ServerId = ServerId;
             o.GameName = gs.GetGame(o.GameId).Name;
             o.ServerName = gss.GetGameServer(ServerId).Name;
         }
         else
         {
             o.OrderNo = OrderCode + DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond + 0 + 0;
             o.GameId = 0;
             o.ServerId = 0;
             o.GameName = "适用所有游戏";
             o.ServerName = "适用所有区服";
         }
     }
     return o;
 }