|
|
@@ -17,512 +17,12 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
[Area("Admin")]
|
|
|
[Route("Admin/[controller]/[action]")]
|
|
|
- public class ExportTable : BaseController
|
|
|
+ public class ExportTableController : BaseController
|
|
|
{
|
|
|
- public ExportTable(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
|
|
|
+ public ExportTableController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
|
|
|
{
|
|
|
OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
}
|
|
|
|
|
|
- #region 分润
|
|
|
-
|
|
|
- public IActionResult Profit()
|
|
|
- {
|
|
|
- DataTable dt = OtherMySqlConn.dtable("select MakerCode,RealName,UserLevel,Rank,DirectFlag,BrandName,CreditTradeAmt,CreditTradeProfit,QrCreditTradeAmt,QrCreditTradeProfit,NonQrCreditTradeAmt,NonQrCreditTradeProfit,HelpCreditTradeAmt,HelpCreditTradeProfit,NotHelpCreditTradeAmt,NotHelpCreditTradeProfit,DebitTradeAmt,DebitTradeProfit from ProfitRewardExport where SeoTitle='" + DateTime.Now.AddMonths(-1).ToString("yyyyMM") + "'");
|
|
|
- string html = "<table>";
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>创客编号</td>";
|
|
|
- html += "<td>创客姓名</td>";
|
|
|
- html += "<td>创客职级</td>";
|
|
|
- html += "<td>预设职级</td>";
|
|
|
- html += "<td>分润类型</td>";
|
|
|
- html += "<td>品牌</td>";
|
|
|
- html += "<td>贷记卡交易额</td>";
|
|
|
- html += "<td>贷记卡分润</td>";
|
|
|
- html += "<td>云闪付贷记卡交易额</td>";
|
|
|
- html += "<td>云闪付贷记卡分润</td>";
|
|
|
- html += "<td>非云闪付贷记卡交易额</td>";
|
|
|
- html += "<td>非云闪付贷记卡分润</td>";
|
|
|
- html += "<td>非云闪付扶持期贷记卡交易额</td>";
|
|
|
- html += "<td>非云闪付扶持期贷记卡分润</td>";
|
|
|
- html += "<td>非云闪付稳定期贷记卡交易额</td>";
|
|
|
- html += "<td>非云闪付稳定期贷记卡分润</td>";
|
|
|
- html += "<td>借记卡交易额</td>";
|
|
|
- html += "<td>借记卡分润</td>";
|
|
|
- html += "</tr>";
|
|
|
- foreach(DataRow dr in dt.Rows)
|
|
|
- {
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>" + dr["MakerCode"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["RealName"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["UserLevel"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["Rank"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["DirectFlag"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["BrandName"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["CreditTradeAmt"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["CreditTradeProfit"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["QrCreditTradeAmt"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["QrCreditTradeProfit"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["NonQrCreditTradeAmt"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["NonQrCreditTradeProfit"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["HelpCreditTradeAmt"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["HelpCreditTradeProfit"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["NotHelpCreditTradeAmt"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["NotHelpCreditTradeProfit"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["DebitTradeAmt"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["DebitTradeProfit"].ToString() + "</td>";
|
|
|
- html += "</tr>";
|
|
|
- }
|
|
|
- html += "</table>";
|
|
|
- ViewBag.html = html;
|
|
|
-
|
|
|
- return View();
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 补贴
|
|
|
-
|
|
|
- public IActionResult Subsidy()
|
|
|
- {
|
|
|
- DataTable dt = OtherMySqlConn.dtable("select MakerCode,RealName,UserLevel,Rank,KqSnNo,MerchantName,DirectFlag,BrandName,CreditTradeAmt,SubsidyProfit from ProfitSubsidyExport where SeoTitle='" + DateTime.Now.AddMonths(-1).ToString("yyyyMM") + "'");
|
|
|
- string html = "<table>";
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>创客编号</td>";
|
|
|
- html += "<td>创客名称</td>";
|
|
|
- html += "<td>创客职级</td>";
|
|
|
- html += "<td>设置职级</td>";
|
|
|
- html += "<td>商户编号</td>";
|
|
|
- html += "<td>商户名称</td>";
|
|
|
- html += "<td>补贴类型</td>";
|
|
|
- html += "<td>品牌</td>";
|
|
|
- html += "<td>贷记卡交易额</td>";
|
|
|
- html += "<td>补贴分润</td>";
|
|
|
- html += "</tr>";
|
|
|
- foreach(DataRow dr in dt.Rows)
|
|
|
- {
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>" + dr["MakerCode"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["RealName"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["UserLevel"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["Rank"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["KqSnNo"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["MerchantName"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["DirectFlag"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["BrandName"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["CreditTradeAmt"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["SubsidyProfit"].ToString() + "</td>";
|
|
|
- html += "</tr>";
|
|
|
- }
|
|
|
- html += "</table>";
|
|
|
- ViewBag.html = html;
|
|
|
-
|
|
|
- return View();
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 666推荐王
|
|
|
-
|
|
|
- public IActionResult Recommend()
|
|
|
- {
|
|
|
- DateTime start = DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("yyyyMM") + "-01 00:00:00");
|
|
|
- DateTime end = start.AddMonths(1);
|
|
|
- string TradeMonth = start.ToString("yyyyMM");
|
|
|
- List<RecommendPriceList> userdic = new List<RecommendPriceList>();
|
|
|
- WebCMSEntities db = new WebCMSEntities();
|
|
|
- //判断当月是否下单
|
|
|
- bool checkOrder = db.Orders.Any(m => m.PayDate >= start && m.PayDate < end && m.Status > 0 && m.TotalPrice == 66);
|
|
|
- if(checkOrder)
|
|
|
- {
|
|
|
- //统计当月下单名单
|
|
|
- List<int> uids = db.Orders.Where(m => m.PayDate >= start && m.PayDate < end && m.Status > 0 && m.TotalPrice == 66).ToList().Select(m => m.UserId).Distinct().ToList();
|
|
|
- foreach(int uid in uids)
|
|
|
- {
|
|
|
- int ActCount = 0;
|
|
|
- List<Users> users = db.Users.Where(m => m.ParentUserId == uid && m.AuthFlag == 1 && m.AuthDate >= start).ToList();
|
|
|
- foreach(Users user in users)
|
|
|
- {
|
|
|
- int BeforeActCount = db.PosMachinesTwo.Count(m => m.BuyUserId == user.Id && m.ActivationState == 1 && m.ActivationTime < start);
|
|
|
- if(BeforeActCount == 0)
|
|
|
- {
|
|
|
- decimal tradeAmt = 0; //机具总交易额
|
|
|
- int actPosCount = 0; //激活机具数量
|
|
|
- //查询当前创客所属机具
|
|
|
- var posList = db.PosMachinesTwo.Select(m => new { m.ActivationState, m.ActivationTime, m.BuyUserId, m.BindMerchantId }).Where(m => m.BuyUserId == user.Id && m.ActivationState == 1 && m.ActivationTime >= start && m.ActivationTime < end).ToList();
|
|
|
- if(posList.Count > 0)
|
|
|
- {
|
|
|
- actPosCount = posList.Count;
|
|
|
- foreach(var pos in posList)
|
|
|
- {
|
|
|
- //查询机具交易额
|
|
|
- bool checkTrade = db.PosMerchantTradeSummay.Any(m => m.MerchantId == pos.BindMerchantId && m.TradeMonth == TradeMonth);
|
|
|
- if(checkTrade)
|
|
|
- {
|
|
|
- tradeAmt += db.PosMerchantTradeSummay.Where(m => m.MerchantId == pos.BindMerchantId && m.TradeMonth == TradeMonth).Sum(m => m.TradeAmount);
|
|
|
- }
|
|
|
- }
|
|
|
- decimal AvgTradeAmount = tradeAmt / actPosCount;
|
|
|
- if(AvgTradeAmount >= 30000 && actPosCount >= 3)
|
|
|
- {
|
|
|
- ActCount += 1;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- RecommendPriceList item = userdic.FirstOrDefault(m => m.UserId == uid);
|
|
|
- if(item != null)
|
|
|
- {
|
|
|
- item.ActCount += ActCount;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- userdic.Add(new RecommendPriceList()
|
|
|
- {
|
|
|
- UserId = uid,
|
|
|
- ActCount = ActCount,
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- string html = "<table>";
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>创客编号</td>";
|
|
|
- html += "<td>创客姓名</td>";
|
|
|
- html += "<td>推荐总数</td>";
|
|
|
- html += "<td>成功推荐数</td>";
|
|
|
- html += "<td>是否达标</td>";
|
|
|
- html += "</tr>";
|
|
|
- foreach(RecommendPriceList item in userdic)
|
|
|
- {
|
|
|
- string status = "未达标";
|
|
|
- if(item.ActCount >= 6)
|
|
|
- {
|
|
|
- status = "已达标";
|
|
|
- }
|
|
|
- Users user = db.Users.FirstOrDefault(m => m.Id == item.UserId) ?? new Users();
|
|
|
- int subCount = db.Users.Count(m => m.ParentUserId == item.UserId && m.AuthFlag == 1 && m.AuthDate >= start);
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>" + user.MakerCode + "</td>"; //创客编号
|
|
|
- html += "<td>" + user.RealName + "</td>"; //创客姓名
|
|
|
- html += "<td>" + subCount + "</td>"; //推荐总数
|
|
|
- html += "<td>" + item.ActCount + "</td>"; //成功推荐数
|
|
|
- html += "<td>" + status + "</td>"; //是否达标
|
|
|
- html += "</tr>";
|
|
|
- }
|
|
|
- html += "</table>";
|
|
|
- db.Dispose();
|
|
|
- ViewBag.html = html;
|
|
|
- return View();
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 888翻倍奖
|
|
|
-
|
|
|
- public IActionResult Double()
|
|
|
- {
|
|
|
- WebCMSEntities maindb = new WebCMSEntities();
|
|
|
- List<int> userIdList = new List<int>();
|
|
|
- string html = "<table>";
|
|
|
- DateTime StartDate = DateTime.Parse(DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01 00:00:00");
|
|
|
- DateTime EndDate = StartDate.AddMonths(1);
|
|
|
- var orders = maindb.Orders.Select(m => new { m.UserId, m.TotalPrice, m.Status, m.PayDate }).Where(m => m.PayDate >= StartDate && m.PayDate < EndDate && m.TotalPrice == 88 && m.Status > 0).ToList();
|
|
|
- foreach (var order in orders)
|
|
|
- {
|
|
|
- userIdList.Add(order.UserId);
|
|
|
- }
|
|
|
- foreach (int UserId in userIdList)
|
|
|
- {
|
|
|
- Users myuser = maindb.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
|
|
|
- var lastmonth = DateTime.Now.AddMonths(-2).ToString("yyyyMM");
|
|
|
- var thismonth = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
|
|
|
- DateTime start = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date;
|
|
|
- DateTime end = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddSeconds(-1);
|
|
|
- string UserIdString = "," + UserId + ",";
|
|
|
- List<Users> users = maindb.Users.Where(m => m.ParentNav.Contains(UserIdString) || m.Id == UserId).ToList();
|
|
|
- List<int> uids = new List<int>();
|
|
|
- List<int> uids2 = new List<int>();
|
|
|
- foreach (var user in users)
|
|
|
- {
|
|
|
- uids.Add(user.Id);
|
|
|
- }
|
|
|
- var suborders = orders.Where(m => uids.Contains(m.UserId)).ToList();
|
|
|
- foreach (var suborder in suborders)
|
|
|
- {
|
|
|
- uids2.Add(suborder.UserId);
|
|
|
- }
|
|
|
- users = users.Where(m => uids2.Contains(m.Id)).ToList();
|
|
|
- List<ProgressUserList> list = new List<ProgressUserList>();
|
|
|
- foreach (Users user in users)
|
|
|
- {
|
|
|
- int IsOk = 0;//是否达标(0-否 1-是)
|
|
|
- decimal lastMonthAmt = maindb.TradeDaySummary.Where(m => m.TradeMonth == lastmonth && m.SeoTitle == "team" && m.UserId == user.Id).Sum(m => m.HelpNonDirectTradeAmt + m.NotHelpNonDirectTradeAmt);
|
|
|
- decimal thisMonthAmt = maindb.TradeDaySummary.Where(m => m.TradeMonth == thismonth && m.SeoTitle == "team" && m.UserId == user.Id).Sum(m => m.HelpNonDirectTradeAmt + m.NotHelpNonDirectTradeAmt);
|
|
|
- if (thisMonthAmt >= lastMonthAmt * 2 && thisMonthAmt >= 2000000)
|
|
|
- {
|
|
|
- IsOk = 1;
|
|
|
- }
|
|
|
- ProgressUserList item = new ProgressUserList()
|
|
|
- {
|
|
|
- LastMonth = lastMonthAmt,
|
|
|
- ThisMonth = thisMonthAmt,
|
|
|
- UserId = user.Id,
|
|
|
- ParentNav = user.ParentNav,
|
|
|
- IsOk = IsOk,
|
|
|
- };
|
|
|
- list.Add(item);
|
|
|
- }
|
|
|
- list = list.OrderBy(m => m.ParentNav).ToList();
|
|
|
- int index = 0;
|
|
|
- decimal selfTrade = 0; // 自己的本月交易额
|
|
|
- decimal lastTrade = 0; // 自己的上月交易额
|
|
|
- decimal totalTrade = 0; // 自己的本月目标交易额
|
|
|
- string selfNav = ""; // 自己的ParentNav
|
|
|
- List<string> ParentNavs = new List<string>();
|
|
|
- if (list.Count > 0)
|
|
|
- {
|
|
|
- foreach (ProgressUserList sub in list)
|
|
|
- {
|
|
|
- index += 1;
|
|
|
- if (index == 1)
|
|
|
- {
|
|
|
- selfTrade = sub.ThisMonth;
|
|
|
- lastTrade = sub.LastMonth;
|
|
|
- totalTrade = lastTrade * 2;
|
|
|
- selfNav = sub.ParentNav + "," + sub.UserId + ",";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- bool op = true; //是否满足条件
|
|
|
- string ParentNav = sub.ParentNav + "," + sub.UserId + ",";
|
|
|
- foreach (string subNav in ParentNavs)
|
|
|
- {
|
|
|
- if (ParentNavs.Contains(ParentNav) && ParentNav != subNav)
|
|
|
- {
|
|
|
- op = false;
|
|
|
- }
|
|
|
- }
|
|
|
- if (op)
|
|
|
- {
|
|
|
- if (sub.IsOk == 1)
|
|
|
- {
|
|
|
- selfTrade -= sub.ThisMonth;
|
|
|
- totalTrade -= sub.ThisMonth;
|
|
|
- }
|
|
|
- }
|
|
|
- ParentNavs.Add(ParentNav);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (lastTrade * 2 < 2000000 || selfTrade == 0 || totalTrade < 2000000)
|
|
|
- {
|
|
|
- totalTrade = 2000000;
|
|
|
- }
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>" + myuser.MakerCode + "</td>";
|
|
|
- html += "<td>" + myuser.RealName + "</td>";
|
|
|
- html += "<td>" + selfTrade + "</td>";
|
|
|
- html += "<td>" + lastTrade + "</td>";
|
|
|
- html += "<td>" + totalTrade + "</td>";
|
|
|
- if (selfTrade >= totalTrade)
|
|
|
- {
|
|
|
- html += "<td>满足条件</td>";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- html += "<td>未满足条件</td>";
|
|
|
- }
|
|
|
- html += "</tr>";
|
|
|
- }
|
|
|
- html += "</table>";
|
|
|
- maindb.Dispose();
|
|
|
- ViewBag.html = html;
|
|
|
- return View();
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 分仓数据
|
|
|
-
|
|
|
- public IActionResult StoreHouse()
|
|
|
- {
|
|
|
- string start = DateTime.Now.AddMonths(-1).ToString("yyyy-MM");
|
|
|
- string end = DateTime.Now.ToString("yyyy-MM");
|
|
|
- string minId = "0", maxId = "999999999";
|
|
|
- DataTable getIdDt = OtherMySqlConn.dtable("select min(Id),max(Id) from StoreStockChange where CreateDate>='" + start + "-01 00:00:00' and CreateDate<'" + end + "-01 00:00:00'");
|
|
|
- if(getIdDt.Rows.Count > 0)
|
|
|
- {
|
|
|
- minId = getIdDt.Rows[0][0].ToString();
|
|
|
- maxId = getIdDt.Rows[0][1].ToString();
|
|
|
- }
|
|
|
- DataTable dt = OtherMySqlConn.dtable("select * from (select s.StoreName,s.StoreNo,u.RealName,u.Mobile,s.ManageMobile,s.Address,k.Name,s.LaveNum,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + start + "-01 00:00:00' and CreateDate<'" + end + "-01 00:00:00' and StoreId=s.Id and TransType=1) as c1,(select count(Id) from StoreStockChange where Id>=" + minId + " and Id<=" + maxId + " and CreateDate>='" + start + "-01 00:00:00' and CreateDate<'" + end + "-01 00:00:00' and StoreId=s.Id and TransType in (10,11,2)) as c2,(select count(Id) from PosMachinesTwo where StoreId=s.Id and ActivationTime>='" + start + "-01 00:00:00' and ActivationTime<'" + end + "-01 00:00:00') as c3 from StoreHouse s left join Users u on s.BrandId>0 and s.UserId=u.Id left join KqProducts k on s.BrandId=k.Id) tb where c1>0 or c2>0 or c3>0");
|
|
|
- string html = "<table>";
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>仓库名称</td>";
|
|
|
- html += "<td>仓库编号</td>";
|
|
|
- html += "<td>仓库归属人名称</td>";
|
|
|
- html += "<td>仓库归属人手机号</td>";
|
|
|
- html += "<td>管理员手机号</td>";
|
|
|
- html += "<td>地址</td>";
|
|
|
- html += "<td>品牌</td>";
|
|
|
- html += "<td>当前库存</td>";
|
|
|
- html += "<td>出库量</td>";
|
|
|
- html += "<td>出货量</td>";
|
|
|
- html += "<td>激活量</td>";
|
|
|
- html += "</tr>";
|
|
|
- foreach(DataRow dr in dt.Rows)
|
|
|
- {
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>" + dr["StoreName"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["StoreNo"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["RealName"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["Mobile"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["ManageMobile"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["Address"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["Name"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["LaveNum"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["c1"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["c2"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["c3"].ToString() + "</td>";
|
|
|
- html += "</tr>";
|
|
|
- }
|
|
|
- html += "</table>";
|
|
|
- ViewBag.html = html;
|
|
|
-
|
|
|
- return View();
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 开机排行
|
|
|
-
|
|
|
- public IActionResult OpenMachine()
|
|
|
- {
|
|
|
- string start = DateTime.Now.AddMonths(-1).ToString("yyyy-MM");
|
|
|
- string end = DateTime.Now.ToString("yyyy-MM");
|
|
|
- DataTable dt = OtherMySqlConn.dtable("select u.MakerCode,u.RealName,u.Mobile,coun from (select BuyUserId,count(Id) as coun from PosMachinesTwo where ActivationState=1 and ActivationTime>='" + start + "-01 00:00:00' and ActivationTime<'" + end + "-01 00:00:00' group by BuyUserId) tb left join Users u on tb.BuyUserId=u.Id order by coun desc limit 200");
|
|
|
- string html = "<table>";
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>创客编号</td>";
|
|
|
- html += "<td>创客姓名</td>";
|
|
|
- html += "<td>创客手机号</td>";
|
|
|
- html += "<td>激活数</td>";
|
|
|
- html += "</tr>";
|
|
|
- foreach(DataRow dr in dt.Rows)
|
|
|
- {
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>" + dr["MakerCode"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["RealName"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["Mobile"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["coun"].ToString() + "</td>";
|
|
|
- html += "</tr>";
|
|
|
- }
|
|
|
- html += "</table>";
|
|
|
- ViewBag.html = html;
|
|
|
-
|
|
|
- return View();
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 有效拉新排行
|
|
|
-
|
|
|
- public IActionResult PullNew()
|
|
|
- {
|
|
|
- string start = DateTime.Now.AddMonths(-1).ToString("yyyy-MM");
|
|
|
- string end = DateTime.Now.ToString("yyyy-MM");
|
|
|
- DataTable dt = OtherMySqlConn.dtable("select u.MakerCode,u.RealName,u.Mobile,coun from (select ParentUserId,count(Id) as coun from Users where Id in (select BuyUserId from PosMachinesTwo where ActivationState=1 and ActivationTime>='" + start + "-01 00:00:00' and ActivationTime<'" + end + "-01 00:00:00') GROUP BY ParentUserId) tb left join Users u on tb.ParentUserId=u.Id order by coun desc limit 200");
|
|
|
- string html = "<table>";
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>创客编号</td>";
|
|
|
- html += "<td>创客姓名</td>";
|
|
|
- html += "<td>创客手机号</td>";
|
|
|
- html += "<td>拉新数</td>";
|
|
|
- html += "</tr>";
|
|
|
- foreach(DataRow dr in dt.Rows)
|
|
|
- {
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>" + dr["MakerCode"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["RealName"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["Mobile"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["coun"].ToString() + "</td>";
|
|
|
- html += "</tr>";
|
|
|
- }
|
|
|
- html += "</table>";
|
|
|
- ViewBag.html = html;
|
|
|
-
|
|
|
- return View();
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 交易额
|
|
|
-
|
|
|
- public IActionResult Trade(string min, string max)
|
|
|
- {
|
|
|
- string month = DateTime.Now.AddMonths(-1).ToString("yyyyMM");
|
|
|
- string minId = "0";
|
|
|
- DataTable getIdDt = OtherMySqlConn.dtable("select min(Id) from TradeDaySummary where TradeMonth='" + month + "'");
|
|
|
- if(getIdDt.Rows.Count > 0)
|
|
|
- {
|
|
|
- minId = getIdDt.Rows[0][0].ToString();
|
|
|
- }
|
|
|
- DataTable dt = OtherMySqlConn.dtable("select u.MakerCode,u.RealName,u.Mobile,Amt from (select UserId,sum(HelpNonDirectTradeAmt+NotHelpNonDirectTradeAmt+ProfitNonDirectTradeAmt) as Amt from TradeDaySummary where Id>=" + minId + " and TradeMonth='" + month + "' group by UserId HAVING Amt>=" + min + " and Amt<" + max + ") tb left join Users u on tb.UserId=u.Id order by Amt desc");
|
|
|
- string html = "<table>";
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>创客编号</td>";
|
|
|
- html += "<td>创客姓名</td>";
|
|
|
- html += "<td>创客手机号</td>";
|
|
|
- html += "<td>交易额</td>";
|
|
|
- html += "</tr>";
|
|
|
- foreach(DataRow dr in dt.Rows)
|
|
|
- {
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>" + dr["MakerCode"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["RealName"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["Mobile"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["Amt"].ToString() + "</td>";
|
|
|
- html += "</tr>";
|
|
|
- }
|
|
|
- html += "</table>";
|
|
|
- ViewBag.html = html;
|
|
|
-
|
|
|
- return View();
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region 助利宝分润
|
|
|
-
|
|
|
- public IActionResult HelpProfit()
|
|
|
- {
|
|
|
- DataTable dt = OtherMySqlConn.dtable("select u.MakerCode,u.RealName,RewardDesc,CreditTradeAmt,CreditRewardAmount from (select UserId,RewardDesc,sum(CreditTradeAmt) CreditTradeAmt,sum(CreditRewardAmount) CreditRewardAmount from HelpProfitReward where TradeMonth=''" + DateTime.Now.AddMonths(-1).ToString("yyyyMM") + "'' group by UserId,RewardDesc) tb left join Users u on tb.UserId=u.Id");
|
|
|
- string html = "<table>";
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>创客编号</td>";
|
|
|
- html += "<td>创客姓名</td>";
|
|
|
- html += "<td>类别</td>";
|
|
|
- html += "<td>助利宝交易额</td>";
|
|
|
- html += "<td>分润</td>";
|
|
|
- html += "</tr>";
|
|
|
- foreach(DataRow dr in dt.Rows)
|
|
|
- {
|
|
|
- html += "<tr>";
|
|
|
- html += "<td>" + dr["MakerCode"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["RealName"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["RewardDesc"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["CreditTradeAmt"].ToString() + "</td>";
|
|
|
- html += "<td>" + dr["CreditRewardAmount"].ToString() + "</td>";
|
|
|
- html += "</tr>";
|
|
|
- }
|
|
|
- html += "</table>";
|
|
|
- ViewBag.html = html;
|
|
|
-
|
|
|
- return View();
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
}
|
|
|
}
|