DuGuYang 3 лет назад
Родитель
Сommit
d7398c212b

+ 77 - 27
Areas/Admin/Controllers/MainServer/UserAccountRecordController.cs

@@ -57,15 +57,15 @@ namespace MySystem.Areas.Admin.Controllers
         /// 创客账户变动记录列表
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(UserAccountRecord data, string MakerCode, string RealName, int TopUserId, string CreateDateData, int UserId = 0, int page = 1, int limit = 30)
+        public JsonResult IndexData(UserAccountRecord data, int ChangeType, int ProductType, string TransRecordNo, string MakerCode, string RealName, int TopUserId, string CreateDateData, int UserId = 0, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("ChangeType", "1"); //交易类型
-            Fields.Add("ProductType", "1"); //产品类型
-            Fields.Add("TransRecordNo", "3"); //交易流水编号
+            // Fields.Add("ChangeType", "1"); //交易类型
+            // Fields.Add("ProductType", "1"); //产品类型
+            // Fields.Add("TransRecordNo", "3"); //交易流水编号
 
-            string condition = condition = " and Status>-1";
+            string condition = " and Status>-1";
             //创客编号
             if (!string.IsNullOrEmpty(MakerCode))
             {
@@ -125,19 +125,34 @@ namespace MySystem.Areas.Admin.Controllers
                 {
                     condition += " and Id =0";
                 }
-                
+
             }
-            if (data.ChangeType > 0)
+            if (ChangeType > 0)
             {
-                condition += " and ChangeType=" + data.ChangeType;
+                if (ChangeType == 1)
+                {
+                    condition += " and (ChangeType=" + ChangeType + " or (ChangeType in(112,1) and ProductType=101))";
+                }
+                else if (ChangeType == 30)
+                {
+                    condition += " and ChangeType=31 and Remark='开机抢红包活动'";
+                }
+                else if (ChangeType == 31)
+                {
+                    condition += " and (ChangeType=" + ChangeType + " and (Remark!='开机抢红包活动' or Remark IS NULL))";
+                }
+                else
+                {
+                    condition += " and ChangeType=" + ChangeType;
+                }
             }
-            if (data.ProductType > 0)
+            if (ProductType > 0)
             {
-                condition += " and ProductType=" + data.ProductType;
+                condition += " and ProductType=" + ProductType;
             }
-            if (!string.IsNullOrEmpty(data.TransRecordNo))
+            if (!string.IsNullOrEmpty(TransRecordNo))
             {
-                condition += " and TransRecordNo='" + data.TransRecordNo + "'";
+                condition += " and TransRecordNo='" + TransRecordNo + "'";
             }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("UserAccountRecord", Fields, "Id desc", "0", page, limit, condition);
@@ -155,10 +170,10 @@ namespace MySystem.Areas.Admin.Controllers
                     dic["TopMakerCode"] = tuser.MakerCode;
                     dic["TopRealName"] = tuser.RealName;
                 }
-                int ProductType = int.Parse(dic["ProductType"].ToString());
-                dic["ProductTypeName"] = RelationClass.GetKqProductBrandInfo(ProductType);
-                int ChangeType = int.Parse(dic["ChangeType"].ToString());
-                dic["ChangeTypeName"] = RelationClassForConst.GetChangeTypeInfo(ChangeType);
+                int ProductTypes = int.Parse(dic["ProductType"].ToString());
+                dic["ProductTypeName"] = RelationClass.GetKqProductBrandInfo(ProductTypes);
+                int ChangeTypes = int.Parse(dic["ChangeType"].ToString());
+                dic["ChangeTypeName"] = RelationClassForConst.GetChangeTypeInfo(ChangeTypes);
 
                 //获得盟主5元奖励的机具Sn
                 int SnId = int.Parse(dic["QueryCount"].ToString());
@@ -167,8 +182,8 @@ namespace MySystem.Areas.Admin.Controllers
             }
             Dictionary<string, object> other = new Dictionary<string, object>();
 
