|
|
@@ -145,5 +145,70 @@ namespace MySystem
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public void StartHd()
|
|
|
+ {
|
|
|
+ Thread th = new Thread(StartDoHd);
|
|
|
+ th.IsBackground = true;
|
|
|
+ th.Start();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void StartDoHd()
|
|
|
+ {
|
|
|
+ while (true)
|
|
|
+ {
|
|
|
+ string data = RedisDbconn.Instance.RPop<string>("HdActRewardQueue");
|
|
|
+ if (!string.IsNullOrEmpty(data))
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ JsonData jsonOj = JsonMapper.ToObject(data);
|
|
|
+ int PosId = int.Parse(function.CheckInt(jsonOj["PosId"].ToString()));
|
|
|
+ int UserId = int.Parse(function.CheckInt(jsonOj["UserId"].ToString()));
|
|
|
+ decimal RewardAmount = decimal.Parse(function.CheckNum(jsonOj["RewardAmount"].ToString()));
|
|
|
+ int ChangeType = int.Parse(function.CheckInt(jsonOj["ChangeType"].ToString()));
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == PosId) ?? new PosMachinesTwo();
|
|
|
+ PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PosMerchantInfo();
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
+ 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]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!db.UserAccountRecord.Any(m => m.QueryCount == pos.Id && m.ProductType == 29 && m.ChangeType == 140))
|
|
|
+ {
|
|
|
+ StatService.Instance.doPrizeFunc(db, merchant, pos, pos.BuyUserId, user.ParentNav, BuyTopUserId, RewardAmount, 140);
|
|
|
+ }
|
|
|
+ db.Dispose();
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "设置碰一碰动销买断奖励异常");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Thread.Sleep(500);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|