Преглед на файлове

更改每天888.88红包,固定150个

lichunlei преди 2 години
родител
ревизия
b4d845fd7a
променени са 1 файла, в които са добавени 179 реда и са изтрити 30 реда
  1. 179 30
      AppStart/Timer/RedPackageHelper.cs

+ 179 - 30
AppStart/Timer/RedPackageHelper.cs

@@ -25,7 +25,7 @@ public class RedPackageHelper
     {
         while (true)
         {
-            if (DateTime.Now.Hour >= 3 && DateTime.Now.Hour <= 5)
+            if (DateTime.Now.Hour >= 3)
             {
                 string ActivityDate = DateTime.Now.ToString("yyyyMMdd");
                 string check = function.ReadInstance("/Activity/RedPackage/" + ActivityDate + ".txt");
@@ -36,40 +36,189 @@ public class RedPackageHelper
                     WebCMSEntities db = new WebCMSEntities();
                     try
                     {
-                        decimal TotalPrize = 888.88M;
+                        // decimal TotalPrize = 888.88M;
                         DateTime start = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 22:00:00");
                         DateTime today = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
                         string PreDate = DateTime.Now.AddDays(-1).ToString("yyyyMMdd");
                         List<decimal> list = new List<decimal>();
                         list.Add(88.88M);
-                        TotalPrize -= 88.88M;
-                        for (int i = 1; i < 150; i++)
-                        {
-                            list.Add(0.88M);
-                            TotalPrize -= 0.88M;
-                        }
-                        for (int i = 0; i < 150; i++)
-                        {
-                            if (TotalPrize > 0)
-                            {
-                                int BigPrize = function.get_Random(1, 150);
-                                decimal PrizeAmt = (decimal)function.get_Random(88, 1000) / 100M;
-                                if (TotalPrize > PrizeAmt)
-                                {
-                                    list[BigPrize] += PrizeAmt;
-                                    TotalPrize -= PrizeAmt;
-                                }
-                                else
-                                {
-                                    list[BigPrize] += TotalPrize;
-                                    TotalPrize = 0;
-                                }
-                            }
-                            else
-                            {
-                                break;
-                            }
-                        }
+                        list.Add(40.76M);
+                        list.Add(38.88M);
+                        list.Add(18.88M);
+                        list.Add(15.88M);
+                        list.Add(11.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(8.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(5.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(3.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        list.Add(1.88M);
+                        // TotalPrize -= 88.88M;
+                        // for (int i = 1; i < 150; i++)
+                        // {
+                        //     list.Add(0.88M);
+                        //     TotalPrize -= 0.88M;
+                        // }
+                        // for (int i = 0; i < 150; i++)
+                        // {
+                        //     if (TotalPrize > 0)
+                        //     {
+                        //         int BigPrize = function.get_Random(1, 150);
+                        //         decimal PrizeAmt = (decimal)function.get_Random(88, 1000) / 100M;
+                        //         if (TotalPrize > PrizeAmt)
+                        //         {
+                        //             list[BigPrize] += PrizeAmt;
+                        //             TotalPrize -= PrizeAmt;
+                        //         }
+                        //         else
+                        //         {
+                        //             list[BigPrize] += TotalPrize;
+                        //             TotalPrize = 0;
+                        //         }
+                        //     }
+                        //     else
+                        //     {
+                        //         break;
+                        //     }
+                        // }
                         foreach (decimal PrizeAmt in list)
                         {
                             db.ActivityRedPackageStock.Add(new ActivityRedPackageStock()