-            string ChangeTypeAmount0 = "0.00", ChangeTypeAmount1 = "0.00", ChangeTypeAmount2 = "0.00", ChangeTypeAmount3 = "0.00", ChangeTypeAmount4 = "0.00", ChangeTypeAmount5 = "0.00", ChangeTypeAmount6 = "0.00", ChangeTypeAmount61 = "0.00", ChangeTypeAmount62 = "0.00", ChangeTypeAmount63 = "0.00", ChangeTypeAmount64 = "0.00", ChangeTypeAmount50 = "0.00", ChangeTypeAmount111 = "0.00", ChangeTypeAmount112 = "0.00", ChangeTypeAmount60 = "0.00", ChangeTypeAmount31 = "0.00",  ChangeTypeAmount31s = "0.00", ChangeTypeAmount124 = "0.00", ChangeTypeAmount125 = "0.00";
-            DataTable dt = OtherMySqlConn.dtable("select sum(if(ChangeType=0, ChangeAmount, 0)),sum(if(ChangeType=1, ChangeAmount, 0)) + sum(if(ChangeType=112 and ProductType=101, ChangeAmount, 0)),sum(if(ChangeType=2, ChangeAmount, 0)),sum(if(ChangeType=6, ChangeAmount, 0)),sum(if(ChangeType=61, ChangeAmount, 0)),sum(if(ChangeType=62, ChangeAmount, 0)),sum(if(ChangeType=63, ChangeAmount, 0)),sum(if(ChangeType=64, ChangeAmount, 0)),sum(if(ChangeType=50, ChangeAmount, 0)),sum(if(ChangeType=111, ChangeAmount, 0)),sum(if(ChangeType=112, ChangeAmount, 0)),sum(if(ChangeType=60, ChangeAmount, 0)),sum(if(ChangeType=31 and Remark='开机抢红包活动', ChangeAmount, 0)),sum(if(ChangeType=3, ChangeAmount, 0)),sum(if(ChangeType=4, ChangeAmount, 0)),sum(if(ChangeType=5, ChangeAmount, 0)),sum(if(ChangeType=124, ChangeAmount, 0)),sum(if(ChangeType=125, ChangeAmount, 0)),sum(if(ChangeType=31 and (Remark!='开机抢红包活动' or Remark IS NULL), ChangeAmount, 0)) from UserAccountRecord where 1=1" + condition);
+            string ChangeTypeAmount0 = "0.00", ChangeTypeAmount1 = "0.00", ChangeTypeAmount2 = "0.00", ChangeTypeAmount3 = "0.00", ChangeTypeAmount4 = "0.00", ChangeTypeAmount5 = "0.00", ChangeTypeAmount6 = "0.00", ChangeTypeAmount61 = "0.00", ChangeTypeAmount62 = "0.00", ChangeTypeAmount63 = "0.00", ChangeTypeAmount64 = "0.00", ChangeTypeAmount50 = "0.00", ChangeTypeAmount111 = "0.00", ChangeTypeAmount112 = "0.00", ChangeTypeAmount60 = "0.00", ChangeTypeAmount31 = "0.00", ChangeTypeAmount31s = "0.00", ChangeTypeAmount124 = "0.00", ChangeTypeAmount125 = "0.00";
+            DataTable dt = OtherMySqlConn.dtable("select sum(if(ChangeType=0, ChangeAmount, 0)),sum(if(ChangeType=1, ChangeAmount, 0)) + sum(if(ChangeType in(112,1) and ProductType=101, ChangeAmount, 0)),sum(if(ChangeType=2, ChangeAmount, 0)),sum(if(ChangeType=6, ChangeAmount, 0)),sum(if(ChangeType=61, ChangeAmount, 0)),sum(if(ChangeType=62, ChangeAmount, 0)),sum(if(ChangeType=63, ChangeAmount, 0)),sum(if(ChangeType=64, ChangeAmount, 0)),sum(if(ChangeType=50, ChangeAmount, 0)),sum(if(ChangeType=111, ChangeAmount, 0)),sum(if(ChangeType=112, ChangeAmount, 0)),sum(if(ChangeType=60, ChangeAmount, 0)),sum(if(ChangeType=31 and Remark='开机抢红包活动', ChangeAmount, 0)),sum(if(ChangeType=3, ChangeAmount, 0)),sum(if(ChangeType=4, ChangeAmount, 0)),sum(if(ChangeType=5, ChangeAmount, 0)),sum(if(ChangeType=124, ChangeAmount, 0)),sum(if(ChangeType=125, ChangeAmount, 0)),sum(if(ChangeType=31 and (Remark!='开机抢红包活动' or Remark IS NULL), ChangeAmount, 0)) from UserAccountRecord where 1=1" + condition);
             if (dt.Rows.Count > 0)
             {
                 ChangeTypeAmount0 = dt.Rows[0][0].ToString();
@@ -207,7 +222,7 @@ namespace MySystem.Areas.Admin.Controllers
             other.Add("ChangeTypeAmount112", ChangeTypeAmount112); //推荐奖励
             other.Add("ChangeTypeAmount60", ChangeTypeAmount60); //流量卡分佣
             other.Add("ChangeTypeAmount31", ChangeTypeAmount31); //红包奖励
-            other.Add("ChangeTypeAmount31s", ChangeTypeAmount31s); //红包奖励
+            other.Add("ChangeTypeAmount31s", ChangeTypeAmount31s); //活动奖励
             other.Add("ChangeTypeAmount124", ChangeTypeAmount124); //机具过期
             other.Add("ChangeTypeAmount125", ChangeTypeAmount125); //软件服务费
             obj.Add("other", other);
@@ -414,12 +429,12 @@ namespace MySystem.Areas.Admin.Controllers
         /// 导出Excel
         /// </summary>
         /// <returns></returns>
-        public JsonResult ExportExcel(UserAccountRecord data, string MakerCode, string RealName, string CreateDateData, int TopUserId, int UserId)
+        public JsonResult ExportExcel(UserAccountRecord data, int ChangeType, int ProductType, string TransRecordNo, string MakerCode, string RealName, string CreateDateData, int TopUserId, int UserId)
         {
             Dictionary<string, string> Fields = new Dictionary<string, string>();
-            Fields.Add("ChangeType", "1"); //交易类型
-            Fields.Add("ProductType", "1"); //产品类型
-            Fields.Add("TransRecordNo", "3"); //交易流水编号
+            // Fields.Add("ChangeType", "1"); //交易类型
+            // Fields.Add("ProductType", "1"); //产品类型
+            // Fields.Add("TransRecordNo", "3"); //交易流水编号
 
             string condition = " and Status>-1";
             //创客编号
@@ -441,6 +456,33 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and UserId=" + UserId;
             }
+            if (ChangeType > 0)
+            {
+                if (ChangeType == 1)
+                {
+                    condition += " and (ChangeType=" + ChangeType + " or (ChangeType in(112,1) and ProductType=101))";
+                }
+                else if (ChangeType == 30)
+                {
+                    condition += " and ChangeType=31 and Remark='开机抢红包活动'";
+                }
+                else if (ChangeType == 31)
+                {
+                    condition += " and (ChangeType=" + ChangeType + " and (Remark!='开机抢红包活动' or Remark IS NULL))";
+                }
+                else
+                {
+                    condition += " and ChangeType=" + ChangeType;
+                }
+            }
+            if (ProductType > 0)
+            {
+                condition += " and ProductType=" + ProductType;
+            }
+            if (!string.IsNullOrEmpty(TransRecordNo))
+            {
+                condition += " and TransRecordNo='" + TransRecordNo + "'";
+            }
             if (!string.IsNullOrEmpty(CreateDateData))
             {
                 string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
@@ -475,10 +517,18 @@ namespace MySystem.Areas.Admin.Controllers
                     dic["TopMakerCode"] = tuser.MakerCode;
                     dic["TopRealName"] = tuser.RealName;
                 }
-                int ProductType = int.Parse(dic["ProductType"].ToString());
-                dic["ProductTypeName"] = RelationClass.GetKqProductBrandInfo(ProductType);
-                int ChangeType = int.Parse(dic["ChangeType"].ToString());
-                dic["ChangeTypeName"] = RelationClassForConst.GetChangeTypeInfo(ChangeType);
+                int ProductTypes = int.Parse(dic["ProductType"].ToString());
+                dic["ProductTypeName"] = RelationClass.GetKqProductBrandInfo(ProductTypes);
+                int ChangeTypes = int.Parse(dic["ChangeType"].ToString());
+                string Remark = dic["Remark"].ToString();
+                if (ChangeTypes == 31 && (Remark == "开机抢红包活动" || string.IsNullOrEmpty(Remark)))
+                {
+                    dic["ChangeTypeName"] = "红包奖励";
+                }
+                else
+                {
+                    dic["ChangeTypeName"] = RelationClassForConst.GetChangeTypeInfo(ChangeTypes);
+                }
                 dic.Remove("UserId");
                 dic.Remove("ChangeType");
                 dic.Remove("ProductType");

+ 1 - 1
Areas/Admin/Views/MainServer/UserAccountRecord/Index.cshtml

@@ -105,7 +105,7 @@
                                 <option value="20">余额支付</option>
                                 <option value="21">余额退款</option>
                                 <option value="22">余额退款手续费</option>
-                                <option value="31">红包奖励</option>
+                                <option value="30">红包奖励</option>
                                 <option value="31">活动奖励</option>
                                 <option value="40">商户达标返</option>
                                 <option value="50">开机奖励</option>