|
@@ -68,5 +68,82 @@ namespace MySystem
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ int[] BrandIds0 = { 12, 13 };
|
|
|
+ public void StartAfterAdd()
|
|
|
+ {
|
|
|
+ Thread th = new Thread(StartAfterAddDo);
|
|
|
+ th.IsBackground = true;
|
|
|
+ th.Start();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void StartAfterAddDo()
|
|
|
+ {
|
|
|
+ while (true)
|
|
|
+ {
|
|
|
+ string data = RedisDbconn.Instance.RPop<string>("StartAfterAddQueue");
|
|
|
+ if (!string.IsNullOrEmpty(data))
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ int PosId = int.Parse(function.CheckInt(data));
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == PosId);
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId);
|
|
|
+ if(pos != null && user != null)
|
|
|
+ {
|
|
|
+ decimal Deposit = decimal.Parse(function.CheckNum(pos.SeoKeyword));
|
|
|
+ if(Deposit > 1000)
|
|
|
+ {
|
|
|
+ Deposit /= 100;
|
|
|
+ }
|
|
|
+ PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PosMerchantInfo();
|
|
|
+ int BuyTopUserId = 0;
|
|
|
+ string ParentNav = user.ParentNav;
|
|
|
+ if (!string.IsNullOrEmpty(ParentNav))
|
|
|
+ {
|
|
|
+ string[] ParentNavList = ParentNav.Trim(',').Replace(",,", ",").Split(',');
|
|
|
+ if (ParentNavList.Length > 1)
|
|
|
+ {
|
|
|
+ BuyTopUserId = int.Parse(ParentNavList[1]);
|
|
|
+ }
|
|
|
+ else if (ParentNavList.Length == 1)
|
|
|
+ {
|
|
|
+ BuyTopUserId = int.Parse(ParentNavList[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ decimal RewardAmount = 0;
|
|
|
+ if(Deposit > 0)
|
|
|
+ {
|
|
|
+ RewardAmount = 100;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if(BrandIds0.Contains(pos.BrandId))
|
|
|
+ {
|
|
|
+ RewardAmount = 50;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(RewardAmount > 0)
|
|
|
+ {
|
|
|
+ StatService.Instance.doActiveReward(db, merchant, pos, user.Id, user.ParentNav, BuyTopUserId, RewardAmount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "设置激活奖励异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Thread.Sleep(500);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|