private void AnalyUser(IQBContent db, string parentOpenId, int level) { var list = db.DBUserInfo.Where(a => a.UserRole == UserRole.Agent && a.UserStatus == UserStatus.PPUser && a.parentOpenId == parentOpenId).ToList(); level++; foreach (EUserInfo u in list) { // if (u.OpenId == "o3nwE0oE32A4jA-bGu9t59Ob4Qzc") continue; List <SFee> feeList = new List <SFee>(); SFee sfee = null; /*普通代理*/ //花呗 1 EQRUser qr = db.DBQRUser.Where(a => a.OpenId == u.OpenId && a.QRType == QRReceiveType.Small).FirstOrDefault(); if (qr != null) { var fee = 0.75 + Config.ChildFixRate * (level - 1); sfee = new SFee(); sfee.OrigFeeRate = Convert.ToSingle((qr.MarketRate - qr.Rate).ToString("0.00")); sfee.QRType = qr.QRType; qr.Rate = Convert.ToSingle((qr.MarketRate - fee).ToString("0.00")); sfee.AdjustedFeeRate = Convert.ToSingle((qr.MarketRate - qr.Rate).ToString("0.00")); feeList.Add(sfee); } //信用卡 0.63/0.75 qr = db.DBQRUser.Where(a => a.OpenId == u.OpenId && a.QRType == QRReceiveType.CreditCard).FirstOrDefault(); if (qr != null) { var fee = 0.63 + Config.CCChildFixRate * (level - 1); sfee = new SFee(); sfee.OrigFeeRate = Convert.ToSingle((qr.MarketRate - qr.Rate).ToString("0.00")); sfee.QRType = qr.QRType; qr.Rate = Convert.ToSingle((qr.MarketRate - fee).ToString("0.00")); sfee.AdjustedFeeRate = Convert.ToSingle((qr.MarketRate - qr.Rate).ToString("0.00")); feeList.Add(sfee); } WXNTAgentFeeRate(feeList, u.OpenId); AnalyUser(db, u.OpenId, level); _UserNum++; Console.WriteLine(string.Format("{1}调整代理:{0}", u.Name, _UserNum)); } }
public void UpdateAgentForSpecial() { using (IQBContent db = new IQBContent()) { var list = db.DBUserInfo.Where(a => a.parentOpenId == "o3nwE0vaY07Rr2RJRgb9JRKci_KI").ToList(); foreach (EUserInfo u in list) { List <SFee> feeList = new List <SFee>(); SFee sfee = null; /*总代*/ //花呗(0.75)/0.8 EQRUser qr = db.DBQRUser.Where(a => a.OpenId == u.OpenId && a.QRType == QRReceiveType.Small).FirstOrDefault(); var fee = 0.75; sfee = new SFee(); sfee.OrigFeeRate = Convert.ToSingle((qr.MarketRate - qr.Rate).ToString("0.00")); sfee.QRType = qr.QRType; qr.Rate = Convert.ToSingle((qr.MarketRate - fee).ToString("0.00")); sfee.AdjustedFeeRate = Convert.ToSingle((qr.MarketRate - qr.Rate).ToString("0.00")); feeList.Add(sfee); //信用卡0.63/0.65 qr = db.DBQRUser.Where(a => a.OpenId == u.OpenId && a.QRType == QRReceiveType.CreditCard).FirstOrDefault(); if (u.OpenId == "o3nwE0snE94bXggy2K8ZfHuyypVs" || u.OpenId == "o3nwE0og1j5cLMTVdg0XSjtJ88E8") { fee = 0.63; } else { fee = 0.65; } sfee = new SFee(); sfee.OrigFeeRate = Convert.ToSingle((qr.MarketRate - qr.Rate).ToString("0.00")); sfee.QRType = qr.QRType; qr.Rate = Convert.ToSingle((qr.MarketRate - fee).ToString("0.00")); sfee.AdjustedFeeRate = Convert.ToSingle((qr.MarketRate - qr.Rate).ToString("0.00")); feeList.Add(sfee); Console.WriteLine(string.Format("代理:{0}", u.Name)); // WXNTAgentFeeRate(feeList, u.OpenId); } db.SaveChanges(); Console.WriteLine(string.Format("调整代理Done")); } }
/// <summary> /// 批量更新代理费率 /// </summary> public void UpdateAgentRate() { using (IQBContent db = new IQBContent()) { var list = db.DBUserInfo.Where(a => a.UserRole == UserRole.DiamondAgent || a.UserRole == UserRole.Administrator && a.UserStatus == UserStatus.PPUser).ToList(); foreach (EUserInfo u in list) { List <SFee> feeList = new List <SFee>(); SFee sfee = null; /*总代*/ //花呗(0.75)/0.8 EQRUser qr = db.DBQRUser.Where(a => a.OpenId == u.OpenId && a.QRType == QRReceiveType.Small).FirstOrDefault(); var fee = 0.75; sfee = new SFee(); sfee.OrigFeeRate = Convert.ToSingle((qr.MarketRate - qr.Rate).ToString("0.00")); sfee.QRType = qr.QRType; qr.Rate = Convert.ToSingle((qr.MarketRate - fee).ToString("0.00")); sfee.AdjustedFeeRate = Convert.ToSingle((qr.MarketRate - qr.Rate).ToString("0.00")); feeList.Add(sfee); //信用卡0.63/0.65 qr = db.DBQRUser.Where(a => a.OpenId == u.OpenId && a.QRType == QRReceiveType.CreditCard).FirstOrDefault(); fee = 0.63; sfee = new SFee(); sfee.OrigFeeRate = Convert.ToSingle((qr.MarketRate - qr.Rate).ToString("0.00")); sfee.QRType = qr.QRType; qr.Rate = Convert.ToSingle((qr.MarketRate - fee).ToString("0.00")); sfee.AdjustedFeeRate = Convert.ToSingle((qr.MarketRate - qr.Rate).ToString("0.00")); feeList.Add(sfee); Console.WriteLine(string.Format("总代:{0}", u.Name)); // WXNTAgentFeeRate(feeList, u.OpenId); AnalyUser(db, u.OpenId, 1); } db.SaveChanges(); Console.WriteLine(string.Format("调整代理Done")); } }