|
@@ -836,176 +836,183 @@ namespace MySystem
|
|
|
}
|
|
|
public void StartOpenRewardDo()
|
|
|
{
|
|
|
- string content = RedisDbconn.Instance.RPop<string>("OpenRewardQueue");
|
|
|
- if(!string.IsNullOrEmpty(content))
|
|
|
+ while(true)
|
|
|
{
|
|
|
- try
|
|
|
+ string content = RedisDbconn.Instance.RPop<string>("OpenRewardQueue");
|
|
|
+ if(!string.IsNullOrEmpty(content))
|
|
|
{
|
|
|
- int PosId = int.Parse(content);
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- List<PosMachinesTwo> posList = db.PosMachinesTwo.Where(m => m.Id == PosId && m.ActivationState == 1 && !string.IsNullOrEmpty(m.SeoKeyword) && m.SeoKeyword != "0" && m.CreditTrade >= 1000).ToList();
|
|
|
- foreach (PosMachinesTwo pos in posList)
|
|
|
+ try
|
|
|
{
|
|
|
- if (pos.BindingTime > DateTime.Now.AddDays(-30))
|
|
|
+ int PosId = int.Parse(content);
|
|
|
+ WebCMSEntities db = new WebCMSEntities();
|
|
|
+ List<PosMachinesTwo> posList = db.PosMachinesTwo.Where(m => m.Id == PosId && m.ActivationState == 1 && !string.IsNullOrEmpty(m.SeoKeyword) && m.SeoKeyword != "0" && m.CreditTrade >= 1000).ToList();
|
|
|
+ foreach (PosMachinesTwo pos in posList)
|
|
|
{
|
|
|
- decimal ActPrize = decimal.Parse(function.CheckNum(pos.SeoKeyword));
|
|
|
- if (ActPrize > 0)
|
|
|
+ if (pos.BindingTime > DateTime.Now.AddDays(-30))
|
|
|
{
|
|
|
- PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
|
|
|
- if (merchant != null)
|
|
|
+ decimal ActPrize = decimal.Parse(function.CheckNum(pos.SeoKeyword));
|
|
|
+ if (ActPrize > 0)
|
|
|
{
|
|
|
- Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId);
|
|
|
- if (user != null)
|
|
|
+ PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
|
|
|
+ if (merchant != null)
|
|
|
{
|
|
|
- if (!string.IsNullOrEmpty(user.ParentNav))
|
|
|
+ Users user = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId);
|
|
|
+ if (user != null)
|
|
|
{
|
|
|
- decimal Prize = 20;
|
|
|
- string[] ParentNavs = user.ParentNav.Trim(',').Replace(",,", ",").Split(',');
|
|
|
- for (int i = ParentNavs.Length - 1; i >= 0; i--)
|
|
|
+ if (!string.IsNullOrEmpty(user.ParentNav))
|
|
|
{
|
|
|
- int UserId = int.Parse(ParentNavs[i]);
|
|
|
- Users puser = db.Users.FirstOrDefault(m => m.Id == UserId && m.AuthFlag == 1);
|
|
|
- if (puser != null && Prize > 0)
|
|
|
+ decimal Prize = 20;
|
|
|
+ string[] ParentNavs = user.ParentNav.Trim(',').Replace(",,", ",").Split(',');
|
|
|
+ for (int i = ParentNavs.Length - 1; i >= 0; i--)
|
|
|
{
|
|
|
- int machineCount = db.PosMachinesTwo.Count(m => m.BuyUserId == puser.Id && m.PosSnType == 0 && m.ActivationState == 0); //判断是否拥有3台购买机
|
|
|
- int ActiveCount = db.PosMachinesTwo.Count(m => m.BuyUserId == puser.Id && m.ActivationState == 1); //判断是否拥有3台激活机(不限购买或赠送)
|
|
|
- int couponCount = db.PosCoupons.Count(m => m.UserId == puser.Id && m.IsUse == 0); //判断是否拥有3张券
|
|
|
- // int BigCount = db.PosMachinesTwo.Count(m => m.UserId == puser.Id && m.BrandId == 3); //判断是否拥有2台大机
|
|
|
- // int BigActiveCount = db.PosMachinesTwo.Count(m => m.UserId == puser.Id && m.ActivationState == 1 && m.BrandId == 3); //判断是否拥有2台激活大机(不限购买或赠送)
|
|
|
- if (machineCount + ActiveCount + couponCount >= 3)
|
|
|
+ int UserId = int.Parse(ParentNavs[i]);
|
|
|
+ Users puser = db.Users.FirstOrDefault(m => m.Id == UserId && m.AuthFlag == 1);
|
|
|
+ if (puser != null && Prize > 0)
|
|
|
{
|
|
|
- int pTopUserId = 0;
|
|
|
- if (!string.IsNullOrEmpty(puser.ParentNav))
|
|
|
- {
|
|
|
- pTopUserId = int.Parse(puser.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
|
|
|
- }
|
|
|
- Users machineUser = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new Users();
|
|
|
- OpenRewardDetail detail = db.OpenRewardDetail.Add(new OpenRewardDetail()
|
|
|
+ int machineCount = db.PosMachinesTwo.Count(m => m.BuyUserId == puser.Id && m.PosSnType == 0 && m.ActivationState == 0); //判断是否拥有3台购买机
|
|
|
+ int ActiveCount = db.PosMachinesTwo.Count(m => m.BuyUserId == puser.Id && m.ActivationState == 1); //判断是否拥有3台激活机(不限购买或赠送)
|
|
|
+ int couponCount = db.PosCoupons.Count(m => m.UserId == puser.Id && m.IsUse == 0); //判断是否拥有3张券
|
|
|
+ // int BigCount = db.PosMachinesTwo.Count(m => m.UserId == puser.Id && m.BrandId == 3); //判断是否拥有2台大机
|
|
|
+ // int BigActiveCount = db.PosMachinesTwo.Count(m => m.UserId == puser.Id && m.ActivationState == 1 && m.BrandId == 3); //判断是否拥有2台激活大机(不限购买或赠送)
|
|
|
+ if (machineCount + ActiveCount + couponCount >= 3)
|
|
|
{
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UpdateDate = DateTime.Now,
|
|
|
- TradeMonth = DateTime.Now.ToString("yyyyMM"), //交易月
|
|
|
- TradeDate = DateTime.Now, //达标日期
|
|
|
- UserId = puser.Id, //创客
|
|
|
- BrandId = pos.BrandId, //品牌
|
|
|
- ProductName = RelationClass.GetKqProductsInfo(pos.BrandId), //产品名称
|
|
|
- MerchantId = pos.BindMerchantId, //商户
|
|
|
- DirectUserId = merchant.UserId, //商户直属人
|
|
|
- SnNo = pos.PosSn, //SN号
|
|
|
- MerNo = merchant.KqMerNo, //渠道商户号
|
|
|
- SnType = pos.PosSnType, //机具类型
|
|
|
- StandardDate = pos.ActivationTime, //商户的激活日期
|
|
|
- SnStoreId = pos.StoreId, //SN仓库
|
|
|
- MerBuddyType = puser.MerchantType, //商户创客类型
|
|
|
- RewardType = 1, //奖励类型 1-开机直接奖励,2-开机间接奖励
|
|
|
- RewardTips = "开机奖励", //奖励描述
|
|
|
- CreditTradeAmt = pos.CreditTrade, //贷记卡交易总金额
|
|
|
- DebitTradeAmt = pos.DebitCardTrade, //借记卡交易总金额
|
|
|
- CreditRewardAmount = Prize, //贷记卡交易奖励金额
|
|
|
- RewardDesc = "开机奖励", //奖励描述
|
|
|
- TopUserId = pTopUserId, //顶级创客
|
|
|
- SeoTitle = machineUser.RealName,
|
|
|
- }).Entity;
|
|
|
- db.OpenReward.Add(new OpenReward()
|
|
|
- {
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UpdateDate = DateTime.Now,
|
|
|
- TradeMonth = DateTime.Now.ToString("yyyyMM"), //交易月
|
|
|
- TradeDate = DateTime.Now, //达标日期
|
|
|
- UserId = puser.Id, //创客
|
|
|
- BrandId = pos.BrandId, //品牌
|
|
|
- RewardType = 2, //奖励类型
|
|
|
- CreditTradeAmt = pos.CreditTrade, //贷记卡交易总金额
|
|
|
- DebitTradeAmt = pos.DebitCardTrade, //借记卡交易总金额
|
|
|
- CreditRewardAmount = Prize, //贷记卡交易奖励金额
|
|
|
- RewardDesc = "开机奖励", //奖励描述
|
|
|
- TopUserId = pTopUserId, //顶级创客
|
|
|
- });
|
|
|
- string IdBrand = puser.Id + "_" + pos.BrandId;
|
|
|
- UserMachineData userData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
|
|
|
- if (userData == null)
|
|
|
- {
|
|
|
- userData = db.UserMachineData.Add(new UserMachineData()
|
|
|
+ int pTopUserId = 0;
|
|
|
+ if (!string.IsNullOrEmpty(puser.ParentNav))
|
|
|
{
|
|
|
- IdBrand = IdBrand,
|
|
|
+ pTopUserId = int.Parse(puser.ParentNav.Trim(',').Replace(",,", ",").Split(',')[0]);
|
|
|
+ }
|
|
|
+ Users machineUser = db.Users.FirstOrDefault(m => m.Id == pos.BuyUserId) ?? new Users();
|
|
|
+ OpenRewardDetail detail = db.OpenRewardDetail.Add(new OpenRewardDetail()
|
|
|
+ {
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ UpdateDate = DateTime.Now,
|
|
|
+ TradeMonth = DateTime.Now.ToString("yyyyMM"), //交易月
|
|
|
+ TradeDate = DateTime.Now, //达标日期
|
|
|
+ UserId = puser.Id, //创客
|
|
|
+ BrandId = pos.BrandId, //品牌
|
|
|
+ ProductName = RelationClass.GetKqProductsInfo(pos.BrandId), //产品名称
|
|
|
+ MerchantId = pos.BindMerchantId, //商户
|
|
|
+ DirectUserId = merchant.UserId, //商户直属人
|
|
|
+ SnNo = pos.PosSn, //SN号
|
|
|
+ MerNo = merchant.KqMerNo, //渠道商户号
|
|
|
+ SnType = pos.PosSnType, //机具类型
|
|
|
+ StandardDate = pos.ActivationTime, //商户的激活日期
|
|
|
+ SnStoreId = pos.StoreId, //SN仓库
|
|
|
+ MerBuddyType = puser.MerchantType, //商户创客类型
|
|
|
+ RewardType = 1, //奖励类型 1-开机直接奖励,2-开机间接奖励
|
|
|
+ RewardTips = "开机奖励", //奖励描述
|
|
|
+ CreditTradeAmt = pos.CreditTrade, //贷记卡交易总金额
|
|
|
+ DebitTradeAmt = pos.DebitCardTrade, //借记卡交易总金额
|
|
|
+ CreditRewardAmount = Prize, //贷记卡交易奖励金额
|
|
|
+ RewardDesc = "开机奖励", //奖励描述
|
|
|
+ TopUserId = pTopUserId, //顶级创客
|
|
|
+ SeoTitle = machineUser.RealName,
|
|
|
}).Entity;
|
|
|
+ db.OpenReward.Add(new OpenReward()
|
|
|
+ {
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ UpdateDate = DateTime.Now,
|
|
|
+ TradeMonth = DateTime.Now.ToString("yyyyMM"), //交易月
|
|
|
+ TradeDate = DateTime.Now, //达标日期
|
|
|
+ UserId = puser.Id, //创客
|
|
|
+ BrandId = pos.BrandId, //品牌
|
|
|
+ RewardType = 2, //奖励类型
|
|
|
+ CreditTradeAmt = pos.CreditTrade, //贷记卡交易总金额
|
|
|
+ DebitTradeAmt = pos.DebitCardTrade, //借记卡交易总金额
|
|
|
+ CreditRewardAmount = Prize, //贷记卡交易奖励金额
|
|
|
+ RewardDesc = "开机奖励", //奖励描述
|
|
|
+ TopUserId = pTopUserId, //顶级创客
|
|
|
+ });
|
|
|
+ string IdBrand = puser.Id + "_" + pos.BrandId;
|
|
|
+ UserMachineData userData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
|
|
|
+ if (userData == null)
|
|
|
+ {
|
|
|
+ userData = db.UserMachineData.Add(new UserMachineData()
|
|
|
+ {
|
|
|
+ IdBrand = IdBrand,
|
|
|
+ }).Entity;
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ userData.OpenProfit += Prize;
|
|
|
db.SaveChanges();
|
|
|
- }
|
|
|
- userData.OpenProfit += Prize;
|
|
|
- db.SaveChanges();
|
|
|
- //账户入库
|
|
|
- UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == puser.Id);
|
|
|
- if (account == null)
|
|
|
- {
|
|
|
- account = db.UserAccount.Add(new UserAccount()
|
|
|
+ //账户入库
|
|
|
+ UserAccount account = db.UserAccount.FirstOrDefault(m => m.Id == puser.Id);
|
|
|
+ if (account == null)
|
|
|
+ {
|
|
|
+ account = db.UserAccount.Add(new UserAccount()
|
|
|
+ {
|
|
|
+ Id = puser.Id,
|
|
|
+ UserId = puser.Id,
|
|
|
+ }).Entity;
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
+ //收支明细入库
|
|
|
+ decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
|
|
|
+ decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
|
|
|
+ decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
|
|
|
+ account.BalanceAmount += Prize;
|
|
|
+ account.TotalAmount += Prize;
|
|
|
+ decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
|
|
|
+ decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
|
|
|
+ decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
|
|
|
+ UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
|
|
|
{
|
|
|
- Id = puser.Id,
|
|
|
- UserId = puser.Id,
|
|
|
+ CreateDate = DateTime.Now,
|
|
|
+ UpdateDate = DateTime.Now,
|
|
|
+ UserId = puser.Id, //创客
|
|
|
+ ChangeType = 50, //变动类型
|
|
|
+ ProductType = pos.BrandId, //产品类型
|
|
|
+ ChangeAmount = Prize, //变更金额
|
|
|
+ BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
|
|
|
+ AfterTotalAmount = AfterTotalAmount, //变更后总金额
|
|
|
+ BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
|
|
|
+ AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
|
|
|
+ BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
|
|
|
+ AfterBalanceAmount = AfterBalanceAmount, //变更后余额
|
|
|
}).Entity;
|
|
|
db.SaveChanges();
|
|
|
- }
|
|
|
- //收支明细入库
|
|
|
- decimal BeforeTotalAmount = account.TotalAmount; //变更前总金额
|
|
|
- decimal BeforeFreezeAmount = account.FreezeAmount; //变更前冻结金额
|
|
|
- decimal BeforeBalanceAmount = account.BalanceAmount; //变更前余额
|
|
|
- account.BalanceAmount += Prize;
|
|
|
- account.TotalAmount += Prize;
|
|
|
- decimal AfterTotalAmount = account.TotalAmount; //变更后总金额
|
|
|
- decimal AfterFreezeAmount = account.FreezeAmount; //变更后冻结金额
|
|
|
- decimal AfterBalanceAmount = account.BalanceAmount; //变更后余额
|
|
|
- UserAccountRecord userAccountRecord = db.UserAccountRecord.Add(new UserAccountRecord()
|
|
|
- {
|
|
|
- CreateDate = DateTime.Now,
|
|
|
- UpdateDate = DateTime.Now,
|
|
|
- UserId = puser.Id, //创客
|
|
|
- ChangeType = 50, //变动类型
|
|
|
- ProductType = pos.BrandId, //产品类型
|
|
|
- ChangeAmount = Prize, //变更金额
|
|
|
- BeforeTotalAmount = BeforeTotalAmount, //变更前总金额
|
|
|
- AfterTotalAmount = AfterTotalAmount, //变更后总金额
|
|
|
- BeforeFreezeAmount = BeforeFreezeAmount, //变更前冻结金额
|
|
|
- AfterFreezeAmount = AfterFreezeAmount, //变更后冻结金额
|
|
|
- BeforeBalanceAmount = BeforeBalanceAmount, //变更前余额
|
|
|
- AfterBalanceAmount = AfterBalanceAmount, //变更后余额
|
|
|
- }).Entity;
|
|
|
- db.SaveChanges();
|
|
|
-
|
|
|
- string dateString = DateTime.Now.ToString("yyyyMMdd");
|
|
|
- string monthString = DateTime.Now.ToString("yyyyMM");
|
|
|
- // 开机奖励列表
|
|
|
- List<string> dates = RedisDbconn.Instance.GetList<string>("OpenRewardDay:" + puser.Id + ":" + pos.BrandId);
|
|
|
- if (!dates.Contains(dateString))
|
|
|
- {
|
|
|
- RedisDbconn.Instance.AddList("OpenRewardDay:" + puser.Id + ":" + pos.BrandId, dateString);
|
|
|
- }
|
|
|
- RedisDbconn.Instance.AddNumber("OpenRewardAmt:" + puser.Id + ":" + pos.BrandId + ":" + dateString, Prize);
|
|
|
|
|
|
- List<string> months = RedisDbconn.Instance.GetList<string>("OpenRewardMonth:" + puser.Id + ":" + pos.BrandId);
|
|
|
- if (!months.Contains(monthString))
|
|
|
- {
|
|
|
- RedisDbconn.Instance.AddList("OpenRewardMonth:" + puser.Id + ":" + pos.BrandId, monthString);
|
|
|
- }
|
|
|
- RedisDbconn.Instance.AddNumber("OpenRewardAmt:" + puser.Id + ":" + pos.BrandId + ":" + monthString, Prize);
|
|
|
+ string dateString = DateTime.Now.ToString("yyyyMMdd");
|
|
|
+ string monthString = DateTime.Now.ToString("yyyyMM");
|
|
|
+ // 开机奖励列表
|
|
|
+ List<string> dates = RedisDbconn.Instance.GetList<string>("OpenRewardDay:" + puser.Id + ":" + pos.BrandId);
|
|
|
+ if (!dates.Contains(dateString))
|
|
|
+ {
|
|
|
+ RedisDbconn.Instance.AddList("OpenRewardDay:" + puser.Id + ":" + pos.BrandId, dateString);
|
|
|
+ }
|
|
|
+ RedisDbconn.Instance.AddNumber("OpenRewardAmt:" + puser.Id + ":" + pos.BrandId + ":" + dateString, Prize);
|
|
|
+
|
|
|
+ List<string> months = RedisDbconn.Instance.GetList<string>("OpenRewardMonth:" + puser.Id + ":" + pos.BrandId);
|
|
|
+ if (!months.Contains(monthString))
|
|
|
+ {
|
|
|
+ RedisDbconn.Instance.AddList("OpenRewardMonth:" + puser.Id + ":" + pos.BrandId, monthString);
|
|
|
+ }
|
|
|
+ RedisDbconn.Instance.AddNumber("OpenRewardAmt:" + puser.Id + ":" + pos.BrandId + ":" + monthString, Prize);
|
|
|
|
|
|
- // 开机奖励详情
|
|
|
- RedisDbconn.Instance.AddList("OpenRewardDetail:" + puser.Id + ":" + pos.BrandId + ":" + dateString, detail);
|
|
|
+ // 开机奖励详情
|
|
|
+ RedisDbconn.Instance.AddList("OpenRewardDetail:" + puser.Id + ":" + pos.BrandId + ":" + dateString, detail);
|
|
|
|
|
|
- Prize = 0;
|
|
|
+ Prize = 0;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // }
|
|
|
}
|
|
|
- // }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ db.Dispose();
|
|
|
+ }
|
|
|
+ catch(Exception ex)
|
|
|
+ {
|
|
|
+ function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "实时获取开机奖励异常");
|
|
|
}
|
|
|
- db.Dispose();
|
|
|
}
|
|
|
- catch(Exception ex)
|
|
|
+ else
|
|
|
{
|
|
|
- function.WriteLog(DateTime.Now.ToString() + "\r\n" + ex.ToString(), "实时获取开机奖励异常");
|
|
|
+ Thread.Sleep(5000);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1205,7 +1212,7 @@ namespace MySystem
|
|
|
function.WriteLog(DateTime.Now.ToString(), "执行流量费返佣");
|
|
|
SpModels.WebCMSEntities spdb = new SpModels.WebCMSEntities();
|
|
|
WebCMSEntities db = new WebCMSEntities();
|
|
|
- DateTime start = DateTime.Now.AddDays(-1);
|
|
|
+ DateTime start = DateTime.Now.AddDays(-2);
|
|
|
List<SpModels.TradeFluxRecord> trades = spdb.TradeFluxRecord.Where(m => m.CreateDate >= start && m.Status == 1).ToList();
|
|
|
foreach (SpModels.TradeFluxRecord trade in trades)
|
|
|
{
|
|
@@ -1832,7 +1839,7 @@ namespace MySystem
|
|
|
{
|
|
|
while (true)
|
|
|
{
|
|
|
- if(DateTime.Now.Day == 1 && DateTime.Now.Hour >= 4)
|
|
|
+ if(DateTime.Now.Day == 1 && DateTime.Now.Hour > 1)
|
|
|
{
|
|
|
string Month = DateTime.Now.AddDays(-1).ToString("yyyy-MM");
|
|
|
string flag = function.ReadInstance("/ProfitFlag/" + Month + ".txt");
|
|
@@ -1860,7 +1867,7 @@ namespace MySystem
|
|
|
int startid = 0;
|
|
|
while(op)
|
|
|
{
|
|
|
- var users = db.Users.Select(m => new { m.Id, m.AuthFlag }).Where(m => m.Id > startid && m.AuthFlag == 1 && m.Id == 66575).OrderBy(m => m.Id).Take(50).ToList();
|
|
|
+ var users = db.Users.Select(m => new { m.Id, m.AuthFlag }).Where(m => m.Id > startid && m.AuthFlag == 1).OrderBy(m => m.Id).Take(500).ToList();
|
|
|
function.WriteLog(users.Count.ToString(), "创客升级日志");
|
|
|
if(users.Count > 0)
|
|
|
{
|
|
@@ -1876,7 +1883,7 @@ namespace MySystem
|
|
|
bool check = db.TradeDaySummary.Any(m => m.UserId == user.Id && m.TradeMonth == TradeMonth && m.SeoTitle == "team");
|
|
|
if (check)
|
|
|
{
|
|
|
- TradeAmount += db.TradeDaySummary.Where(m => m.UserId == user.Id && m.TradeMonth == TradeMonth && m.SeoTitle == "team").Sum(m => m.HelpNonDirectTradeAmt + m.NotHelpNonDirectTradeAmt);
|
|
|
+ TradeAmount += db.TradeDaySummary.Where(m => m.UserId == user.Id && m.TradeMonth == TradeMonth && m.SeoTitle == "team").Sum(m => m.HelpNonDirectTradeAmt + m.HelpNonDirectDebitTradeAmt + m.NotHelpNonDirectTradeAmt + m.NotHelpNonDirectDebitTradeAmt + m.ProfitNonDirectTradeAmt + m.ProfitNonDirectDebitTradeAmt);
|
|
|
}
|
|
|
//助利宝团队交易额
|
|
|
DataTable checkdt = OtherMySqlConn.dtable("SELECT SUM(TradeAmount) TradeAmount FROM HelpProfitMerTradeSummay WHERE (MerchantId IN(SELECT MerchantId FROM HelpProfitMerIds WHERE UserId IN(SELECT Id from Users WHERE ParentNav like '%," + user.Id + ",%' OR Id=" + user.Id + "))) AND TradeMonth=" + TradeMonth + "");
|
|
@@ -1927,8 +1934,8 @@ namespace MySystem
|
|
|
function.WriteLog("升级:" + user.Id.ToString() + BeforeLevel + "->" + AfterLevel, "创客升级日志");
|
|
|
user.UserLevel = AfterLevel;
|
|
|
DateTime checkTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01 00:00:00");
|
|
|
- bool checkExist = db.UserRank.Any(m => m.CreateDate >= checkTime && m.UserId == user.Id);
|
|
|
- if(!checkExist)
|
|
|
+ UserRank rank = db.UserRank.FirstOrDefault(m => m.CreateDate >= checkTime && m.UserId == user.Id);
|
|
|
+ if(rank == null)
|
|
|
{
|
|
|
db.UserRank.Add(new UserRank()
|
|
|
{
|
|
@@ -1945,6 +1952,12 @@ namespace MySystem
|
|
|
});
|
|
|
db.SaveChanges();
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ rank.TradeAmt = TradeAmount;
|
|
|
+ rank.Rank = AfterLevel;
|
|
|
+ db.SaveChanges();
|
|
|
+ }
|
|
|
}
|
|
|
// 降级逻辑
|
|
|
// if(!upFlag && AfterLevel > 5)
|
|
@@ -1973,6 +1986,7 @@ namespace MySystem
|
|
|
}
|
|
|
startid = subuser.Id;
|
|
|
}
|
|
|
+ function.WriteLog(startid.ToString(), "创客升级日志");
|
|
|
}
|
|
|
else
|
|
|
{
|