Bläddra i källkod

开机激活数
机具券和机具号修改盟主标记

DuGuYang 4 år sedan
förälder
incheckning
37aa879011

+ 48 - 12
Areas/Admin/Controllers/MainServer/SysToolsController.cs

@@ -1484,17 +1484,35 @@ namespace MySystem.Areas.Admin.Controllers
         }
 
         [HttpPost]
-        public string ChangeSignQuanDo(string CouponNos = "", int IsSend = 0)
+        public string ChangeSignQuanDo(string Coupons, string MakerCode)
         {
-            if (string.IsNullOrEmpty(CouponNos))
+            if (string.IsNullOrEmpty(Coupons))
             {
-                return "请输入券码";
+                return "请输入机具券码,多个券码用回车分隔";
             }
-
-            string[] CouponNoList = CouponNos.Split('\n');
-            for (int i = 0; i < CouponNoList.Length; i++)
+            if (string.IsNullOrEmpty(MakerCode))
             {
+                return "请输入创客编号";
             }
+            UserForMakerCode forMakerCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
+            if (forMakerCode == null)
+            {
+                return "创客不存在";
+            }
+            string[] SnList = Coupons.Split('\n');
+            foreach (var item in SnList)
+            {
+                var coupos = db.PosCoupons.FirstOrDefault(m => m.ExchangeCode == item && m.LeaderUserId == 0);
+                if (coupos == null)
+                {
+                    return "机具券不存在";
+                }
+                else
+                {
+                    coupos.LeaderUserId = forMakerCode.UserId;
+                }
+            }
+            db.SaveChanges();
             return "success";
         }
         #endregion
@@ -1511,17 +1529,35 @@ namespace MySystem.Areas.Admin.Controllers
         }
 
         [HttpPost]
-        public string ChangeSignSnDo(string SnNos = "", int IsSend = 0)
+        public string ChangeSignSnDo(string PosSn, string MakerCode)
         {
-            if (string.IsNullOrEmpty(SnNos))
+            if (string.IsNullOrEmpty(PosSn))
             {
-                return "请输入机具SN";
+                return "请输入机具SN,多个SN用回车分隔";
             }
-
-            string[] SnNoList = SnNos.Split('\n');
-            for (int i = 0; i < SnNoList.Length; i++)
+            if (string.IsNullOrEmpty(MakerCode))
             {
+                return "请输入创客编号";
+            }
+            UserForMakerCode forMakerCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode);
+            if (forMakerCode == null)
+            {
+                return "创客不存在";
             }
+            string[] SnList = PosSn.Split('\n');
+            foreach (var item in SnList)
+            {
+                var pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == item && m.LeaderUserId == 0);
+                if (pos == null)
+                {
+                    return "该机具不存在";
+                }
+                else
+                {
+                    pos.LeaderUserId = forMakerCode.UserId;
+                }
+            }
+            db.SaveChanges();
             return "success";
         }
         #endregion

+ 78 - 0
Areas/Admin/Controllers/MainServer/UsersController.cs

@@ -630,6 +630,53 @@ namespace MySystem.Areas.Admin.Controllers
         #endregion
 
 
+        #region 一键大盟主
+
+        /// <summary>
+        /// 一键大盟主
+        /// </summary>
+        /// <returns></returns>
+        public string SetBigLeader(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "Users", "SetBigLeader");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("LeaderLevel", 2);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("Users", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+        #region 一键小盟主
+
+        /// <summary>
+        /// 一键小盟主
+        /// </summary>
+        /// <returns></returns>
+        public string SetSmallLeader(string Id)
+        {
+            string[] idlist = Id.Split(new char[] { ',' });
+            AddSysLog(Id, "Users", "SetSmallLeader");
+            foreach (string subid in idlist)
+            {
+                int id = int.Parse(subid);
+                Dictionary<string, object> Fields = new Dictionary<string, object>();
+                Fields.Add("LeaderLevel", 1);
+                new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("Users", Fields, id);
+            }
+            db.SaveChanges();
+            return "success";
+        }
+
+        #endregion
+
+
         #region 风控
 
         public IActionResult Risk(string right, int Id = 0)
@@ -1390,6 +1437,7 @@ namespace MySystem.Areas.Admin.Controllers
 
             string condition = " and Status>-1";
             string con = " and Status>-1";
+            string cons = " and Status>=-1";
             string sort = "Id desc";
             //创客编号
             if (!string.IsNullOrEmpty(MakerCode))
@@ -1407,6 +1455,10 @@ namespace MySystem.Areas.Admin.Controllers
                 end = datelist[1].Replace("-", "");
                 con += " and TradeDate>='" + start + "' and TradeDate<='" + end + "'";
             }
+            if (!string.IsNullOrEmpty(BrandSelect.ToString()))
+            {
+                cons += " and BrandId='" + BrandId + "'";
+            }
 
             Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("Users", Fields, sort, "True", page, limit, condition);
             List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
@@ -1516,6 +1568,16 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 YAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
             }
