|
@@ -29,6 +29,7 @@ namespace MySystem
|
|
|
{
|
|
|
WebCMSEntities spdb = new WebCMSEntities();
|
|
|
PxcModels.WebCMSEntities db = new PxcModels.WebCMSEntities();
|
|
|
+ MpMainModels2.WebCMSEntities mpdb = new MpMainModels2.WebCMSEntities();
|
|
|
string Month = DateTime.Now.ToString("yyyyMM");
|
|
|
string Date = DateTime.Now.ToString("yyyyMMdd");
|
|
|
DateTime start = DateTime.Now.AddDays(-5);
|
|
@@ -84,43 +85,109 @@ namespace MySystem
|
|
|
}
|
|
|
if(pos.BrandId == 18 || pos.BrandId == 19 || pos.BrandId == 20 || pos.BrandId == 21)
|
|
|
{
|
|
|
- pos.PrizeParams = pos.SeoKeyword;
|
|
|
- decimal Deposit = decimal.Parse(function.CheckNum(pos.SeoKeyword));
|
|
|
- decimal Prize = 0;
|
|
|
- if(Deposit == 198) Prize = 70;
|
|
|
- if(Deposit == 249) Prize = 100;
|
|
|
- if(Deposit == 228) Prize = 61;
|
|
|
- if(Deposit == 380) Prize = 151;
|
|
|
- if(Deposit == 399) Prize = 100;
|
|
|
- if(Prize > 0)
|
|
|
+ int CheckDays = 30;
|
|
|
+ DateTime now = DateTime.Now;
|
|
|
+ PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PxcModels.PosMerchantInfo();
|
|
|
+ if(pos.BindingTime > now.AddDays(-CheckDays))
|
|
|
{
|
|
|
- DateTime now = DateTime.Now;
|
|
|
- PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId) ?? new PxcModels.PosMerchantInfo();
|
|
|
- PxcModels.Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new PxcModels.Users();
|
|
|
- int TopUserId = 0;
|
|
|
- if (!string.IsNullOrEmpty(user.ParentNav))
|
|
|
+ pos.PrizeParams = pos.SeoKeyword;
|
|
|
+ decimal Deposit = decimal.Parse(function.CheckNum(pos.SeoKeyword));
|
|
|
+ MpMainModels2.MerchantAddInfo merchantAddInfo = mpdb.MerchantAddInfo.FirstOrDefault(m => m.MchtNo == merchant.KqMerNo) ?? new MpMainModels2.MerchantAddInfo();
|
|
|
+ decimal Prize = 0;
|
|
|
+ if(Deposit == 198)
|
|
|
{
|
|
|
- TopUserId = int.Parse(user.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
|
|
|
+ if(merchantAddInfo.SubjectType == "SUBJECT_TYPE_SMALL")
|
|
|
+ {
|
|
|
+ Prize = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Prize = 120;
|
|
|
+ }
|
|
|
}
|
|
|
- pos.ActivationState = 1;
|
|
|
- pos.ActivationTime = now;
|
|
|
- merchant.ActiveStatus = 1;
|
|
|
- merchant.MerStandardDate = now;
|
|
|
- db.SaveChanges();
|
|
|
- StatService.Instance.doActiveReward(db, merchant, pos, pos.BuyUserId, user.ParentNav, TopUserId, Prize);
|
|
|
- if(pos.CardType < 100)
|
|
|
+ else if(Deposit == 249)
|
|
|
{
|
|
|
- RedisDbconn.Instance.AddList("OpenRewardQueue", pos.Id.ToString());
|
|
|
+ if(merchantAddInfo.SubjectType == "SUBJECT_TYPE_SMALL")
|
|
|
+ {
|
|
|
+ Prize = 50;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Prize = 150;
|
|
|
+ }
|
|
|
}
|
|
|
- if (Deposit > 0 && pos.LeaderUserId > 0 && db.Leaders.Any(m => m.Id == pos.LeaderUserId && m.ExpiredDate > now) && pos.CardType < 100)
|
|
|
+ else if(Deposit == 228)
|
|
|
{
|
|
|
- RedisDbconn.Instance.AddList("LeaderPrizeQueue", pos.Id);
|
|
|
+
|
|
|
+ if(merchantAddInfo.SubjectType == "SUBJECT_TYPE_SMALL")
|
|
|
+ {
|
|
|
+ Prize = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Prize = 110;
|
|
|
+ }
|
|
|
}
|
|
|
- //发放运营中心奖励
|
|
|
- if (Deposit > 0 && pos.CardType < 100)
|
|
|
+ else if(Deposit == 380)
|
|
|
{
|
|
|
- RedisDbconn.Instance.AddList("OperatePrizeQueue", pos.Id);
|
|
|
+
|
|
|
+ if(merchantAddInfo.SubjectType == "SUBJECT_TYPE_SMALL")
|
|
|
+ {
|
|
|
+ Prize = 100;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Prize = 200;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(Deposit == 399)
|
|
|
+ {
|
|
|
+
|
|
|
+ if(merchantAddInfo.SubjectType == "SUBJECT_TYPE_SMALL")
|
|
|
+ {
|
|
|
+ Prize = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Prize = 150;
|
|
|
+ }
|
|
|
}
|
|
|
+ if(Prize > 0)
|
|
|
+ {
|
|
|
+ PxcModels.Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new PxcModels.Users();
|
|
|
+ int TopUserId = 0;
|
|
|
+ if (!string.IsNullOrEmpty(user.ParentNav))
|
|
|
+ {
|
|
|
+ TopUserId = int.Parse(user.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
|
|
|
+ }
|
|
|
+ pos.ActivationState = 1;
|
|
|
+ pos.ActivationTime = now;
|
|
|
+ merchant.ActiveStatus = 1;
|
|
|
+ merchant.MerStandardDate = now;
|
|
|
+ db.SaveChanges();
|
|
|
+ StatService.Instance.doActiveReward(db, merchant, pos, pos.BuyUserId, user.ParentNav, TopUserId, Prize);
|
|
|
+ if(pos.CardType < 100)
|
|
|
+ {
|
|
|
+ RedisDbconn.Instance.AddList("OpenRewardQueue", pos.Id.ToString());
|
|
|
+ }
|
|
|
+ if (Deposit > 0 && pos.LeaderUserId > 0 && db.Leaders.Any(m => m.Id == pos.LeaderUserId && m.ExpiredDate > now) && pos.CardType < 100)
|
|
|
+ {
|
|
|
+ RedisDbconn.Instance.AddList("LeaderPrizeQueue", pos.Id);
|
|
|
+ }
|
|
|
+ //发放运营中心奖励
|
|
|
+ if (Deposit > 0 && pos.CardType < 100)
|
|
|
+ {
|
|
|
+ RedisDbconn.Instance.AddList("OperatePrizeQueue", pos.Id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pos.ActivationState = 1;
|
|
|
+ pos.ActivationTime = now;
|
|
|
+ merchant.ActiveStatus = 1;
|
|
|
+ merchant.MerStandardDate = now;
|
|
|
+ db.SaveChanges();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -144,6 +211,7 @@ namespace MySystem
|
|
|
spdb.Dispose();
|
|
|
db.SaveChanges();
|
|
|
db.Dispose();
|
|
|
+ mpdb.Dispose();
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|