Selaa lähdekoodia

运营中心额度变动记录调整

DuGuYang 2 vuotta sitten
vanhempi
commit
1fddbd0f08

+ 169 - 22
Areas/Admin/Controllers/OperateServer/AmountRecordOperateController.cs

@@ -29,13 +29,129 @@ namespace MySystem.Areas.Admin.Controllers
             OtherMySqlConn.connstr = ConfigurationManager.AppSettings["OpSqlConnStr"].ToString();
         }
 
-        #region 运营中心额度变动明细记录列表
+        // #region 运营中心额度变动明细记录列表
 
+        // /// <summary>
+        // /// 根据条件查询运营中心额度变动明细记录列表
+        // /// </summary>
+        // /// <returns></returns>
+        // public IActionResult Index(AmountRecord data, string right, int UserId = 0)
+        // {
+        //     ViewBag.RightInfo = RightInfo;
+        //     ViewBag.right = right;
+
+        //     return View();
+        // }
+
+        // #endregion
+
+        // #region 根据条件查询运营中心额度变动明细记录列表
+
+        // /// <summary>
+        // /// 运营中心额度变动明细记录列表
+        // /// </summary>
+        // /// <returns></returns>
+        // public JsonResult IndexData(AmountRecord data, string MakerCode, string OpCode, string CreateDateData, int page = 1, int limit = 30)
+        // {
+
+        //     Dictionary<string, string> Fields = new Dictionary<string, string>();
+
+        //     string condition = " and Status>-1";
+        //     //创客编号
+        //     if (!string.IsNullOrEmpty(MakerCode))
+        //     {
+        //         var user = db.Users.FirstOrDefault(m => m.MakerCode == MakerCode) ?? new Models.Users();
+        //         condition += " and UserId=" + user.Id;
+        //     }
+        //     //运营中心编号
+        //     if (!string.IsNullOrEmpty(OpCode))
+        //     {
+        //         condition += " and UserId in (select UserId from SysAdmin where OpCode='" + OpCode + "')";
+        //     }
+        //     if (!string.IsNullOrEmpty(CreateDateData))
+        //     {
+        //         string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
+        //         // string start = datelist[0];
+        //         // string end = datelist[1];
+        //         // condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
+        //         var start = Convert.ToDateTime(Convert.ToDateTime(datelist[0]).ToString("yyyy-MM-dd"));
+        //         var end = Convert.ToDateTime(Convert.ToDateTime(datelist[1]).ToString("yyyy-MM-dd") + " 23:59:59");
+        //         var check = opdb.AmountRecord.Any(m => m.CreateDate >= start);
+        //         var checks = opdb.AmountRecord.Any(m => m.CreateDate <= end);
+        //         if (check)
+        //         {
+        //             var sId = opdb.AmountRecord.Where(m => m.CreateDate >= start).Min(m => m.Id);
+        //             condition += "  and Id >=" + sId;
+        //         }
+        //         if (checks)
+        //         {
+        //             var eId = opdb.AmountRecord.Where(m => m.CreateDate <= end).Max(m => m.Id);
+        //             condition += " and Id <=" + eId;
+        //         }
+        //     }
+        //     else
+        //     {
+        //         var start = Convert.ToDateTime(DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01");
+        //         var check = opdb.AmountRecord.Any(m => m.CreateDate >= start);
+        //         if (check)
+        //         {
+        //             var minId = opdb.AmountRecord.Where(m => m.CreateDate >= start).Min(m => m.Id);
+        //             var Info = function.ReadInstance("/WritePage/AmountRecordOperate/AmountRecordOperate.txt");
+        //             if (string.IsNullOrEmpty(Info.ToString()))
+        //             {
+        //                 function.WritePage("/WritePage/AmountRecordOperate/", "AmountRecordOperate.txt", minId.ToString());
+        //                 condition += " and Id >=" + minId;
+        //             }
+        //             else if (minId != int.Parse(Info))
+        //             {
+        //                 function.WritePage("/WritePage/AmountRecordOperate/", "AmountRecordOperate.txt", minId.ToString());
+        //                 condition += " and Id >=" + minId;
+        //             }
+        //             else
+        //             {
+        //                 condition += " and Id >=" + Convert.ToInt32(Info);
+        //             }
+        //         }
+        //         else
+        //         {
+        //             condition += " and Id =0";
+        //         }
+        //     }
+
+        //     Dictionary<string, object> obj = new AdminContentByConn(_accessor.HttpContext, PublicFunction.OpTables, OpConn).IndexData("AmountRecord", Fields, "Id desc", "0", page, limit, condition);
+        //     List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
+        //     foreach (Dictionary<string, object> dic in diclist)
+        //     {
+        //         int UserId = int.Parse(dic["UserId"].ToString());
+        //         SysAdmin sysAdmin = opdb.SysAdmin.FirstOrDefault(m => m.UserId == UserId) ?? new SysAdmin();
+        //         dic["OpCode"] = sysAdmin.OpCode;
+        //         dic["MakerCode"] = sysAdmin.MakerCode;
+        //         dic["MakerName"] = sysAdmin.MakerName;
+        //         dic["SourceInfo"] = "";
+        //         if (int.Parse(dic["QueryCount"].ToString()) > 0)
+        //         {
+        //             var Id = int.Parse(dic["QueryCount"].ToString());
+        //             var orderInfo = db.Orders.FirstOrDefault(m => m.Id == Id) ?? new Models.Orders();
+        //             var userInfo = db.Users.FirstOrDefault(m => m.Id == orderInfo.UserId) ?? new Models.Users();
+        //             dic["SourceInfo"] = userInfo.MakerCode + "<br />" + userInfo.RealName;
+        //         }
+        //         int OperateType = int.Parse(dic["OperateType"].ToString());
+        //         dic["OperateTypeName"] = "";
+        //         if (OperateType == 1) dic["OperateTypeName"] = "收入";
+        //         if (OperateType == 2) dic["OperateTypeName"] = "支出";
+        //     }
+        //     return Json(obj);
+        // }
+
+        // #endregion
+
+
+        #region 运营中心额度变动明细记录列表v2
         /// <summary>