+            dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE BindingState=1 AND ActivationState=0 AND UserId= '" + ParentId + "'" + cons);
+            if (dt.Rows.Count > 0)
+            {
+                BCount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE BindingState=1 AND ActivationState=1 AND UserId= '" + ParentId + "'" + cons);
+            if (dt.Rows.Count > 0)
+            {
+                ACount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
 
             other.Add("TotalAmtfc", TotalAmtfc);
             other.Add("DAmtfc", DAmtfc);
@@ -1542,6 +1604,7 @@ namespace MySystem.Areas.Admin.Controllers
         public Dictionary<string, object> GetMonthTradeForBrand(int UserId, string sTradeDate, string eTradeDate, int BrandId)
         {
             string condition = " and Status>-1";
+            string cons = " and Status>=-1";
 
             //产品类型
             if (!string.IsNullOrEmpty(BrandId.ToString()) && BrandId > 0)
@@ -1563,6 +1626,10 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 condition += " and TradeDate <=" + Convert.ToInt32(eTradeDate);
             }
+            if (!string.IsNullOrEmpty(BrandId.ToString()))
+            {
+                cons += " and BrandId='" + BrandId + "'";
+            }
 
             //扶持期
             decimal TotalAmtfc = 0;
@@ -1646,6 +1713,17 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 YAmtwd = Convert.ToDecimal(function.CheckNum(dt.Rows[0][0].ToString()));
             }
+            dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE BindingState=1 AND ActivationState=0 AND UserId= '" + UserId + "'" + cons);
+            if (dt.Rows.Count > 0)
+            {
+                BCount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+            dt = OtherMySqlConn.dtable("SELECT COUNT(0) count FROM PosMachinesTwo WHERE BindingState=1 AND ActivationState=1 AND UserId= '" + UserId + "'" + cons);
+            if (dt.Rows.Count > 0)
+            {
+                ACount = Convert.ToInt32(function.CheckNum(dt.Rows[0][0].ToString()));
+            }
+
 
             obj.Add("TotalAmtfc", TotalAmtfc);
             obj.Add("DAmtfc", DAmtfc);

+ 28 - 18
Areas/Admin/Views/MainServer/SysTools/ChangeSignQuan.cshtml

@@ -31,19 +31,26 @@
                         <div class="layui-tab-content mt20">
                             <div class="layui-tab-item layui-show">
                                 <div class="layui-form-item">
-                                    <label class="layui-form-label">机具券</label>
+                                    <label class="layui-form-label">机具券</label>
                                     <div class="layui-input-block">
-                                        <textarea class="layui-textarea" lay-verify="required|" name="OldSn" id="OldSn"
-                                            placeholder="请输入机具SN,多个SN用回车隔开"></textarea>
+                                        <textarea class="layui-textarea" lay-verify="required|" name="Coupons" id="Coupons"
+                                            placeholder="请输入机具券码,多个券码用回车隔开"></textarea>
                                     </div>
                                 </div>
                                 <div class="layui-form-item">
+                                    <label class="layui-form-label">创客编号</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="text" id="MakerCode" name="MakerCode"
+                                            maxlength="50" autocomplete="off" placeholder="请输入创客编号">
+                                    </div>
+                                </div>
+                                @* <div class="layui-form-item">
                                     <label class="layui-form-label">是否推送消息</label>
                                     <div class="layui-input-block">
-                                        <input type="checkbox" id="IsSend" name="IsSend" value="1" lay-skin="switch"
-                                            lay-filter="switchTest" title="开关">
+                                    <input type="checkbox" id="IsSend" name="IsSend" value="1" lay-skin="switch"
+                                    lay-filter="switchTest" title="开关">
                                     </div>
-                                </div>
+                                    </div> *@
                             </div>
 
                         </div>
@@ -68,19 +75,22 @@
                 shade: [0.5, '#000']
             });
             var userdata = $("#confirmFrm").serialize();
-            $.ajax({
-                type: "POST",
-                url: "/Admin/SysTools/ChangeQuanDo?r=" + Math.random(1),
-                data: userdata,
-                dataType: "text",
-                success: function (data) {
-                    layer.close(index); //关闭弹层
-                    if (data == "success") {
-                        layer.msg("修改成功");
-                    } else {
-                        layer.msg(data);
+            var indexs = layer.confirm('确定要修改吗?', function (index) {
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/SysTools/ChangeSignQuanDo?r=" + Math.random(1),
+                    data: userdata,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(index); //关闭弹层
+                        if (data == "success") {
+                            layer.msg("修改成功");
+                        } else {
+                            layer.msg(data);
+                            layer.close(indexs); //关闭弹层
+                        }
                     }
-                }
+                });
             });
         }
 

+ 11 - 4
Areas/Admin/Views/MainServer/SysTools/ChangeSignSn.cshtml

@@ -33,17 +33,24 @@
                                 <div class="layui-form-item">
                                     <label class="layui-form-label">机具SN</label>
                                     <div class="layui-input-block">
