Exemplo n.º 1
0
 /// <summary>
 /// 触发充值礼包
 /// </summary>
 public static void TriggerReceivePack(string userID, int packType, int gameCoin)
 {
     PackageReceive receive = new PackageReceive();
     List<RechargePacks> rechargePackseArray = new ConfigCacheSet<RechargePacks>().FindAll(m => m.PacksType == packType);
     foreach (RechargePacks rechargePackse in rechargePackseArray)
     {
         if (rechargePackse.RechargeNum <= gameCoin)
         {
             receive.ReceiveID = Guid.NewGuid().ToString();
             receive.PacksID = rechargePackse.PacksID;
             receive.UserID = userID;
             receive.IsReceive = false;
             receive.ReceiveDate = DateTime.Now;
             new GameDataCacheSet<PackageReceive>().Add(receive);
         }
     }
 }
Exemplo n.º 2
0
        public static void TriggerWeekPack(string userID, int gameCoin)
        {
            int packType = 3;
            List<RechargePacks> rechargePackseArray = new ConfigCacheSet<RechargePacks>().FindAll(m => m.PacksType == packType);
            foreach (RechargePacks rechargePackse in rechargePackseArray)
            {
                if (rechargePackse.RechargeNum <= gameCoin)
                {
                    var packCacheSet = new GameDataCacheSet<PackageReceive>();
                    List<PackageReceive> packageReceivess = packCacheSet.FindAll(userID, m => m.PacksID == rechargePackse.PacksID);
                    if (packageReceivess.Count == 0)
                    {
                        PackageReceive receive = new PackageReceive();
                        receive.ReceiveID = Guid.NewGuid().ToString();
                        receive.PacksID = rechargePackse.PacksID;
                        receive.UserID = userID;
                        receive.IsReceive = false;
                        receive.ReceiveDate = DateTime.Now;
                        packCacheSet.Add(receive, GameEnvironment.CacheUserPeriod);
                    }
                    else if (!IsHaveWeek(packageReceivess))
                    {
                        PackageReceive receive = packageReceivess[0];

                        if (receive.IsReceive)
                        {
                            receive.IsReceive = false;
                            receive.ReceiveDate = DateTime.Now;
                            //receive.Update();
                        }
                        for (int i = 1; i <= packageReceivess.Count - 1; i++)
                        {
                            packCacheSet.Delete(packageReceivess[i]);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public static void TriggerMonthPack(string userID, int gameCoin)
        {
            int packType = 4;
            List<RechargePacks> rechargePackseArray = new ShareCacheStruct<RechargePacks>().FindAll(m => m.PacksType == packType);
            foreach (RechargePacks rechargePackse in rechargePackseArray)
            {
                if (rechargePackse.RechargeNum <= gameCoin)
                {
                    List<PackageReceive> packageReceivess = new PersonalCacheStruct<PackageReceive>().FindAll(userID, m => m.PacksID == rechargePackse.PacksID);
                    if (packageReceivess.Count == 0)
                    {
                        PackageReceive receive = new PackageReceive();
                        receive.ReceiveID = Guid.NewGuid().ToString();
                        receive.PacksID = rechargePackse.PacksID;
                        receive.UserID = userID;
                        receive.IsReceive = false;
                        receive.ReceiveDate = DateTime.Now;
                        new PersonalCacheStruct<PackageReceive>().Add(receive);
                    }
                    else if (!IsHaveMonth(packageReceivess))
                    {
                        PackageReceive receive = packageReceivess[0];

                        if (receive.IsReceive)
                        {
                            receive.IsReceive = false;
                            receive.ReceiveDate = DateTime.Now;
                            //receive.Update();
                        }


                        var cacheSet = new PersonalCacheStruct<PackageReceive>();
                        for (int i = 1; i <= packageReceivess.Count - 1; i++)
                        {
                            cacheSet.Delete(packageReceivess[i]);
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 触发充值礼包
 /// </summary>
 public static void TriggerReceivePack(string userID, int packType, int gameCoin)
 {
     List<RechargePacks> rechargePackseArray = new ShareCacheStruct<RechargePacks>().FindAll(m => m.PacksType == packType);
     foreach (RechargePacks rechargePackse in rechargePackseArray)
     {
         List<PackageReceive> packageReceivess = new PersonalCacheStruct<PackageReceive>().FindAll(userID, m => m.PacksID == rechargePackse.PacksID);
         if (packageReceivess.Count == 0)
         {
             if (rechargePackse.RechargeNum <= gameCoin)
             {
                 PackageReceive receive = new PackageReceive();
                 receive.ReceiveID = Guid.NewGuid().ToString();
                 receive.PacksID = rechargePackse.PacksID;
                 receive.UserID = userID;
                 receive.IsReceive = false;
                 receive.ReceiveDate = DateTime.Now;
                 new PersonalCacheStruct<PackageReceive>().Add(receive);
             }
         }
     }
 }