-        /// 根据条件查询运营中心额度变动明细记录列表
+        /// 根据条件查询运营中心额度变动明细记录列表v2
         /// </summary>
         /// <returns></returns>
-        public IActionResult Index(AmountRecord data, string right, int UserId = 0)
+        public IActionResult Index(AmountRecordNew data, string right, int UserId = 0)
         {
             ViewBag.RightInfo = RightInfo;
             ViewBag.right = right;
@@ -45,13 +161,12 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
-        #region 根据条件查询运营中心额度变动明细记录列表
-
+        #region 根据条件查询运营中心额度变动明细记录列表v2
         /// <summary>
-        /// 运营中心额度变动明细记录列表
+        /// 运营中心额度变动明细记录列表v2
         /// </summary>
         /// <returns></returns>
-        public JsonResult IndexData(AmountRecord data, string MakerCode, string OpCode, string CreateDateData, int page = 1, int limit = 30)
+        public JsonResult IndexData(AmountRecordNew data, string MakerCode, string OpCode, string CreateDateData, int page = 1, int limit = 30)
         {
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
@@ -76,35 +191,35 @@ namespace MySystem.Areas.Admin.Controllers
                 // condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
                 var start = Convert.ToDateTime(Convert.ToDateTime(datelist[0]).ToString("yyyy-MM-dd"));
                 var end = Convert.ToDateTime(Convert.ToDateTime(datelist[1]).ToString("yyyy-MM-dd") + " 23:59:59");
-                var check = opdb.AmountRecord.Any(m => m.CreateDate >= start);
-                var checks = opdb.AmountRecord.Any(m => m.CreateDate <= end);
+                var check = opdb.AmountRecordNew.Any(m => m.CreateDate >= start);
+                var checks = opdb.AmountRecordNew.Any(m => m.CreateDate <= end);
                 if (check)
                 {
-                    var sId = opdb.AmountRecord.Where(m => m.CreateDate >= start).Min(m => m.Id);
+                    var sId = opdb.AmountRecordNew.Where(m => m.CreateDate >= start).Min(m => m.Id);
                     condition += "  and Id >=" + sId;
                 }
                 if (checks)
                 {
-                    var eId = opdb.AmountRecord.Where(m => m.CreateDate <= end).Max(m => m.Id);
+                    var eId = opdb.AmountRecordNew.Where(m => m.CreateDate <= end).Max(m => m.Id);
                     condition += " and Id <=" + eId;
                 }
             }
             else
             {
                 var start = Convert.ToDateTime(DateTime.Now.AddMonths(-1).ToString("yyyy-MM") + "-01");
-                var check = opdb.AmountRecord.Any(m => m.CreateDate >= start);
+                var check = opdb.AmountRecordNew.Any(m => m.CreateDate >= start);
                 if (check)
                 {
-                    var minId = opdb.AmountRecord.Where(m => m.CreateDate >= start).Min(m => m.Id);
-                    var Info = function.ReadInstance("/WritePage/AmountRecordOperate/AmountRecordOperate.txt");
+                    var minId = opdb.AmountRecordNew.Where(m => m.CreateDate >= start).Min(m => m.Id);
+                    var Info = function.ReadInstance("/WritePage/AmountRecordOperateNew/AmountRecordOperateNew.txt");
                     if (string.IsNullOrEmpty(Info.ToString()))
                     {
-                        function.WritePage("/WritePage/AmountRecordOperate/", "AmountRecordOperate.txt", minId.ToString());
+                        function.WritePage("/WritePage/AmountRecordOperateNew/", "AmountRecordOperateNew.txt", minId.ToString());
                         condition += " and Id >=" + minId;
                     }
                     else if (minId != int.Parse(Info))
                     {
-                        function.WritePage("/WritePage/AmountRecordOperate/", "AmountRecordOperate.txt", minId.ToString());
+                        function.WritePage("/WritePage/AmountRecordOperateNew/", "AmountRecordOperateNew.txt", minId.ToString());
                         condition += " and Id >=" + minId;
                     }
                     else
@@ -118,7 +233,7 @@ namespace MySystem.Areas.Admin.Controllers
                 }
             }
 
-            Dictionary<string, object> obj = new AdminContentByConn(_accessor.HttpContext, PublicFunction.OpTables, OpConn).IndexData("AmountRecord", Fields, "Id desc", "0", page, limit, condition);
+            Dictionary<string, object> obj = new AdminContentByConn(_accessor.HttpContext, PublicFunction.OpTables, OpConn).IndexData("AmountRecordNew", Fields, "Id desc", "0", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
             foreach (Dictionary<string, object> dic in diclist)
             {
@@ -127,13 +242,45 @@ namespace MySystem.Areas.Admin.Controllers
                 dic["OpCode"] = sysAdmin.OpCode;
                 dic["MakerCode"] = sysAdmin.MakerCode;
                 dic["MakerName"] = sysAdmin.MakerName;
+                var DataType = int.Parse(dic["DataType"].ToString());//来源类型,区分表(1订单,2机具,3申请记录,4购买运营中心,5预扣款 6兑换大盟主)
+                var Id = int.Parse(dic["DataId"].ToString());//来源Id,表的主键Id
                 dic["SourceInfo"] = "";
-                if (int.Parse(dic["QueryCount"].ToString()) > 0)
+                if (DataType > 0 && Id > 0)
                 {
-                    var Id = int.Parse(dic["QueryCount"].ToString());
-                    var orderInfo = db.Orders.FirstOrDefault(m => m.Id == Id) ?? new Models.Orders();
-                    var userInfo = db.Users.FirstOrDefault(m => m.Id == orderInfo.UserId) ?? new Models.Users();
-                    dic["SourceInfo"] = userInfo.MakerCode + "<br />" + userInfo.RealName;
+                    var SourceUserId = 0;
+                    if (DataType == 1)
+                    {
+                        var orderInfo = db.Orders.FirstOrDefault(m => m.Id == Id) ?? new Models.Orders();
+                        SourceUserId = orderInfo.UserId;
+                    }
+                    if (DataType == 2)
+                    {
+                        var pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == Id) ?? new Models.PosMachinesTwo();
+                        SourceUserId = pos.BuyUserId;
+                    }
+                    if (DataType == 3)
+                    {
+                        var storeMachineApply = db.StoreMachineApply.FirstOrDefault(m => m.Id == Id) ?? new Models.StoreMachineApply();
+                        SourceUserId = storeMachineApply.UserId;
+                    }
+                    if (DataType == 4)
+                    {
+                        var sysAdminInfo = opdb.SysAdmin.FirstOrDefault(m => m.Id == Id) ?? new SysAdmin();
+                        SourceUserId = sysAdminInfo.UserId;
+                    }
+                    if (DataType == 5)
+                    {
+                        var toChargeBackRecord = db.ToChargeBackRecord.FirstOrDefault(m => m.Id == Id) ?? new Models.ToChargeBackRecord();
+                        SourceUserId = toChargeBackRecord.UserId;
+                    }
+                    if (DataType == 6)
+                    {
+                        var userExchangeLeaderRecord = db.UserExchangeLeaderRecord.FirstOrDefault(m => m.Id == Id) ?? new Models.UserExchangeLeaderRecord();
+                        SourceUserId = userExchangeLeaderRecord.UserId;
+                    }
+                    var userInfo = db.Users.FirstOrDefault(m => m.Id == SourceUserId) ?? new Models.Users();
+                    var SourceInfo = userInfo.MakerCode + "_" + userInfo.RealName;
+                    dic["SourceInfo"] = SourceInfo;
                 }
                 int OperateType = int.Parse(dic["OperateType"].ToString());
                 dic["OperateTypeName"] = "";

+ 7 - 1
OpModels/AmountRecordNew.cs

@@ -5,12 +5,18 @@ namespace MySystem.OpModels
 {
     public partial class AmountRecordNew
     {
-        public int Id { get; set; }
+         public int Id { get; set; }
         public int Sort { get; set; }
+        public int QueryCount { get; set; }
         public int Status { get; set; }
         public int Version { get; set; }
         public DateTime? CreateDate { get; set; }
         public DateTime? UpdateDate { get; set; }
+        public string CreateMan { get; set; }
+        public string UpdateMan { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
         public int ChangeTypeId { get; set; }
         public string Remark { get; set; }
         public int ShowType { get; set; }

+ 28 - 0
OpModels/WebCMSEntities.cs

@@ -442,6 +442,34 @@ namespace MySystem.OpModels
                     .HasColumnType("int(11)")
                     .HasComment("显示类型");
 
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.QueryCount)
+                    .HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UpdateMan)
+                    .HasColumnType("varchar(50)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
                 entity.Property(e => e.Sort)
                     .HasColumnType("int(11)")
                     .HasComment("排序序号");

+ 3 - 2
wwwroot/layuiadmin/modules_operate/AmountRecord_Admin.js

@@ -94,8 +94,9 @@ layui.config({
             , { field: 'OpCode', width: 150, title: '运营中心编号', sort: true }
             , { field: 'MakerCode', width: 105, title: '创客编号', sort: true }
             , { field: 'MakerName', width: 105, title: '创客姓名', sort: true }
-            , { field: 'SeoKeyword', width: 100, title: '备注', sort: true }
-            , { field: 'SeoDescription', width: 100, title: '描述', sort: true }
+            // , { field: 'SeoKeyword', width: 100, title: '备注', sort: true }
+            // , { field: 'SeoDescription', width: 100, title: '描述', sort: true }
+            , { field: 'Remark', width: 100, title: '描述', sort: true }
             , { field: 'UseAmount', width: 110, title: '交易金额', sort: true }
             , { field: 'BeforeAmount', width: 130, title: '交易前总金额', sort: true }
             , { field: 'AfterAmount', width: 130, title: '交易后总金额', sort: true }