|
@@ -29,7 +29,6 @@ namespace MySystem
|
|
|
{
|
|
{
|
|
|
WebCMSEntities spdb = new WebCMSEntities();
|
|
WebCMSEntities spdb = new WebCMSEntities();
|
|
|
PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
|
|
PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
|
|
|
- DateTime now = DateTime.Now;
|
|
|
|
|
DateTime start = DateTime.Now.AddDays(-10);
|
|
DateTime start = DateTime.Now.AddDays(-10);
|
|
|
int StartId = int.Parse(function.CheckInt(function.ReadInstance("/SycnSp/TradeRecordId.txt")));
|
|
int StartId = int.Parse(function.CheckInt(function.ReadInstance("/SycnSp/TradeRecordId.txt")));
|
|
|
IQueryable<TradeRecord> trades = spdb.TradeRecord.Where(m => m.Id >= StartId && m.CreateDate >= start && m.Status == 1).OrderBy(m => m.CreateDate).Take(20);
|
|
IQueryable<TradeRecord> trades = spdb.TradeRecord.Where(m => m.Id >= StartId && m.CreateDate >= start && m.Status == 1).OrderBy(m => m.CreateDate).Take(20);
|
|
@@ -343,54 +342,7 @@ namespace MySystem
|
|
|
pos.DebitCardTrade += TradeAmount;
|
|
pos.DebitCardTrade += TradeAmount;
|
|
|
}
|
|
}
|
|
|
//判断激活条件并激活
|
|
//判断激活条件并激活
|
|
|
- DateTime TransferTime = pos.TransferTime == null ? DateTime.Now : pos.TransferTime.Value;
|
|
|
|
|
- if (pos.CreditTrade >= CheckMoney && pos.BuyUserId > 0 && pos.ActivationState == 0 && TransferTime.AddMinutes(-30) < pos.BindingTime)
|
|
|
|
|
- // if (pos.CreditTrade >= CheckMoney && pos.ActivationState == 0 && TransferTime < pos.BindingTime && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
|
|
|
|
|
- {
|
|
|
|
|
- pos.ActivationState = 1;
|
|
|
|
|
- pos.ActivationTime = DateTime.Now;
|
|
|
|
|
- function.WriteLog("机具" + pos.PosSn, "开机奖励在激活中监控");
|
|
|
|
|
- PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
|
|
|
|
|
- if (merchant != null)
|
|
|
|
|
- {
|
|
|
|
|
- merchant.ActiveStatus = 1;
|
|
|
|
|
- merchant.MerStandardDate = DateTime.Now;
|
|
|
|
|
- db.SaveChanges();
|
|
|
|
|
-
|
|
|
|
|
- if(pos.BrandId != 14)
|
|
|
|
|
- {
|
|
|
|
|
- function.WriteLog("商户" + merchant.KqMerNo, "开机奖励在激活中监控");
|
|
|
|
|
-
|
|
|
|
|
- // 推荐王逻辑(激活)
|
|
|
|
|
- // string SendData = "{\"Kind\":\"3\",\"Data\":{\"UserId\":\"" + pos.BuyUserId + "\",\"PosId\":\"" + pos.Id + "\",\"TradeMonth\":\"" + DateTime.Now.ToString("yyyyMM") + "\"}}";
|
|
|
|
|
- // RedisDbconn.Instance.AddList("RecommendActStatQueue", SendData);
|
|
|
|
|
-
|
|
|
|
|
- //发放开机奖励
|
|
|
|
|
- function.WriteLog("首台" + pos.IsFirst, "开机奖励在激活中监控");
|
|
|
|
|
- if(pos.IsFirst == 1 && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
|
|
|
|
|
- {
|
|
|
|
|
- RedisDbconn.Instance.AddList("OpenRewardQueue", pos.Id.ToString());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if(pos.BrandId != 14)
|
|
|
|
|
- {
|
|
|
|
|
- //发放大盟主奖励
|
|
|
|
|
- if (pos.LeaderUserId > 0 && pos.IsFirst == 1 && db.Leaders.Any(m => m.Id == pos.LeaderUserId && m.ExpiredDate > now) && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
|
|
|
|
|
- {
|
|
|
|
|
- RedisDbconn.Instance.AddList("LeaderPrizeQueue", pos.Id);
|
|
|
|
|
- }
|
|
|
|
|
- //发放运营中心奖励
|
|
|
|
|
- if (pos.IsFirst == 1 && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
|
|
|
|
|
- {
|
|
|
|
|
- RedisDbconn.Instance.AddList("OperatePrizeQueue", pos.Id);
|
|
|
|
|
- }
|
|
|
|
|
- AlipayPayBack2Service.Instance.ActReserveBack(pos.OpId, pos.OpReserve1, pos.OpReserve2, pos.OpReserve3);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //统计激活数
|
|
|
|
|
- RedisDbconn.Instance.AddList("StatActQueue", "{\"TradeDate\":\"" + DateTime.Now.ToString("yyyyMMdd") + "\",\"UserId\":\"" + pos.BuyUserId + "\",\"BrandId\":\"" + pos.BrandId + "\"}");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ActPos(db, pos, CheckMoney, CheckDays);
|
|
|
if (TradeAmount > 0)
|
|
if (TradeAmount > 0)
|
|
|
{
|
|
{
|
|
|
ulong MerHelpFlag = 0;
|
|
ulong MerHelpFlag = 0;
|
|
@@ -511,6 +463,60 @@ namespace MySystem
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //机具激活逻辑
|
|
|
|
|
+ public void ActPos(PxcModels.WebCMSEntities db, PxcModels.PosMachinesTwo pos, decimal CheckMoney, int CheckDays)
|
|
|
|
|
+ {
|
|
|
|
|
+ DateTime now = DateTime.Now;
|
|
|
|
|
+ DateTime TransferTime = pos.TransferTime == null ? DateTime.Now : pos.TransferTime.Value;
|
|
|
|
|
+ if (pos.CreditTrade >= CheckMoney && pos.BuyUserId > 0 && pos.ActivationState == 0 && TransferTime.AddMinutes(-30) < pos.BindingTime)
|
|
|
|
|
+ // if (pos.CreditTrade >= CheckMoney && pos.ActivationState == 0 && TransferTime < pos.BindingTime && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
|
|
|
|
|
+ {
|
|
|
|
|
+ pos.ActivationState = 1;
|
|
|
|
|
+ pos.ActivationTime = DateTime.Now;
|
|
|
|
|
+ function.WriteLog("机具" + pos.PosSn, "开机奖励在激活中监控");
|
|
|
|
|
+ PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
|
|
|
|
|
+ if (merchant != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ merchant.ActiveStatus = 1;
|
|
|
|
|
+ merchant.MerStandardDate = DateTime.Now;
|
|
|
|
|
+ db.SaveChanges();
|
|
|
|
|
+
|
|
|
|
|
+ if(pos.BrandId != 14)
|
|
|
|
|
+ {
|
|
|
|
|
+ function.WriteLog("商户" + merchant.KqMerNo, "开机奖励在激活中监控");
|
|
|
|
|
+
|
|
|
|
|
+ // 推荐王逻辑(激活)
|
|
|
|
|
+ // string SendData = "{\"Kind\":\"3\",\"Data\":{\"UserId\":\"" + pos.BuyUserId + "\",\"PosId\":\"" + pos.Id + "\",\"TradeMonth\":\"" + DateTime.Now.ToString("yyyyMM") + "\"}}";
|
|
|
|
|
+ // RedisDbconn.Instance.AddList("RecommendActStatQueue", SendData);
|
|
|
|
|
+
|
|
|
|
|
+ //发放开机奖励
|
|
|
|
|
+ function.WriteLog("首台" + pos.IsFirst, "开机奖励在激活中监控");
|
|
|
|
|
+ if(pos.IsFirst == 1 && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
|
|
|
|
|
+ {
|
|
|
|
|
+ RedisDbconn.Instance.AddList("OpenRewardQueue", pos.Id.ToString());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(pos.BrandId != 14)
|
|
|
|
|
+ {
|
|
|
|
|
+ //发放大盟主奖励
|
|
|
|
|
+ if (pos.LeaderUserId > 0 && pos.IsFirst == 1 && db.Leaders.Any(m => m.Id == pos.LeaderUserId && m.ExpiredDate > now) && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
|
|
|
|
|
+ {
|
|
|
|
|
+ RedisDbconn.Instance.AddList("LeaderPrizeQueue", pos.Id);
|
|
|
|
|
+ }
|
|
|
|
|
+ //发放运营中心奖励
|
|
|
|
|
+ if (pos.IsFirst == 1 && pos.BindingTime > DateTime.Now.AddDays(-CheckDays))
|
|
|
|
|
+ {
|
|
|
|
|
+ RedisDbconn.Instance.AddList("OperatePrizeQueue", pos.Id);
|
|
|
|
|
+ }
|
|
|
|
|
+ AlipayPayBack2Service.Instance.ActReserveBack(pos.OpId, pos.OpReserve1, pos.OpReserve2, pos.OpReserve3);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //统计激活数
|
|
|
|
|
+ RedisDbconn.Instance.AddList("StatActQueue", "{\"TradeDate\":\"" + DateTime.Now.ToString("yyyyMMdd") + "\",\"UserId\":\"" + pos.BuyUserId + "\",\"BrandId\":\"" + pos.BrandId + "\"}");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//立刷格外奖励
|
|
//立刷格外奖励
|
|
|
public void LiShuaActPrize(PxcModels.WebCMSEntities db, PxcModels.PosMachinesTwo pos, int prize)
|
|
public void LiShuaActPrize(PxcModels.WebCMSEntities db, PxcModels.PosMachinesTwo pos, int prize)
|
|
|
{
|
|
{
|