-                                        <textarea class="layui-textarea" lay-verify="required|" name="OldSn" id="OldSn"
+                                        <textarea class="layui-textarea" lay-verify="required|" name="PosSn" id="PosSn"
                                             placeholder="请输入机具SN,多个SN用回车隔开"></textarea>
                                     </div>
                                 </div>
                                 <div class="layui-form-item">
+                                    <label class="layui-form-label">创客编号</label>
+                                    <div class="layui-input-inline">
+                                        <input class="layui-input" type="text" id="MakerCode" name="MakerCode"
+                                            maxlength="50" autocomplete="off" placeholder="请输入创客编号">
+                                    </div>
+                                </div>
+                                @* <div class="layui-form-item">
                                     <label class="layui-form-label">是否推送消息</label>
                                     <div class="layui-input-block">
-                                        <input type="checkbox" id="IsSend" name="IsSend" value="1" lay-skin="switch"
-                                            lay-filter="switchTest" title="开关">
+                                    <input type="checkbox" id="IsSend" name="IsSend" value="1" lay-skin="switch"
+                                    lay-filter="switchTest" title="开关">
                                     </div>
-                                </div>
+                                    </div> *@
                             </div>
 
                         </div>

+ 12 - 0
Areas/Admin/Views/MainServer/Users/Index.cshtml

@@ -246,6 +246,18 @@
                         <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="LockEnterpriseMaker"><i class="layui-icon layui-icon-edit"></i>取消企业创客</a>
                         @("{{#} }}")
                     }
+                    @if (RightInfo.Contains("," + right + "_SetBigLeader,"))
+                    {
+                        @("{{#if (d.LeaderLevel == 0 || d.LeaderLevel == 1){ }}")
+                        <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="SetBigLeader"><i class="layui-icon layui-icon-edit"></i>一键大盟主</a>
+                        @("{{#} }}")
+                    }
+                    @if (RightInfo.Contains("," + right + "_SetSmallLeader,"))
+                    {
+                         @("{{#if (d.LeaderLevel == 0 || d.LeaderLevel == 2){ }}")
+                        <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="SetSmallLeader"><i class="layui-icon layui-icon-edit"></i>一键小盟主</a>
+                        @("{{#} }}")
+                    }
                     <a class="layui-btn layui-btn-warm layui-btn-xs" lay-event="detail"><i class="layui-icon layui-icon-read"></i>详情</a>
                     @if (RightInfo.Contains("," + right + "_Lock,"))
                     {

+ 2 - 2
wwwroot/layuiadmin/modules_main/UsersChildren_Admin.js

@@ -143,8 +143,8 @@ layui.config({
             $("#JCountwd").text(res.other.JCountwd);
             $("#YAmtwd").text(res.other.YAmtwd);
 
-            // $("#BCount").text(res.other.BCount);
-            // $("#ACount").text(res.other.ACount);
+            $("#BCount").text(res.other.BCount);
+            $("#ACount").text(res.other.ACount);
 
             $(".layui-none").text("无数据");
         }

+ 39 - 1
wwwroot/layuiadmin/modules_main/Users_Admin.js

@@ -114,7 +114,7 @@ layui.config({
             , { field: 'RiskFlagName', width: 200, title: '风控状态', sort: true }
             , { field: 'CreateDate', width: 200, title: '注册时间', sort: true }
 
-            , { title: '操作', width: 1600, align: 'left', toolbar: '#table-list-tools' }
+            , { title: '操作', width: 1800, align: 'left', toolbar: '#table-list-tools' }
         ]]
         , where: {
             SelfId: SelfId,
@@ -420,6 +420,44 @@ layui.config({
                     }
                 });
             });
+        } else if (obj.event === 'SetBigLeader') {
+            var index = layer.confirm('是否确定设置' + data.MakerCode + ',' + data.RealName + '的账户为大盟主?', function (index) {
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/Users/SetBigLeader?r=" + Math.random(1),
+                    data: "Id=" + data.Id,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(index); //关闭弹层
+                        if (data == "success") {
+                            layer.msg("设置成功", { time: 1500 }, function () {
+                                table.reload('LAY-list-manage'); //数据刷新
+                            });
+                        } else {
+                            parent.layer.msg(data);
+                        }
+                    }
+                });
+            });
+        } else if (obj.event === 'SetSmallLeader') {
+            var index = layer.confirm('是否确定设置' + data.MakerCode + ',' + data.RealName + '的账号为小盟主?', function (index) {
+                $.ajax({
+                    type: "POST",
+                    url: "/Admin/Users/SetSmallLeader?r=" + Math.random(1),
+                    data: "Id=" + data.Id,
+                    dataType: "text",
+                    success: function (data) {
+                        layer.close(index); //关闭弹层
+                        if (data == "success") {
+                            layer.msg("设置成功", { time: 1500 }, function () {
+                                table.reload('LAY-list-manage'); //数据刷新
+                            });
+                        } else {
+                            parent.layer.msg(data);
+                        }
+                    }
+                });
+            });
         } else if (obj.event === 'detail') {
             var tr = $(obj.tr);
             var perContent = layer.open({