123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504 |
- using System;
- using System.Threading;
- using System.Linq;
- using System.Data;
- using Library;
- using LitJson;
- using System.Collections.Generic;
- using MySystem.PxcModels;
- namespace MySystem
- {
- public class LeaderCompPrizeHelper
- {
- public readonly static LeaderCompPrizeHelper Instance = new LeaderCompPrizeHelper();
- private LeaderCompPrizeHelper()
- {
- }
- public void Start()//启动
- {
- Thread thread = new Thread(Listen);
- thread.IsBackground = true;
- thread.Start();
- }
- public void Listen()//启动
- {
- while(true)
- {
- if(DateTime.Now.Hour > 0 && DateTime.Now.Hour < 3)
- {
- if(DateTime.Now.Month == 1)
- {
- CustomerSqlConn.op("insert into LeaderCompTradeStatBak select * from LeaderCompTradeStat;insert into LeaderCompTmpBak select * from LeaderCompTmp;insert into LeaderCompPrizeBak select * from LeaderCompPrize;", MysqlConn.SqlConnStr);
- }
- Ready(DateTime.Now.ToString("yyyy-MM"));
- }
- Thread.Sleep(60000);
- }
- // doSomething("202306", "202305");
- // doSomething("202306", "202206");
- // doSomething("202305", "202206");
- // SendPrize("202306", "202305");
- // SendPrize("202306", "202206");
- // SendPrize("202305", "202206");
- }
- public void Ready(string curMonth)
- {
- CustomerSqlConn.op("delete from LeaderCompTradeStat;delete from LeaderCompTmp;delete from LeaderCompPrize;", MysqlConn.SqlConnStr);
- Thread.Sleep(10000);
- DateTime Start = DateTime.Parse("2023-06-01 00:00:00");
- DateTime now = DateTime.Parse(curMonth + "-01 00:00:00");
- while(now > Start)
- {
- string month = now.ToString("yyyyMM");
- string checkMonth = Start.ToString("yyyyMM");
- doSomething(month, checkMonth);
- now = now.AddMonths(-1);
- }
- now = DateTime.Parse(curMonth + "-01 00:00:00");
- while(now > Start)
- {
- string month = now.ToString("yyyyMM");
- string checkMonth = Start.ToString("yyyyMM");
- SendPrize(month, checkMonth);
- now = now.AddMonths(-1);
- }
- }
- public void doSomething(string month, string checkMonth)
- {
- try
- {
- WebCMSEntities db = new WebCMSEntities();
- OpModels.WebCMSEntities opdb = new OpModels.WebCMSEntities();
- string MonthString = month + "-" + checkMonth;
- //统计交易增量
- function.WriteLog(DateTime.Now.ToString(), "领导人达标奖励日志");
- DataTable dt = CustomerSqlConn.dtable("select CONCAT('insert into LeaderCompTradeStat (CreateDate,UserId,StatMonth,TradeAmount,SelfTradeAmount,CheckTradeAmount,CheckSelfTradeAmount) values (now(),', UserId,',\\\'" + month + "-" + checkMonth + "\\\',', amt" + month + ",',', samt" + month + ",',', amt" + checkMonth + ",',', samt" + checkMonth + ",');') from (select UserId,(case when amt" + month + " is null then 0 else amt" + month + " end) amt" + month + ",(case when samt" + month + " is null then 0 else samt" + month + " end) samt" + month + ",(case when amt" + checkMonth + " is null then 0 else amt" + checkMonth + " end) amt" + checkMonth + ",(case when samt" + checkMonth + " is null then 0 else samt" + checkMonth + " end) samt" + checkMonth + " from (select UserId,sum(HelpNonDirectTradeAmt + NotHelpNonDirectTradeAmt + ProfitNonDirectTradeAmt + HelpNonDirectDebitTradeAmt + NotHelpNonDirectDebitTradeAmt + ProfitNonDirectDebitTradeAmt) amt" + month + ",(select sum(HelpNonDirectTradeAmt + NotHelpNonDirectTradeAmt + ProfitNonDirectTradeAmt + HelpNonDirectDebitTradeAmt + NotHelpNonDirectDebitTradeAmt + ProfitNonDirectDebitTradeAmt) from TradeDaySummary" + checkMonth + " where SeoTitle='team' and UserId=main.UserId) amt" + checkMonth + ",(select sum(HelpDirectTradeAmt + NotHelpDirectTradeAmt + ProfitDirectTradeAmt + HelpDirectDebitTradeAmt + NotHelpDirectDebitTradeAmt + ProfitDirectDebitTradeAmt) from TradeDaySummary" + month + " where SeoTitle='self' and UserId=main.UserId) samt" + month + ",(select sum(HelpDirectTradeAmt + NotHelpDirectTradeAmt + ProfitDirectTradeAmt + HelpDirectDebitTradeAmt + NotHelpDirectDebitTradeAmt + ProfitDirectDebitTradeAmt) from TradeDaySummary" + checkMonth + " where SeoTitle='self' and UserId=main.UserId) samt" + checkMonth + " from TradeDaySummary" + month + " main where SeoTitle='team' and UserId>0 group by UserId) tb) tb2", MysqlConn.RdsStatSqlConnStr);
- string sql = "";
- int num = 0;
- foreach(DataRow dr in dt.Rows)
- {
- sql += dr[0].ToString();
- num += 1;
- if(num >= 200)
- {
- CustomerSqlConn.op(sql, MysqlConn.SqlConnStr);
- sql = "";
- num = 0;
- }
- }
- if(!string.IsNullOrEmpty(sql))
- {
- CustomerSqlConn.op(sql, MysqlConn.SqlConnStr);
- }
- CustomerSqlConn.op("update LeaderCompTradeStat leader set ParentUserId=case when (select ParentUserId from Users where Id=leader.UserId) is null then 0 else (select ParentUserId from Users where Id=leader.UserId) end,ParentNav=(select ParentNav from Users where Id=leader.UserId) where StatMonth='" + month + "-" + checkMonth + "' and UserId>1", MysqlConn.SqlConnStr);
- function.WriteLog(DateTime.Now.ToString(), "领导人达标奖励日志");
- //计算创客名下的达标人数,直推和间接
- function.WriteLog("MonthString:" + MonthString, "领导人达标奖励日志");
- List<LeaderCompTradeStat> stats = db.LeaderCompTradeStat.Where(m => m.StatMonth == MonthString).ToList();
- function.WriteLog(stats.Count.ToString(), "领导人达标奖励日志");
- foreach(LeaderCompTradeStat stat in stats)
- {
- decimal totalAmount = stat.SelfTradeAmount - stat.CheckSelfTradeAmount; //当月交易
- List<LeaderCompTradeStat> directs = stats.Where(m => m.ParentUserId == stat.UserId).ToList();
- foreach(LeaderCompTradeStat direct in directs)
- {
- decimal parentTotalAmount = direct.TradeAmount - direct.CheckTradeAmount;
- if(parentTotalAmount < 30000000)
- {
- totalAmount += parentTotalAmount;
- }
- }
- function.WriteLog("UserId:" + stat.UserId, "领导人达标奖励日志");
- function.WriteLog("totalAmount:" + totalAmount, "领导人达标奖励日志");
- if(totalAmount >= 30000000 && !string.IsNullOrEmpty(stat.ParentNav))
- {
- LeaderCompTradeStat statEdit = db.LeaderCompTradeStat.FirstOrDefault(m => m.UserId == stat.UserId && m.StatMonth == MonthString);
- if(statEdit != null)
- {
- statEdit.ResultTradeAmount = totalAmount;
- db.SaveChanges();
- }
- LeaderCompTmp tmp = db.LeaderCompTmp.FirstOrDefault(m => m.Id == stat.UserId);
- if(tmp == null)
- {
- tmp = db.LeaderCompTmp.Add(new LeaderCompTmp()
- {
- Id = stat.UserId,
- ParentUserId = stat.ParentUserId,
- ParentNav = stat.ParentNav
- }).Entity;
- db.SaveChanges();
- }
- Dictionary<string, object> EveryMonthData = new Dictionary<string, object>();
- if(!string.IsNullOrEmpty(tmp.EveryMonthData))
- {
- EveryMonthData = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(tmp.EveryMonthData);
- }
- if(!EveryMonthData.ContainsKey(MonthString))
- {
- EveryMonthData.Add(MonthString, 1);
- }
- else
- {
- EveryMonthData[MonthString] = 1;
- }
- tmp.EveryMonthData = Newtonsoft.Json.JsonConvert.SerializeObject(EveryMonthData);
- db.SaveChanges();
- string[] parents = stat.ParentNav.Trim(',').Replace(",,", ",").Split(',');
- Array.Reverse(parents);
- int index = 0;
- foreach(string parent in parents)
- {
- index += 1;
- int ParentUserId = int.Parse(function.CheckInt(parent));
- LeaderCompPrize prize = db.LeaderCompPrize.FirstOrDefault(m => m.UserId == ParentUserId && m.StatMonth == MonthString);
- if(prize == null)
- {
- Users user = db.Users.FirstOrDefault(m => m.Id == ParentUserId) ?? new Users();
- prize = db.LeaderCompPrize.Add(new LeaderCompPrize()
- {
- CreateDate = DateTime.Now,
- UserId = ParentUserId,
- ParentUserId = user.ParentUserId,
- ParentNav = user.ParentNav,
- StatMonth = MonthString,
- }).Entity;
- db.SaveChanges();
- }
- if(index == 1)
- {
- prize.DirectCount += 1;
- }
- else
- {
- prize.NotDirectCount += 1;
- }
- db.SaveChanges();
- }
- }
- function.WriteLog(DateTime.Now.ToString() + "------" + stat.UserId, "领导人达标奖励日志");
- }
- function.WriteLog(DateTime.Now.ToString(), "领导人达标奖励日志");
- db.Dispose();
- }
- catch(Exception ex)
- {
- function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "领导达标人奖励异常");
- }
- }
- private void SendPrize(string month, string checkDate)
- {
- string MonthFlag = month + "-" + checkDate;
- WebCMSEntities db = new WebCMSEntities();
- OpModels.WebCMSEntities opdb = new OpModels.WebCMSEntities();
- //计算运营中心或大盟主达标奖励
- List<LeaderCompPrize> leaderPrizes = db.LeaderCompPrize.Where(m => m.StatMonth == MonthFlag).ToList();
- function.WriteLog(leaderPrizes.Count.ToString(), "领导人达标奖励日志");
- foreach(LeaderCompPrize leaderPrize in leaderPrizes)
- {
- Users user = db.Users.FirstOrDefault(m => m.Id == leaderPrize.UserId) ?? new Users();
- // if(user.UserType == 1)
- // {
- // OpModels.SysAdmin opSys = opdb.SysAdmin.FirstOrDefault(m => m.UserId == user.Id);
- // if(opSys != null)
- // {
- // // checkDate = opSys.CreateDate.Value.AddMonths(-1).ToString("yyyyMM");
- // }
- // }
- // else if(user.LeaderLevel == 2)
- // {
- // Leaders leader = db.Leaders.FirstOrDefault(m => m.Id == user.Id);
- // if(leader != null)
- // {
- // // checkDate = leader.LastBuyDate.Value.AddMonths(-1).ToString("yyyyMM");
- // }
- // }
- string CheckJson = "\"" + MonthFlag + "\":1";
- string NavUserId = "," + user.Id + ",";
- int person = 0;
- int directPerson = 0;
- int totalPerson = db.LeaderCompTmp.Count(m => (m.ParentNav.Contains(NavUserId)) && m.EveryMonthData.Contains(CheckJson));
- var subusers = db.Users.Select(m => new { m.Id, m.ParentUserId }).Where(m => m.ParentUserId == user.Id).ToList();
- foreach(var subuser in subusers)
- {
- string subNavUserId = "," + subuser.Id + ",";
- if(db.LeaderCompTmp.Count(m => (m.ParentNav.Contains(subNavUserId) || m.Id == subuser.Id) && m.EveryMonthData.Contains(CheckJson)) > 0)
- {
- person += 1;
- }
- if(db.LeaderCompTmp.Any(m => m.Id == subuser.Id && m.EveryMonthData.Contains(CheckJson)))
- {
- directPerson += 1;
- }
- }
- // List<LeaderCompPrize> list = db.LeaderCompPrize.Where(m => m.StatMonth == MonthFlag && m.ParentUserId == user.Id).ToList();
- // foreach(LeaderCompPrize sub in list)
- // {
- // if(sub.DirectCount + sub.NotDirectCount > 0)
- // {
- // person += 1;
- // }
- // totalPerson += sub.DirectCount + sub.NotDirectCount;
- // }
- int maxPerson = person * person;
- decimal CompPrize = 0;
- if(totalPerson >= maxPerson)
- {
- CompPrize = GetPrize(maxPerson - person, person);
- }
- else
- {
- CompPrize = GetPrize(totalPerson - person, person);
- }
- LeaderCompPrize edit = db.LeaderCompPrize.FirstOrDefault(m => m.StatMonth == MonthFlag && m.UserId == leaderPrize.UserId);
- if(edit != null)
- {
- edit.DirectCount = directPerson;
- edit.NotDirectCount = totalPerson - person;
- edit.SecDirectCount = person;
- edit.CompPrize = CompPrize;
- }
- db.SaveChanges();
- }
- function.WriteLog(DateTime.Now.ToString(), "领导人达标奖励日志");
- db.Dispose();
- opdb.Dispose();
- }
- private decimal GetPrize(int count, int direct)
- {
- decimal prize = 0;
- if (count + direct >= 30)
- {
- prize = 3000 * (count + direct * 2);
- }
- else if (count + direct >= 25)
- {
- prize = 2500 * (count + direct * 2);
- }
- else if (count + direct >= 20)
- {
- prize = 2000 * (count + direct * 2);
- }
- else if (count + direct >= 15)
- {
- prize = 1500 * (count + direct * 2);
- }
- else if (count + direct >= 10)
- {
- prize = 1000 * (count + direct * 2);
- }
- else if (count + direct >= 5)
- {
- prize = 500 * (count + direct * 2);
- }
- return prize;
- }
-
-
-
-
-
-
-
-
-
- public void doEverday(string month, string checkMonth)
- {
- try
- {
- WebCMSEntities db = new WebCMSEntities();
- OpModels.WebCMSEntities opdb = new OpModels.WebCMSEntities();
- string MonthString = month + "-" + checkMonth;
- //统计交易增量
- function.WriteLog(DateTime.Now.ToString(), "领导人达标奖励日志");
- DataTable dt = CustomerSqlConn.dtable("select CONCAT('insert into LeaderCompTradeStatBak (CreateDate,UserId,StatMonth,TradeAmount,SelfTradeAmount,CheckTradeAmount,CheckSelfTradeAmount) values (now(),', UserId,',\\\'" + month + "-" + checkMonth + "\\\',', amt" + month + ",',', samt" + month + ",',', amt" + checkMonth + ",',', samt" + checkMonth + ",');') from (select UserId,(case when amt" + month + " is null then 0 else amt" + month + " end) amt" + month + ",(case when samt" + month + " is null then 0 else samt" + month + " end) samt" + month + ",(case when amt" + checkMonth + " is null then 0 else amt" + checkMonth + " end) amt" + checkMonth + ",(case when samt" + checkMonth + " is null then 0 else samt" + checkMonth + " end) samt" + checkMonth + " from (select UserId,sum(HelpNonDirectTradeAmt + NotHelpNonDirectTradeAmt + ProfitNonDirectTradeAmt + HelpNonDirectDebitTradeAmt + NotHelpNonDirectDebitTradeAmt + ProfitNonDirectDebitTradeAmt) amt" + month + ",(select sum(HelpNonDirectTradeAmt + NotHelpNonDirectTradeAmt + ProfitNonDirectTradeAmt + HelpNonDirectDebitTradeAmt + NotHelpNonDirectDebitTradeAmt + ProfitNonDirectDebitTradeAmt) from TradeDaySummary" + checkMonth + " where SeoTitle='team' and UserId=main.UserId) amt" + checkMonth + ",(select sum(HelpDirectTradeAmt + NotHelpDirectTradeAmt + ProfitDirectTradeAmt + HelpDirectDebitTradeAmt + NotHelpDirectDebitTradeAmt + ProfitDirectDebitTradeAmt) from TradeDaySummary" + month + " where SeoTitle='self' and UserId=main.UserId) samt" + month + ",(select sum(HelpDirectTradeAmt + NotHelpDirectTradeAmt + ProfitDirectTradeAmt + HelpDirectDebitTradeAmt + NotHelpDirectDebitTradeAmt + ProfitDirectDebitTradeAmt) from TradeDaySummary" + checkMonth + " where SeoTitle='self' and UserId=main.UserId) samt" + checkMonth + " from TradeDaySummary" + month + " main where SeoTitle='team' and UserId>0 group by UserId) tb) tb2", MysqlConn.RdsStatSqlConnStr);
- string sql = "";
- int num = 0;
- foreach(DataRow dr in dt.Rows)
- {
- sql += dr[0].ToString();
- num += 1;
- if(num >= 200)
- {
- CustomerSqlConn.op(sql, MysqlConn.SqlConnStr);
- sql = "";
- num = 0;
- }
- }
- if(!string.IsNullOrEmpty(sql))
- {
- CustomerSqlConn.op(sql, MysqlConn.SqlConnStr);
- }
- CustomerSqlConn.op("update LeaderCompTradeStatBak leader set ParentUserId=case when (select ParentUserId from Users where Id=leader.UserId) is null then 0 else (select ParentUserId from Users where Id=leader.UserId) end,ParentNav=(select ParentNav from Users where Id=leader.UserId) where StatMonth='" + month + "-" + checkMonth + "' and UserId>1", MysqlConn.SqlConnStr);
- function.WriteLog(DateTime.Now.ToString(), "领导人达标奖励日志");
- //计算创客名下的达标人数,直推和间接
- function.WriteLog("MonthString:" + MonthString, "领导人达标奖励日志");
- List<LeaderCompTradeStatBak> stats = db.LeaderCompTradeStatBak.Where(m => m.StatMonth == MonthString).ToList();
- function.WriteLog(stats.Count.ToString(), "领导人达标奖励日志");
- foreach(LeaderCompTradeStatBak stat in stats)
- {
- decimal totalAmount = stat.SelfTradeAmount - stat.CheckSelfTradeAmount; //当月交易
- List<LeaderCompTradeStatBak> directs = stats.Where(m => m.ParentUserId == stat.UserId).ToList();
- foreach(LeaderCompTradeStatBak direct in directs)
- {
- decimal parentTotalAmount = direct.TradeAmount - direct.CheckTradeAmount;
- if(parentTotalAmount < 30000000)
- {
- totalAmount += parentTotalAmount;
- }
- }
- function.WriteLog("UserId:" + stat.UserId, "领导人达标奖励日志");
- function.WriteLog("totalAmount:" + totalAmount, "领导人达标奖励日志");
- if(totalAmount >= 30000000 && !string.IsNullOrEmpty(stat.ParentNav))
- {
- LeaderCompTradeStatBak statEdit = db.LeaderCompTradeStatBak.FirstOrDefault(m => m.UserId == stat.UserId && m.StatMonth == MonthString);
- if(statEdit != null)
- {
- statEdit.ResultTradeAmount = totalAmount;
- db.SaveChanges();
- }
- LeaderCompTmpBak tmp = db.LeaderCompTmpBak.FirstOrDefault(m => m.Id == stat.UserId);
- if(tmp == null)
- {
- tmp = db.LeaderCompTmpBak.Add(new LeaderCompTmpBak()
- {
- Id = stat.UserId,
- ParentUserId = stat.ParentUserId,
- ParentNav = stat.ParentNav
- }).Entity;
- db.SaveChanges();
- }
- Dictionary<string, object> EveryMonthData = new Dictionary<string, object>();
- if(!string.IsNullOrEmpty(tmp.EveryMonthData))
- {
- EveryMonthData = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(tmp.EveryMonthData);
- }
- if(!EveryMonthData.ContainsKey(MonthString))
- {
- EveryMonthData.Add(MonthString, 1);
- }
- else
- {
- EveryMonthData[MonthString] = 1;
- }
- tmp.EveryMonthData = Newtonsoft.Json.JsonConvert.SerializeObject(EveryMonthData);
- db.SaveChanges();
- string[] parents = stat.ParentNav.Trim(',').Replace(",,", ",").Split(',');
- Array.Reverse(parents);
- int index = 0;
- foreach(string parent in parents)
- {
- index += 1;
- int ParentUserId = int.Parse(function.CheckInt(parent));
- LeaderCompPrizeBak prize = db.LeaderCompPrizeBak.FirstOrDefault(m => m.UserId == ParentUserId && m.StatMonth == MonthString);
- if(prize == null)
- {
- Users user = db.Users.FirstOrDefault(m => m.Id == ParentUserId) ?? new Users();
- prize = db.LeaderCompPrizeBak.Add(new LeaderCompPrizeBak()
- {
- CreateDate = DateTime.Now,
- UserId = ParentUserId,
- ParentUserId = user.ParentUserId,
- ParentNav = user.ParentNav,
- StatMonth = MonthString,
- }).Entity;
- db.SaveChanges();
- }
- if(index == 1)
- {
- prize.DirectCount += 1;
- }
- else
- {
- prize.NotDirectCount += 1;
- }
- db.SaveChanges();
- }
- }
- function.WriteLog(DateTime.Now.ToString() + "------" + stat.UserId, "领导人达标奖励日志");
- }
- function.WriteLog(DateTime.Now.ToString(), "领导人达标奖励日志");
- db.Dispose();
- }
- catch(Exception ex)
- {
- function.WriteLog(DateTime.Now.ToString() + "\n" + ex.ToString(), "领导达标人奖励异常");
- }
- }
-
- private void SendPrizeEveryDay(string month, string checkDate)
- {
- string MonthFlag = month + "-" + checkDate;
- WebCMSEntities db = new WebCMSEntities();
- OpModels.WebCMSEntities opdb = new OpModels.WebCMSEntities();
- //计算运营中心或大盟主达标奖励
- List<LeaderCompPrizeBak> leaderPrizes = db.LeaderCompPrizeBak.Where(m => m.StatMonth == MonthFlag).ToList();
- function.WriteLog(leaderPrizes.Count.ToString(), "领导人达标奖励日志");
- foreach(LeaderCompPrizeBak leaderPrize in leaderPrizes)
- {
- Users user = db.Users.FirstOrDefault(m => m.Id == leaderPrize.UserId) ?? new Users();
- string CheckJson = "\"" + MonthFlag + "\":1";
- string NavUserId = "," + user.Id + ",";
- int person = 0;
- int directPerson = 0;
- int totalPerson = db.LeaderCompTmpBak.Count(m => (m.ParentNav.Contains(NavUserId)) && m.EveryMonthData.Contains(CheckJson));
- var subusers = db.Users.Select(m => new { m.Id, m.ParentUserId }).Where(m => m.ParentUserId == user.Id).ToList();
- foreach(var subuser in subusers)
- {
- string subNavUserId = "," + subuser.Id + ",";
- if(db.LeaderCompTmpBak.Count(m => (m.ParentNav.Contains(subNavUserId) || m.Id == subuser.Id) && m.EveryMonthData.Contains(CheckJson)) > 0)
- {
- person += 1;
- }
- if(db.LeaderCompTmpBak.Any(m => m.Id == subuser.Id && m.EveryMonthData.Contains(CheckJson)))
- {
- directPerson += 1;
- }
- }
- int maxPerson = person * person;
- decimal CompPrize = 0;
- if(totalPerson >= maxPerson)
- {
- CompPrize = GetPrize(maxPerson - person, person);
- }
- else
- {
- CompPrize = GetPrize(totalPerson - person, person);
- }
- LeaderCompPrizeBak edit = db.LeaderCompPrizeBak.FirstOrDefault(m => m.StatMonth == MonthFlag && m.UserId == leaderPrize.UserId);
- if(edit != null)
- {
- edit.DirectCount = directPerson;
- edit.NotDirectCount = totalPerson - person;
- edit.SecDirectCount = person;
- edit.CompPrize = CompPrize;
- }
- db.SaveChanges();
- }
- function.WriteLog(DateTime.Now.ToString(), "领导人达标奖励日志");
- db.Dispose();
- opdb.Dispose();
- }
-
- }
- }
|