|
@@ -48,12 +48,12 @@ public class RedPackageHelper
|
|
list.Add(0.88M);
|
|
list.Add(0.88M);
|
|
TotalPrize -= 0.88M;
|
|
TotalPrize -= 0.88M;
|
|
}
|
|
}
|
|
- for (int i = 0; i < 100; i++)
|
|
|
|
|
|
+ for (int i = 0; i < 300; i++)
|
|
{
|
|
{
|
|
if (TotalPrize > 0)
|
|
if (TotalPrize > 0)
|
|
{
|
|
{
|
|
int BigPrize = function.get_Random(1, 300);
|
|
int BigPrize = function.get_Random(1, 300);
|
|
- decimal PrizeAmt = function.get_Random(88, 4000) / 100;
|
|
|
|
|
|
+ decimal PrizeAmt = (decimal)function.get_Random(88, 400) / 100M;
|
|
if (TotalPrize > PrizeAmt)
|
|
if (TotalPrize > PrizeAmt)
|
|
{
|
|
{
|
|
list[BigPrize] += PrizeAmt;
|
|
list[BigPrize] += PrizeAmt;
|
|
@@ -92,4 +92,59 @@ public class RedPackageHelper
|
|
Thread.Sleep(60000);
|
|
Thread.Sleep(60000);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void StartStatTop10()
|
|
|
|
+ {
|
|
|
|
+ Thread th = new Thread(StartStatTop10Do);
|
|
|
|
+ th.IsBackground = true;
|
|
|
|
+ th.Start();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void StartStatTop10Do()
|
|
|
|
+ {
|
|
|
|
+ while (true)
|
|
|
|
+ {
|
|
|
|
+ OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["Pxc1SqlConnStr"].ToString();
|
|
|
|
+ OtherMySqlConn.op("delete from ActivityRedPackageTop10");
|
|
|
|
+ using (WebCMSEntities db = new WebCMSEntities())
|
|
|
|
+ {
|
|
|
|
+ DataTable dt = OtherMySqlConn.dtable("select UserId,sum(PrizeAmt) from ActivityRedPackageJoins group by UserId order by sum(PrizeAmt) desc");
|
|
|
|
+ int index = 0;
|
|
|
|
+ foreach (DataRow dr in dt.Rows)
|
|
|
|
+ {
|
|
|
|
+ index += 1;
|
|
|
|
+ int UserId = int.Parse(dr["UserId"].ToString());
|
|
|
|
+ decimal PrizeAmt = decimal.Parse(dr[1].ToString());
|
|
|
|
+ db.ActivityRedPackageTop10.Add(new ActivityRedPackageTop10()
|
|
|
|
+ {
|
|
|
|
+ Sort = index,
|
|
|
|
+ UserId = UserId,
|
|
|
|
+ PrizeAmt = PrizeAmt,
|
|
|
|
+ Kind = 1,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ dt = OtherMySqlConn.dtable("select UserId,count(Id) from ActivityRedPackageJoins group by UserId order by count(Id) desc");
|
|
|
|
+ index = 0;
|
|
|
|
+ foreach (DataRow dr in dt.Rows)
|
|
|
|
+ {
|
|
|
|
+ index += 1;
|
|
|
|
+ int UserId = int.Parse(dr["UserId"].ToString());
|
|
|
|
+ int PrizeCount = int.Parse(dr[1].ToString());
|
|
|
|
+ db.ActivityRedPackageTop10.Add(new ActivityRedPackageTop10()
|
|
|
|
+ {
|
|
|
|
+ Sort = index,
|
|
|
|
+ UserId = UserId,
|
|
|
|
+ TimeNum = PrizeCount,
|
|
|
|
+ Kind = 2,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ db.SaveChanges();
|
|
|
|
+ }
|
|
|
|
+ Thread.Sleep(60000);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|