소스 검색

增加sp数据推送功能

lcl 1 년 전
부모
커밋
0a8d88aa7d

+ 26 - 0
Areas/Admin/Controllers/SpServer/ActivateRecordController.cs

@@ -236,6 +236,32 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
+        #region 重推数据
+
+        /// <summary>
+        /// 重推数据
+        /// </summary>
+        /// <returns></returns>
+        public string Push(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "ActivateRecord", "push");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                ActivateRecord act = spdb.ActivateRecord.FirstOrDefault(m => m.Id == id);
+                if(act != null)
+                {
+                    act.Status = 1;
+                }
+            }
+            spdb.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
         #region 开启
 
         /// <summary>

+ 45 - 0
Areas/Admin/Controllers/SpServer/BindRecordController.cs

@@ -216,6 +216,51 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
+        #region 重推数据
+
+        /// <summary>
+        /// 重推数据
+        /// </summary>
+        /// <returns></returns>
+        public string Push(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "BindRecord", "push");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                BindRecord bind = spdb.BindRecord.FirstOrDefault(m => m.Id == id);
+                if(bind != null)
+                {
+                    bind.Status = 1;
+                    Merchants mer = spdb.Merchants.FirstOrDefault(m => m.SnNo == bind.MerSnNo);
+                    if(mer != null)
+                    {
+                        bind.Status = 1;
+                    }
+                    if(bind.ProductType == "12" || bind.ProductType == "30")
+                    {
+                        MerchantRecord merInfo = new MerchantRecord();
+                        if(bind.ProductType == "12") merInfo = spdb.MerchantRecord.FirstOrDefault(m => m.MerNo == bind.MerNo);
+                        if(bind.ProductType == "30") 
+                        {
+                            merInfo = spdb.MerchantRecord.FirstOrDefault(m => m.Field3 == bind.MerNo);
+                            if(merInfo == null) spdb.MerchantRecord.FirstOrDefault(m => m.MerNo == bind.MerNo);
+                        }
+                        if(merInfo != null)
+                        {
+                            merInfo.Status = 1;
+                        }
+                    }
+                }
+            }
+            spdb.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
         #region 开启
 
         /// <summary>

+ 26 - 0
Areas/Admin/Controllers/SpServer/SpTradeRecordController.cs

@@ -236,6 +236,32 @@ namespace MySystem.Areas.Admin.Controllers
 
         #endregion
 
+        #region 重推数据
+
+        /// <summary>
+        /// 重推数据
+        /// </summary>
+        /// <returns></returns>
+        public string Push(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "TradeRecord", "push");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                TradeRecord trade = spdb.TradeRecord.FirstOrDefault(m => m.Id == id);
+                if(trade != null)
+                {
+                    trade.Status = 1;
+                }
+            }
+            spdb.SaveChanges();
+
+            return "success";
+        }
+
+        #endregion
+
         #region 开启
 
         /// <summary>

+ 1 - 1
Areas/Admin/Views/SpServer/ActivateRecord/Index.cshtml

@@ -171,7 +171,7 @@
                     }
                     @if (RightInfo.Contains("," + right + "_edit,"))
                     {
-
+                        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="push"><i class="layui-icon layui-icon-delete"></i>推送</a>
                     }
                 </script>
             </div>

+ 1 - 1
Areas/Admin/Views/SpServer/BindRecord/Index.cshtml

@@ -187,7 +187,7 @@
                     }
                     @if (RightInfo.Contains("," + right + "_edit,"))
                     {
-
+                        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="push"><i class="layui-icon layui-icon-delete"></i>推送</a>
                     }
                 </script>
             </div>

+ 1 - 1
Areas/Admin/Views/SpServer/SpTradeRecord/Index.cshtml

@@ -147,7 +147,7 @@
                     }
                     @if (RightInfo.Contains("," + right + "_edit,"))
                     {
-
+                        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="push"><i class="layui-icon layui-icon-delete"></i>推送</a>
                     }
                 </script>
             </div>

+ 17 - 0
wwwroot/layuiadmin/modules_sp/ActivateRecord_Admin.js

@@ -147,6 +147,23 @@ layui.config({
                     }
                 });
             });
+        } else if (obj.event === 'push') {
+            var index = layer.confirm('确定要推送吗?推送后不能撤回!', function (index) {
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/ActivateRecord/push?r=" + Math.random(1),
+                    data: "Id=" + data.Id,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(index);
+                        if (data == "success") {
+                            parent.layer.msg('推送成功');
+                        } else {
+                            parent.layer.msg(data);
+                        }
+                    }
+                });
+            });
         } else if (obj.event === 'edit') {
             var tr = $(obj.tr);
             var perContent = layer.open({

+ 17 - 0
wwwroot/layuiadmin/modules_sp/BindRecord_Admin.js

@@ -144,6 +144,23 @@ layui.config({
                     }
                 });
             });
+        } else if (obj.event === 'push') {
+            var index = layer.confirm('确定要推送吗?推送后不能撤回!', function (index) {
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/BindRecord/push?r=" + Math.random(1),
+                    data: "Id=" + data.Id,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(index);
+                        if (data == "success") {
+                            parent.layer.msg('推送成功');
+                        } else {
+                            parent.layer.msg(data);
+                        }
+                    }
+                });
+            });
         } else if (obj.event === 'edit') {
             var tr = $(obj.tr);
             var perContent = layer.open({

+ 17 - 0
wwwroot/layuiadmin/modules_sp/TradeRecord_Admin.js

@@ -148,6 +148,23 @@ layui.config({
                     }
                 });
             });
+        } else if (obj.event === 'push') {
+            var index = layer.confirm('确定要推送吗?推送后不能撤回!', function (index) {
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/SpTradeRecord/push?r=" + Math.random(1),
+                    data: "Id=" + data.Id,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(index);
+                        if (data == "success") {
+                            parent.layer.msg('推送成功');
+                        } else {
+                            parent.layer.msg(data);
+                        }
+                    }
+                });
+            });
         } else if (obj.event === 'edit') {
             var tr = $(obj.tr);
             var perContent = layer.open({