DuGuYang 3 lat temu
rodzic
commit
225e3f5f2e

+ 9 - 99
Areas/Admin/Controllers/MainServer/UsersController.cs

@@ -1521,7 +1521,7 @@ namespace MySystem.Areas.Admin.Controllers
                 start = datelist[0].Replace("-", "");
                 end = datelist[1].Replace("-", "");
                 con += " and TradeDate>='" + start + "' and TradeDate<='" + end + "'";
-                cons += " and DATE_FORMAT(BindingTime,'%Y%m%d') >=" + start + " and DATE_FORMAT(BindingTime,'%Y%m%d') <=" + end;
+                cons += " and SeoKeyword >=" + start + " and SeoKeyword <=" + end;
 
             }
             //时间为空
@@ -1530,7 +1530,7 @@ namespace MySystem.Areas.Admin.Controllers
                 start = DateTime.Now.ToString("yyyyMM") + "01";
                 end = DateTime.Now.AddMonths(1).ToString("yyyyMM") + "01";
                 con += " and TradeDate>='" + start + "' and TradeDate<'" + end + "'";
-                cons += " and DATE_FORMAT(BindingTime,'%Y%m%d') >=" + start + " and DATE_FORMAT(BindingTime,'%Y%m%d') <" + end;
+                cons += " and SeoKeyword >=" + start + " and SeoKeyword <" + end;
             }
             if (!string.IsNullOrEmpty(BrandSelect.ToString()) && BrandId > 0)
             {
@@ -1621,7 +1621,7 @@ namespace MySystem.Areas.Admin.Controllers
                 JCountwd = Convert.ToInt32(function.CheckInt(dt.Rows[0][10].ToString()));
                 YAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][11].ToString()));
             }
-            //统计激活绑定数(个人、团队)
+            //统计激活数(个人、团队)
             dt = OtherMySqlConn.dtable("SELECT SUM(if(SeoTitle='self',ActiveBuddyMerStatus,0)),SUM(if(SeoTitle='team',ActiveBuddyMerStatus,0)) FROM UserTradeMonthSummary WHERE UserId= " + ParentId + "" + cons);
             if (dt.Rows.Count > 0)
             {
@@ -1690,14 +1690,12 @@ namespace MySystem.Areas.Admin.Controllers
 
             string condition = " and Status>-1";
             string cons = " and Status>=-1";
-            string con = " and Status>=-1";
 
             //产品类型
             if (!string.IsNullOrEmpty(BrandId.ToString()) && BrandId > 0)
             {
                 condition += " and BrandId =" + BrandId;
                 cons += " and BrandId =" + BrandId;
-                con += " and BrandId =" + BrandId;
             }
             //创客Id
             if (!string.IsNullOrEmpty(UserId.ToString()))
@@ -1708,15 +1706,14 @@ namespace MySystem.Areas.Admin.Controllers
             if (!string.IsNullOrEmpty(sTradeDate) && !string.IsNullOrEmpty(eTradeDate))
             {
                 condition += " and TradeDate >=" + Convert.ToInt32(sTradeDate) + " and TradeDate <=" + Convert.ToInt32(eTradeDate);
-                cons += " and DATE_FORMAT(BindingTime,'%Y%m%d') >=" + Convert.ToInt32(sTradeDate) + " and DATE_FORMAT(BindingTime,'%Y%m%d') <=" + Convert.ToInt32(eTradeDate);
-                con += " and TradeDate >=" + Convert.ToInt32(sTradeDate) + " and TradeDate <=" + Convert.ToInt32(eTradeDate);
+                cons += " and SeoKeyword >=" + Convert.ToInt32(sTradeDate) + " and SeoKeyword <=" + Convert.ToInt32(eTradeDate);
             }
             //结束时间
             else
             {
-                condition += " and TradeDate <=" + Convert.ToInt32(eTradeDate);
-                cons += " and DATE_FORMAT(BindingTime,'%Y%m%d') <=" + Convert.ToInt32(eTradeDate);
-                con += " and TradeDate <=" + Convert.ToInt32(eTradeDate);
+                var start = DateTime.Now.ToString("yyyyMM") + "01";
+                condition += " and TradeDate >=" + Convert.ToInt32(start) + " and TradeDate <=" + Convert.ToInt32(eTradeDate);
+                cons += " and SeoKeyword >=" + Convert.ToInt32(start) + " and SeoKeyword <=" + Convert.ToInt32(eTradeDate);
             }
 
             //扶持期
@@ -1759,95 +1756,8 @@ namespace MySystem.Areas.Admin.Controllers
                 JCountwd = Convert.ToInt32(function.CheckInt(dt.Rows[0][10].ToString()));
                 YAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][11].ToString()));
             }
-            // DataTable dt = OtherMySqlConn.dtable("select Sum(HelpNonDirectTradeAmt + HelpNonDirectDebitTradeAmt) from TradeDaySummary where SeoTitle='team'" + condition);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     TotalAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
-            // }
-            // dt = OtherMySqlConn.dtable("select Sum(HelpNonDirectTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     DAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
-            // }
-            // dt = OtherMySqlConn.dtable("select Sum(HelpNonDirectDebitTradeAmt),Sum(HelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     JAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString())) - Convert.ToDecimal(function.CheckNum(dt.Rows[0][1].ToString()));
-            // }
-            // dt = OtherMySqlConn.dtable("select Sum(HelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     JfAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
-            // }
-            // dt = OtherMySqlConn.dtable("select Sum(HelpDirectDebitCapNum) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     JCountfc = Convert.ToInt32(function.CheckInt(dt.Rows[0][0].ToString()));
-            // }
-            // dt = OtherMySqlConn.dtable("select Sum(HelpNonDirectTradeAmt) from TradeDaySummary where QueryCount=1 and SeoTitle='team'" + condition);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     YAmtfc = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
-            // }
-
-            // dt = OtherMySqlConn.dtable("select Sum(NotHelpNonDirectTradeAmt + NotHelpNonDirectDebitTradeAmt) from TradeDaySummary where SeoTitle='team'" + condition);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     TotalAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
-            // }
-            // dt = OtherMySqlConn.dtable("select Sum(NotHelpNonDirectTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     DAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
-            // }
-            // dt = OtherMySqlConn.dtable("select Sum(NotHelpNonDirectDebitTradeAmt),Sum(NotHelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     JAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString())) - Convert.ToDecimal(function.CheckNum(dt.Rows[0][1].ToString()));
-            // }
-            // dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectDebitCapTradeAmt) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     JfAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
-            // }
-            // dt = OtherMySqlConn.dtable("select Sum(NotHelpDirectDebitCapNum) from TradeDaySummary where QueryCount=0 and SeoTitle='team'" + condition);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     JCountwd = Convert.ToInt32(function.CheckInt(dt.Rows[0][0].ToString()));
-            // }
-            // dt = OtherMySqlConn.dtable("select Sum(NotHelpNonDirectTradeAmt) from TradeDaySummary where QueryCount=1 and SeoTitle='team'" + condition);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     YAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
-            // }
-            // dt = OtherMySqlConn.dtable("SELECT SUM(ActiveBuddyMerStatus) sum FROM UserTradeMonthSummary WHERE SeoTitle='team' AND UserId= '" + UserId + "'" + cons);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     BCount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
-            // }
-            dt = OtherMySqlConn.dtable("SELECT SUM(ActiveBuddyMerStatus) sum FROM UserTradeMonthSummary WHERE SeoTitle='team' AND UserId= '" + UserId + "'" + con);
-            if (dt.Rows.Count > 0)
-            {
-                ACount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
-            }
-            //TODO: 统计激活绑定数(个人)
-            // dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE BindingState=1 AND BuyUserId= '" + UserId + "'" + cons);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     PBCount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
-            // }
-            dt = OtherMySqlConn.dtable("SELECT SUM(ActiveBuddyMerStatus) sum FROM UserTradeMonthSummary WHERE SeoTitle='self' AND UserId= '" + UserId + "'" + con);
-            if (dt.Rows.Count > 0)
-            {
-                PACount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
-            }
-            //TODO: 统计激活绑定数(团队)
-            // dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE BindingState=1 AND BuyUserId IN (SELECT Id FROM Users WHERE ParentNav LIKE '%," + UserId + ",%' OR Id=" + UserId + ")" + cons);
-            // if (dt.Rows.Count > 0)
-            // {
-            //     TBCount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
-            // }
-            dt = OtherMySqlConn.dtable("SELECT SUM(ActiveBuddyMerStatus) sum FROM UserTradeMonthSummary WHERE SeoTitle='team' AND UserId= '" + UserId + "'" + con);
+            //统计激活数(个人、团队)
+            dt = OtherMySqlConn.dtable("SELECT SUM(if(SeoTitle='team',ActiveBuddyMerStatus,0)) FROM UserTradeMonthSummary WHERE UserId= " + UserId + "" + cons);
             if (dt.Rows.Count > 0)
             {
                 TACount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));