Просмотр исходного кода

Merge branch 'feature-dgy-盟主储蓄金变动记录显示调整' into feature-dgy-后台测试

DuGuYang 2 лет назад
Родитель
Сommit
4335d10c5c

+ 44 - 0
Areas/Admin/Controllers/MainServer/LeadersController.cs

@@ -326,6 +326,17 @@ namespace MySystem.Areas.Admin.Controllers
                     var query = db.LeaderReserveRecord.Add(new LeaderReserveRecord()
                     var query = db.LeaderReserveRecord.Add(new LeaderReserveRecord()
                     {
                     {
                         CreateDate = DateTime.Now, //创建时间
                         CreateDate = DateTime.Now, //创建时间
+                        Sort = 11, //类型
+                        //11:盟主储蓄金增减单(兑换机具券 机具券兑换 系统增加(盟主储蓄金) 系统扣减(盟主储蓄金) 储备金购买)
+                        // 示例:+/-金额
+                        // 	盟主储蓄金:剩余盟主储蓄金
+                        // 12:可提现余额增减单(系统增加(可提现余额) 系统扣减(可提现余额))
+                        // 示例:+/-金额
+                        // 	可提现余额:剩余可提现余额
+                        // 13:盟主储蓄金减少可提现余额增加(推荐大/小盟主 商城购机 购机奖励)
+                        // 示例:-金额
+                        // 	盟主储蓄金:剩余盟主储蓄金
+                        // 	可提现余额:+金额
                         UserId = UserId, //创客
                         UserId = UserId, //创客
                         Remark = "系统扣减(盟主储蓄金)",
                         Remark = "系统扣减(盟主储蓄金)",
                         ChangeType = ChangeType,
                         ChangeType = ChangeType,
@@ -352,6 +363,17 @@ namespace MySystem.Areas.Admin.Controllers
                     var query = db.LeaderReserveRecord.Add(new LeaderReserveRecord()
                     var query = db.LeaderReserveRecord.Add(new LeaderReserveRecord()
                     {
                     {
                         CreateDate = DateTime.Now, //创建时间
                         CreateDate = DateTime.Now, //创建时间
+                        Sort = 11, //类型
+                        //11:盟主储蓄金增减单(兑换机具券 机具券兑换 系统增加(盟主储蓄金) 系统扣减(盟主储蓄金) 储备金购买)
+                        // 示例:+/-金额
+                        // 	盟主储蓄金:剩余盟主储蓄金
+                        // 12:可提现余额增减单(系统增加(可提现余额) 系统扣减(可提现余额))
+                        // 示例:+/-金额
+                        // 	可提现余额:剩余可提现余额
+                        // 13:盟主储蓄金减少可提现余额增加(推荐大/小盟主 商城购机 购机奖励)
+                        // 示例:-金额
+                        // 	盟主储蓄金:剩余盟主储蓄金
+                        // 	可提现余额:+金额
                         UserId = UserId, //创客
                         UserId = UserId, //创客
                         Remark = "系统增加(盟主储蓄金)",
                         Remark = "系统增加(盟主储蓄金)",
                         ChangeType = ChangeType,
                         ChangeType = ChangeType,
@@ -409,6 +431,17 @@ namespace MySystem.Areas.Admin.Controllers
                     var query = db.LeaderReserveRecord.Add(new LeaderReserveRecord()
                     var query = db.LeaderReserveRecord.Add(new LeaderReserveRecord()
                     {
                     {
                         CreateDate = DateTime.Now, //创建时间
                         CreateDate = DateTime.Now, //创建时间
+                        Sort = 12, //类型
+                        //11:盟主储蓄金增减单(兑换机具券 机具券兑换 系统增加(盟主储蓄金) 系统扣减(盟主储蓄金) 储备金购买)
+                        // 示例:+/-金额
+                        // 	盟主储蓄金:剩余盟主储蓄金
+                        // 12:可提现余额增减单(系统增加(可提现余额) 系统扣减(可提现余额))
+                        // 示例:+/-金额
+                        // 	可提现余额:剩余可提现余额
+                        // 13:盟主储蓄金减少可提现余额增加(推荐大/小盟主 商城购机 购机奖励)
+                        // 示例:-金额
+                        // 	盟主储蓄金:剩余盟主储蓄金
+                        // 	可提现余额:+金额
                         UserId = UserId, //创客
                         UserId = UserId, //创客
                         Remark = "系统扣减(盟主可提现余额)",
                         Remark = "系统扣减(盟主可提现余额)",
                         ChangeType = ChangeType,
                         ChangeType = ChangeType,
@@ -435,6 +468,17 @@ namespace MySystem.Areas.Admin.Controllers
                     var query = db.LeaderReserveRecord.Add(new LeaderReserveRecord()
                     var query = db.LeaderReserveRecord.Add(new LeaderReserveRecord()
                     {
                     {
                         CreateDate = DateTime.Now, //创建时间
                         CreateDate = DateTime.Now, //创建时间
+                        Sort = 12, //类型
+                        //11:盟主储蓄金增减单(兑换机具券 机具券兑换 系统增加(盟主储蓄金) 系统扣减(盟主储蓄金) 储备金购买)
+                        // 示例:+/-金额
+                        // 	盟主储蓄金:剩余盟主储蓄金
+                        // 12:可提现余额增减单(系统增加(可提现余额) 系统扣减(可提现余额))
+                        // 示例:+/-金额
+                        // 	可提现余额:剩余可提现余额
+                        // 13:盟主储蓄金减少可提现余额增加(推荐大/小盟主 商城购机 购机奖励)
+                        // 示例:-金额
+                        // 	盟主储蓄金:剩余盟主储蓄金
+                        // 	可提现余额:+金额
                         UserId = UserId, //创客
                         UserId = UserId, //创客
                         Remark = "系统增加(盟主可提现余额)",
                         Remark = "系统增加(盟主可提现余额)",
                         ChangeType = ChangeType,
                         ChangeType = ChangeType,

+ 65 - 48
Areas/Admin/Controllers/MainServer/MachineApplyController.cs

@@ -51,7 +51,7 @@ namespace MySystem.Areas.Admin.Controllers
         /// 机具申请订单列表
         /// 机具申请订单列表
         /// </summary>
         /// </summary>
         /// <returns></returns>
         /// <returns></returns>
-        public JsonResult IndexData(MachineApply data,string ApplyNo, string MakerCode, string RealName, string StoreNo, string StoreName, string StoreMakerCode, string StatusSelect, string ApplyTimeData, string SendDateData, string SendStatusSelect, string StoreTypeSelect, int page = 1, int limit = 30)
+        public JsonResult IndexData(MachineApply data, string ApplyNo, string MakerCode, string RealName, string StoreNo, string StoreName, string StoreMakerCode, string StatusSelect, string ApplyTimeData, string SendDateData, string SendStatusSelect, string StoreTypeSelect, int page = 1, int limit = 30)
         {
         {
 
 
             Dictionary<string, string> Fields = new Dictionary<string, string>();
             Dictionary<string, string> Fields = new Dictionary<string, string>();
@@ -69,7 +69,7 @@ namespace MySystem.Areas.Admin.Controllers
             //申请单号
             //申请单号
             if (!string.IsNullOrEmpty(ApplyNo))
             if (!string.IsNullOrEmpty(ApplyNo))
             {
             {
-                condition += " and ApplyNo like'" + ApplyNo + "' " ;
+                condition += " and ApplyNo like'" + ApplyNo + "' ";
             }
             }
             //创客编号
             //创客编号
             if (!string.IsNullOrEmpty(MakerCode))
             if (!string.IsNullOrEmpty(MakerCode))
@@ -97,22 +97,22 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + StoreMakerCode + "')";
                 condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + StoreMakerCode + "')";
             }
             }
             //订单状态
             //订单状态
-            if(!string.IsNullOrEmpty(StatusSelect))
+            if (!string.IsNullOrEmpty(StatusSelect))
             {
             {
                 condition += " and Status=" + StatusSelect;
                 condition += " and Status=" + StatusSelect;
             }
             }
             //发货状态
             //发货状态
-            if(!string.IsNullOrEmpty(SendStatusSelect))
+            if (!string.IsNullOrEmpty(SendStatusSelect))
             {
             {
                 condition += " and SendStatus=" + SendStatusSelect;
                 condition += " and SendStatus=" + SendStatusSelect;
             }
             }
             //仓库类型
             //仓库类型
-            if(!string.IsNullOrEmpty(StoreTypeSelect))
+            if (!string.IsNullOrEmpty(StoreTypeSelect))
             {
             {
                 condition += " and StoreType=" + StoreTypeSelect;
                 condition += " and StoreType=" + StoreTypeSelect;
             }
             }
             //申请时间
             //申请时间
-            if(!string.IsNullOrEmpty(ApplyTimeData))
+            if (!string.IsNullOrEmpty(ApplyTimeData))
             {
             {
                 string[] datelist = ApplyTimeData.Split(new string[] { " - " }, StringSplitOptions.None);
                 string[] datelist = ApplyTimeData.Split(new string[] { " - " }, StringSplitOptions.None);
                 string start = datelist[0];
                 string start = datelist[0];
@@ -120,7 +120,7 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and ApplyTime>='" + start + " 00:00:00' and ApplyTime<='" + end + " 23:59:59'";
                 condition += " and ApplyTime>='" + start + " 00:00:00' and ApplyTime<='" + end + " 23:59:59'";
             }
             }
 
 
-            if(!string.IsNullOrEmpty(SendDateData))
+            if (!string.IsNullOrEmpty(SendDateData))
             {
             {
                 string[] datelist = SendDateData.Split(new string[] { " - " }, StringSplitOptions.None);
                 string[] datelist = SendDateData.Split(new string[] { " - " }, StringSplitOptions.None);
                 string start = datelist[0];
                 string start = datelist[0];
@@ -147,8 +147,8 @@ namespace MySystem.Areas.Admin.Controllers
                 Users storeUser = db.Users.FirstOrDefault(m => m.Id == StoreUserId) ?? new Users();
                 Users storeUser = db.Users.FirstOrDefault(m => m.Id == StoreUserId) ?? new Users();
                 int StoreType = int.Parse(dic["StoreType"].ToString());
                 int StoreType = int.Parse(dic["StoreType"].ToString());
                 string StoreTypeName = "";
                 string StoreTypeName = "";
-                if(StoreType == 0) StoreTypeName = "总仓";
-                if(StoreType == 1) StoreTypeName = "分仓";
+                if (StoreType == 0) StoreTypeName = "总仓";
+                if (StoreType == 1) StoreTypeName = "分仓";
                 dic["StoreUser"] = storeUser.MakerCode + "<br />" + StoreTypeName;
                 dic["StoreUser"] = storeUser.MakerCode + "<br />" + StoreTypeName;
 
 
                 //创客信息
                 //创客信息
@@ -160,29 +160,29 @@ namespace MySystem.Areas.Admin.Controllers
                 int TopUserId = int.Parse(dic["TopUserId"].ToString());
                 int TopUserId = int.Parse(dic["TopUserId"].ToString());
                 Users tuser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
                 Users tuser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
                 dic["TopUserInfo"] = tuser.MakerCode + "<br />" + tuser.RealName;
                 dic["TopUserInfo"] = tuser.MakerCode + "<br />" + tuser.RealName;
-                
+
                 //收件人姓名-联系电话
                 //收件人姓名-联系电话
                 dic["StoreContact"] = dic["RealName"].ToString() + "<br />" + dic["Mobile"].ToString();
                 dic["StoreContact"] = dic["RealName"].ToString() + "<br />" + dic["Mobile"].ToString();
 
 
                 //订单状态
                 //订单状态
                 int Status = int.Parse(dic["Status"].ToString());
                 int Status = int.Parse(dic["Status"].ToString());
-                if(Status == -1) dic["StatusName"] = "已驳回";
-                if(Status == 0) dic["StatusName"] = "待审核";
-                if(Status == 1) dic["StatusName"] = "申请成功";
-                if(Status == 2) dic["StatusName"] = "申请失败";
+                if (Status == -1) dic["StatusName"] = "已驳回";
+                if (Status == 0) dic["StatusName"] = "待审核";
+                if (Status == 1) dic["StatusName"] = "申请成功";
+                if (Status == 2) dic["StatusName"] = "申请失败";
 
 
                 //提货方式
                 //提货方式
                 int DeliveryType = int.Parse(dic["DeliveryType"].ToString());
                 int DeliveryType = int.Parse(dic["DeliveryType"].ToString());
-                if(DeliveryType == 0) dic["DeliveryType"] = "";
-                if(DeliveryType == 1) dic["DeliveryType"] = "邮寄到付";
-                if(DeliveryType == 2) dic["DeliveryType"] = "上门自提";
+                if (DeliveryType == 0) dic["DeliveryType"] = "";
+                if (DeliveryType == 1) dic["DeliveryType"] = "邮寄到付";
+                if (DeliveryType == 2) dic["DeliveryType"] = "上门自提";
 
 
                 //发货状态
                 //发货状态
                 int SendStatus = int.Parse(dic["Status"].ToString());
                 int SendStatus = int.Parse(dic["Status"].ToString());
-                if(SendStatus == -1) dic["SendStatus"] = "已驳回";
-                if(SendStatus == 0) dic["SendStatus"] = "未发货";
-                if(SendStatus == 1) dic["SendStatus"] = "已发货";
-                
+                if (SendStatus == -1) dic["SendStatus"] = "已驳回";
+                if (SendStatus == 0) dic["SendStatus"] = "未发货";
+                if (SendStatus == 1) dic["SendStatus"] = "已发货";
+
                 //快递单号-快递名称
                 //快递单号-快递名称
                 dic["ExpressInfo"] = dic["ExpressName"].ToString() + "<br />" + dic["ExpressNo"].ToString();
                 dic["ExpressInfo"] = dic["ExpressName"].ToString() + "<br />" + dic["ExpressNo"].ToString();
             }
             }
@@ -262,28 +262,45 @@ namespace MySystem.Areas.Admin.Controllers
             MachineApply editData = db.MachineApply.FirstOrDefault(m => m.Id == Id) ?? new MachineApply();
             MachineApply editData = db.MachineApply.FirstOrDefault(m => m.Id == Id) ?? new MachineApply();
             ViewBag.data = editData;
             ViewBag.data = editData;
 
 
+            var SnNos = "";
+            var order = db.Orders.FirstOrDefault(m => m.Id == editData.QueryCount) ?? new Orders();
+            if (!string.IsNullOrEmpty(order.SnNos))
+            {
+                var sendSn = order.SnNos.Replace("\r", "").Replace("\n", ",").Split(',');
+                for (int a = 0; a < sendSn.Length; a++)
+                {
+                    SnNos += sendSn[a] + "\n";
+                }
+            }
+            ViewBag.SnNos = SnNos;
+
             Users user = db.Users.FirstOrDefault(m => m.Id == editData.UserId) ?? new Users();
             Users user = db.Users.FirstOrDefault(m => m.Id == editData.UserId) ?? new Users();
             ViewBag.MakerCode = user.MakerCode;
             ViewBag.MakerCode = user.MakerCode;
             ViewBag.RealName = user.RealName;
             ViewBag.RealName = user.RealName;
 
 
             int Status = editData.Status;
             int Status = editData.Status;
-            if(Status == 0) ViewBag.Status = "待审核";
-            if(Status == 1) ViewBag.Status = "申请成功";
-            if(Status == 2) ViewBag.Status = "申请失败";
+            if (Status == 0) ViewBag.Status = "待审核";
+            if (Status == 1) ViewBag.Status = "申请成功";
+            if (Status == 2) ViewBag.Status = "申请失败";
 
 
             int AuditResult = editData.AuditResult;
             int AuditResult = editData.AuditResult;
-            if(AuditResult == 0) ViewBag.AuditResult = "未通过";
-            if(AuditResult == 1) ViewBag.AuditResult = "通过";
+            if (AuditResult == 0) ViewBag.AuditResult = "未通过";
+            if (AuditResult == 1) ViewBag.AuditResult = "通过";
 
 
             //邮寄方式
             //邮寄方式
             int DeliveryType = editData.DeliveryType;
             int DeliveryType = editData.DeliveryType;
-            if(DeliveryType == 1) ViewBag.DeliveryType = "邮寄到付";
-            if(DeliveryType == 2) ViewBag.DeliveryType = "上门自提";
+            if (DeliveryType == 1) ViewBag.DeliveryType = "邮寄到付";
+            if (DeliveryType == 2) ViewBag.DeliveryType = "上门自提";
 
 
             //发货状态
             //发货状态
-            int SendStatus = editData.SendStatus;
-            if(SendStatus == 0) ViewBag.SendStatus = "未发货";
-            if(SendStatus == 1) ViewBag.SendStatus = "已发货";
+            // int SendStatus = editData.SendStatus;
+            // if (SendStatus == 0) ViewBag.SendStatus = "未发货";
+            // if (SendStatus == 1) ViewBag.SendStatus = "已发货";
+
+            int SendStatus = editData.Status;
+            if (SendStatus == -1) ViewBag.SendStatus = "已驳回";
+            if (SendStatus == 0) ViewBag.SendStatus = "未发货";
+            if (SendStatus == 1) ViewBag.SendStatus = "已发货";
             return View();
             return View();
         }
         }
 
 
@@ -336,7 +353,7 @@ namespace MySystem.Areas.Admin.Controllers
         }
         }
 
 
         #endregion
         #endregion
-        
+
         #region 取消机具申请订单
         #region 取消机具申请订单
 
 
         /// <summary>
         /// <summary>
@@ -351,7 +368,7 @@ namespace MySystem.Areas.Admin.Controllers
             {
             {
                 Orders order = db.Orders.FirstOrDefault(m => m.Id == apply.QueryCount);
                 Orders order = db.Orders.FirstOrDefault(m => m.Id == apply.QueryCount);
                 if (order != null)
                 if (order != null)
-                { 
+                {
                     string SwapSnExpand = apply.SwapSnExpand;
                     string SwapSnExpand = apply.SwapSnExpand;
                     if (!string.IsNullOrEmpty(SwapSnExpand))
                     if (!string.IsNullOrEmpty(SwapSnExpand))
                     {
                     {
@@ -583,17 +600,17 @@ namespace MySystem.Areas.Admin.Controllers
                 condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + StoreMakerCode + "')";
                 condition += " and UserId in (select UserId from UserForMakerCode where MakerCode='" + StoreMakerCode + "')";
             }
             }
             //订单状态
             //订单状态
-            if(!string.IsNullOrEmpty(StatusSelect))
+            if (!string.IsNullOrEmpty(StatusSelect))
             {
             {
                 condition += " and Status=" + StatusSelect;
                 condition += " and Status=" + StatusSelect;
             }
             }
             //发货状态
             //发货状态
-            if(!string.IsNullOrEmpty(SendStatusSelect))
+            if (!string.IsNullOrEmpty(SendStatusSelect))
             {
             {
                 condition += " and SendStatus=" + SendStatusSelect;
                 condition += " and SendStatus=" + SendStatusSelect;
             }
             }
             //仓库类型
             //仓库类型
-            if(!string.IsNullOrEmpty(StoreTypeSelect))
+            if (!string.IsNullOrEmpty(StoreTypeSelect))
             {
             {
                 condition += " and StoreType=" + StoreTypeSelect;
                 condition += " and StoreType=" + StoreTypeSelect;
             }
             }
@@ -615,8 +632,8 @@ namespace MySystem.Areas.Admin.Controllers
                 Users storeUser = db.Users.FirstOrDefault(m => m.Id == StoreUserId) ?? new Users();
                 Users storeUser = db.Users.FirstOrDefault(m => m.Id == StoreUserId) ?? new Users();
                 dic["StoreMakerCode"] = storeUser.MakerCode;
                 dic["StoreMakerCode"] = storeUser.MakerCode;
                 int StoreType = int.Parse(dic["StoreType"].ToString());
                 int StoreType = int.Parse(dic["StoreType"].ToString());
-                if(StoreType == 0) dic["StoreType"] = "总仓";
-                if(StoreType == 1) dic["StoreType"] = "分仓";
+                if (StoreType == 0) dic["StoreType"] = "总仓";
+                if (StoreType == 1) dic["StoreType"] = "分仓";
 
 
                 //创客信息
                 //创客信息
                 int UserId = int.Parse(dic["UserId"].ToString());
                 int UserId = int.Parse(dic["UserId"].ToString());
@@ -629,23 +646,23 @@ namespace MySystem.Areas.Admin.Controllers
                 Users tuser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
                 Users tuser = db.Users.FirstOrDefault(m => m.Id == TopUserId) ?? new Users();
                 dic["TopMakerCode"] = tuser.MakerCode;
                 dic["TopMakerCode"] = tuser.MakerCode;
                 dic["TopRealName"] = tuser.RealName;
                 dic["TopRealName"] = tuser.RealName;
-                
+
                 //订单状态
                 //订单状态
                 int Status = int.Parse(dic["Status"].ToString());
                 int Status = int.Parse(dic["Status"].ToString());
-                if(Status == 0) dic["Status"] = "待审核";
-                if(Status == 1) dic["Status"] = "申请成功";
-                if(Status == 2) dic["Status"] = "申请失败";
+                if (Status == 0) dic["Status"] = "待审核";
+                if (Status == 1) dic["Status"] = "申请成功";
+                if (Status == 2) dic["Status"] = "申请失败";
 
 
                 //提货方式
                 //提货方式
                 int DeliveryType = int.Parse(dic["DeliveryType"].ToString());
                 int DeliveryType = int.Parse(dic["DeliveryType"].ToString());
-                if(DeliveryType == 0) dic["DeliveryType"] = "";
-                if(DeliveryType == 1) dic["DeliveryType"] = "邮寄到付";
-                if(DeliveryType == 2) dic["DeliveryType"] = "上门自提";
+                if (DeliveryType == 0) dic["DeliveryType"] = "";
+                if (DeliveryType == 1) dic["DeliveryType"] = "邮寄到付";
+                if (DeliveryType == 2) dic["DeliveryType"] = "上门自提";
 
 
                 //发货状态
                 //发货状态
                 int SendStatus = int.Parse(dic["SendStatus"].ToString());
                 int SendStatus = int.Parse(dic["SendStatus"].ToString());
-                if(SendStatus == 0) dic["SendStatus"] = "未发货";
-                if(SendStatus == 1) dic["SendStatus"] = "已发货";
+                if (SendStatus == 0) dic["SendStatus"] = "未发货";
+                if (SendStatus == 1) dic["SendStatus"] = "已发货";
 
 
                 dic.Remove("UserId");
                 dic.Remove("UserId");
                 dic.Remove("TopUserId");
                 dic.Remove("TopUserId");
@@ -694,7 +711,7 @@ namespace MySystem.Areas.Admin.Controllers
 
 
 
 
 
 
-        
+
         #region 审核发货
         #region 审核发货
 
 
         public IActionResult AuditSend(string right, int Id = 0)
         public IActionResult AuditSend(string right, int Id = 0)

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

@@ -129,17 +129,6 @@ namespace MySystem.Areas.Admin.Controllers
             {
             {
                 return "创客编号不存在";
                 return "创客编号不存在";
             }
             }
-            if (pos.PreUserId > 0)
-            {
-                if (pos.BuyUserId == 0)
-                {
-                    pos.BuyUserId = user.Id;
-                }
-                if (pos.UserId == 0)
-                {
-                    pos.UserId = user.Id;
-                }
-            }
             if (pos.BindingState == 0)
             if (pos.BindingState == 0)
             {
             {
                 SpModels.BindRecord bind = spdb.BindRecord.FirstOrDefault(m => m.MerSnNo == PosSn);
                 SpModels.BindRecord bind = spdb.BindRecord.FirstOrDefault(m => m.MerSnNo == PosSn);
@@ -260,18 +249,18 @@ namespace MySystem.Areas.Admin.Controllers
                 {
                 {
                     if (AddActPrize == 1)
                     if (AddActPrize == 1)
                     {
                     {
-                        if (IsSend == 1)
-                        {
-                            RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-                            {
-                                UserId = pos.BuyUserId, //接收创客
-                                MsgType = 2,
-                                Title = "补录成功通知", //标题
-                                Summary = "您的 " + kqProducts.Name + " SN:" + pos.PosSn + "已经成功补录,请查收。",
-                                CreateDate = DateTime.Now,
-
-                            }));
-                        }
+                        // if (IsSend == 1)
+                        // {
+                        //     RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
+                        //     {
+                        //         UserId = pos.BuyUserId, //接收创客
+                        //         MsgType = 2,
+                        //         Title = "补录成功通知", //标题
+                        //         Summary = "您的 " + kqProducts.Name + " SN:" + pos.PosSn + "已经成功补录,请查收。",
+                        //         CreateDate = DateTime.Now,
+
+                        //     }));
+                        // }
                         return "激活奖励已补录";
                         return "激活奖励已补录";
                     }
                     }
                     else
                     else
@@ -368,6 +357,18 @@ namespace MySystem.Areas.Admin.Controllers
                 pos.BindMerchantId = merchant.Id;
                 pos.BindMerchantId = merchant.Id;
             }
             }
             db.SaveChanges();
             db.SaveChanges();
+            if (IsSend == 1)
+            {
+                RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
+                {
+                    UserId = pos.BuyUserId, //接收创客
+                    MsgType = 2,
+                    Title = "补录成功通知", //标题
+                    Summary = "您的 " + kqProducts.Name + " SN:" + pos.PosSn + "已经成功补录,请查收。",
+                    CreateDate = DateTime.Now,
+
+                }));
+            }
             RedisDbconn.Instance.AddList("AddTradeRecordByPosIdQueue", pos.Id.ToString());
             RedisDbconn.Instance.AddList("AddTradeRecordByPosIdQueue", pos.Id.ToString());
             function.WriteLog(DateTime.Now.ToString() + "\n" + SysUserName + "\nMakerCode:" + MakerCode + ", PosSn:" + PosSn + ", MerNo:" + MerNo + ", AddActPrize:" + AddActPrize, "机具补录日志");
             function.WriteLog(DateTime.Now.ToString() + "\n" + SysUserName + "\nMakerCode:" + MakerCode + ", PosSn:" + PosSn + ", MerNo:" + MerNo + ", AddActPrize:" + AddActPrize, "机具补录日志");
             return "success";
             return "success";
@@ -625,17 +626,6 @@ namespace MySystem.Areas.Admin.Controllers
             {
             {
                 return "创客编号不存在";
                 return "创客编号不存在";
             }
             }
-            if (pos.PreUserId > 0)
-            {
-                if (pos.BuyUserId == 0)
-                {
-                    pos.BuyUserId = user.Id;
-                }
-                if (pos.UserId == 0)
-                {
-                    pos.UserId = user.Id;
-                }
-            }
             if (pos.BindingState == 0)
             if (pos.BindingState == 0)
             {
             {
                 SpModels.BindRecord bind = spdb.BindRecord.FirstOrDefault(m => m.MerSnNo == PosSn);
                 SpModels.BindRecord bind = spdb.BindRecord.FirstOrDefault(m => m.MerSnNo == PosSn);
@@ -758,18 +748,18 @@ namespace MySystem.Areas.Admin.Controllers
                 {
                 {
                     if (AddActPrize == 1)
                     if (AddActPrize == 1)
                     {
                     {
-                        if (IsSend == 1)
-                        {
-                            RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-                            {
-                                UserId = pos.BuyUserId, //接收创客
-                                MsgType = 2,
-                                Title = "补录成功通知", //标题
-                                Summary = "您的 " + kqProducts.Name + " SN:" + pos.PosSn + "已经成功补录,请查收。",
-                                CreateDate = DateTime.Now,
-
-                            }));
-                        }
+                        // if (IsSend == 1)
+                        // {
+                        //     RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
+                        //     {
+                        //         UserId = pos.BuyUserId, //接收创客
+                        //         MsgType = 2,
+                        //         Title = "补录成功通知", //标题
+                        //         Summary = "您的 " + kqProducts.Name + " SN:" + pos.PosSn + "已经成功补录,请查收。",
+                        //         CreateDate = DateTime.Now,
+
+                        //     }));
+                        // }
                         return "激活奖励已补录";
                         return "激活奖励已补录";
                     }
                     }
                     else
                     else
@@ -867,6 +857,18 @@ namespace MySystem.Areas.Admin.Controllers
                 pos.BindMerchantId = merchant.Id;
                 pos.BindMerchantId = merchant.Id;
             }
             }
             db.SaveChanges();
             db.SaveChanges();
+            if (IsSend == 1)
+            {
+                RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
+                {
+                    UserId = pos.BuyUserId, //接收创客
+                    MsgType = 2,
+                    Title = "补录成功通知", //标题
+                    Summary = "您的 " + kqProducts.Name + " SN:" + pos.PosSn + "已经成功补录,请查收。",
+                    CreateDate = DateTime.Now,
+
+                }));
+            }
             function.WriteLog(DateTime.Now.ToString() + "\n" + SysUserName + "\nMakerCode:" + MakerCode + ", PosSn:" + PosSn + ", MerNo:" + MerNo + ", AddActPrize:" + AddActPrize, "机具补录日志");
             function.WriteLog(DateTime.Now.ToString() + "\n" + SysUserName + "\nMakerCode:" + MakerCode + ", PosSn:" + PosSn + ", MerNo:" + MerNo + ", AddActPrize:" + AddActPrize, "机具补录日志");
             return "success";
             return "success";
         }
         }
@@ -1110,6 +1112,39 @@ namespace MySystem.Areas.Admin.Controllers
             {
             {
                 return "商户" + MerNo + "已经被设置";
                 return "商户" + MerNo + "已经被设置";
             }
             }
+            if (merchant != null)
+            {
+                //立刷
+                if (pos.BrandId == 6)
+                {
+                    if (user.CertId.Substring(0, 4) == merchant.MerIdcardNo.Substring(0, 4) && user.CertId.ToUpper().Substring(user.CertId.Length - 2, 2) == merchant.MerIdcardNo.ToUpper().Substring(merchant.MerIdcardNo.Length - 2, 2) && user.RealName.Substring(0, 1) == merchant.MerchantName.Substring(0, 1))
+                    {
+                        merchant.UserId = user.Id;
+                        merchant.MerUserType = 1;
+                    }
+                    else
+                    {
+                        return "设置商户型创客和机具对应商户信息不匹配,无法设置";
+                    }
+                }
+                //其他
+                else
+                {
+                    if (string.IsNullOrEmpty(merchant.MerIdcardNo) || string.IsNullOrEmpty(merchant.MerchantName))
+                    {
+                        return "该商户资料未完善,请联系在线客服补全资料后重试";
+                    }
+                    if (user.CertId.Substring(0, 6) == merchant.MerIdcardNo.Substring(0, 6) && user.CertId.ToUpper().Substring(user.CertId.Length - 4, 4) == merchant.MerIdcardNo.ToUpper().Substring(merchant.MerIdcardNo.Length - 4, 4) && merchant.MerchantName.Contains(user.RealName))
+                    {
+                        merchant.UserId = user.Id;
+                        merchant.MerUserType = 1;
+                    }
+                    else
+                    {
+                        return "设置商户型创客和机具对应商户信息不匹配,无法设置";
+                    }
+                }
+            }
             pos.SeoTitle = user.Id.ToString();
             pos.SeoTitle = user.Id.ToString();
             pos.UserId = user.Id;
             pos.UserId = user.Id;
             if (pos.BindMerchantId == 0)
             if (pos.BindMerchantId == 0)
@@ -1128,8 +1163,8 @@ namespace MySystem.Areas.Admin.Controllers
                 }
                 }
             }
             }
             user.MerchantType = 1;
             user.MerchantType = 1;
-            merchant.UserId = user.Id;
-            merchant.MerUserType = 1;
+            // merchant.UserId = user.Id;
+            // merchant.MerUserType = 1;
             db.SetMerchantTypeRecord.Add(new SetMerchantTypeRecord()
             db.SetMerchantTypeRecord.Add(new SetMerchantTypeRecord()
             {
             {
                 CreateDate = DateTime.Now,
                 CreateDate = DateTime.Now,
@@ -1850,6 +1885,9 @@ namespace MySystem.Areas.Admin.Controllers
                 ChangeDeviceName = oldpos.DeviceName;
                 ChangeDeviceName = oldpos.DeviceName;
                 ChangeSnExpand += oldpos.PosSn + "\n";
                 ChangeSnExpand += oldpos.PosSn + "\n";
                 PublicFunction.SycnMachineCount(oldpos.BuyUserId, oldpos.BrandId);
                 PublicFunction.SycnMachineCount(oldpos.BuyUserId, oldpos.BrandId);
+
+                //同步商户交易额
+                RedisDbconn.Instance.AddList("SycnMerchantTradeQueue", "{\"OldPosId\":\"" + oldpos.LastMerchantId + "\",\"NewPosId\":\"" + newpos.LastMerchantId + "\"}");
             }
             }
             add.BackProductType = BackProductType; //退回产品类型
             add.BackProductType = BackProductType; //退回产品类型
             add.BackProductName = BackProductName; //退回产品名称
             add.BackProductName = BackProductName; //退回产品名称
@@ -2134,6 +2172,9 @@ namespace MySystem.Areas.Admin.Controllers
 
 
                         }));
                         }));
                     }
                     }
+
+                    //同步商户交易额
+                    RedisDbconn.Instance.AddList("SycnMerchantTradeQueue", "{\"OldPosId\":\"" + oldpos.LastMerchantId + "\",\"NewPosId\":\"" + newpos.LastMerchantId + "\"}");
                 }
                 }
             }
             }
             //仓库坏机换新
             //仓库坏机换新
@@ -2349,6 +2390,9 @@ namespace MySystem.Areas.Admin.Controllers
 
 
                         }));
                         }));
                     }
                     }
+
+                    //同步商户交易额
+                    RedisDbconn.Instance.AddList("SycnMerchantTradeQueue", "{\"OldPosId\":\"" + oldpos.LastMerchantId + "\",\"NewPosId\":\"" + newpos.LastMerchantId + "\"}");
                 }
                 }
             }
             }
             foreach (string sub in opData)
             foreach (string sub in opData)
@@ -2639,6 +2683,9 @@ namespace MySystem.Areas.Admin.Controllers
 
 
                     }));
                     }));
                 }
                 }
+
+                //同步商户交易额
+                RedisDbconn.Instance.AddList("SycnMerchantTradeQueue", "{\"OldPosId\":\"" + oldpos.LastMerchantId + "\",\"NewPosId\":\"" + newpos.LastMerchantId + "\"}");
             }
             }
             foreach (string sub in opData)
             foreach (string sub in opData)
             {
             {

+ 1 - 1
Areas/Admin/Views/MainServer/MachineApply/Edit.cshtml

@@ -181,7 +181,7 @@
                             <div class="layui-inline">
                             <div class="layui-inline">
                                 <label class="layui-form-label">发货SN编号:</label>
                                 <label class="layui-form-label">发货SN编号:</label>
                                 <div class="layui-input-inline">
                                 <div class="layui-input-inline">
-                                    @editData.SendSn
+                                    @ViewBag.SnNos
                                 </div>
                                 </div>
                             </div>
                             </div>
                         </div>
                         </div>

+ 1 - 0
Models/PosMachinesTwo.cs

@@ -61,5 +61,6 @@ namespace MySystem.Models
         public int RecycStatus { get; set; }
         public int RecycStatus { get; set; }
         public string OutBatchNo { get; set; }
         public string OutBatchNo { get; set; }
         public int WithholdFlag { get; set; }
         public int WithholdFlag { get; set; }
+        public int LastMerchantId { get; set; }
     }
     }
 }
 }

+ 6 - 5
Models/WebCMSEntities.cs

@@ -8939,11 +8939,8 @@ namespace MySystem.Models
 
 
             modelBuilder.Entity<Orders>(entity =>
             modelBuilder.Entity<Orders>(entity =>
             {
             {
-                entity.HasIndex(e => e.StoreId)
-                    .HasName("OrdersStoreIdIndex");
-
-                entity.HasIndex(e => new { e.UserId, e.ParentOrderId })
-                    .HasName("OrdersListIndex");
+                entity.HasIndex(e => new { e.StoreId, e.UserId, e.ParentOrderId, e.CreateDate })
+                    .HasName("OrdersIndex");
 
 
                 entity.Property(e => e.Id).HasColumnType("int(11)");
                 entity.Property(e => e.Id).HasColumnType("int(11)");
 
 
@@ -9793,6 +9790,10 @@ namespace MySystem.Models
                     .HasColumnType("bit(1)")
                     .HasColumnType("bit(1)")
                     .HasDefaultValueSql("b'0'");
                     .HasDefaultValueSql("b'0'");
 
 
+                entity.Property(e => e.LastMerchantId)
+                    .HasColumnType("int(11)")
+                    .HasComment("最后一次绑定商户号");
+
                 entity.Property(e => e.LeaderUserId).HasColumnType("int(11)");
                 entity.Property(e => e.LeaderUserId).HasColumnType("int(11)");
 
 
                 entity.Property(e => e.OpId).HasColumnType("int(11)");
                 entity.Property(e => e.OpId).HasColumnType("int(11)");

+ 2 - 2
Startup.cs

@@ -155,11 +155,11 @@ namespace MySystem
         {
         {
             Dictionary<string, Dictionary<string, string>> tables = new Dictionary<string, Dictionary<string, string>>();
             Dictionary<string, Dictionary<string, string>> tables = new Dictionary<string, Dictionary<string, string>>();
             Library.OtherMySqlConn.connstr = Configuration["Setting:SqlConnStr"];
             Library.OtherMySqlConn.connstr = Configuration["Setting:SqlConnStr"];
-            System.Data.DataTable tablecollection = Library.OtherMySqlConn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = 'KxsMainServer'");
+            System.Data.DataTable tablecollection = Library.OtherMySqlConn.dtable("select DISTINCT TABLE_NAME from information_schema.columns where table_schema = 'KxsProfitServer'");
             foreach (System.Data.DataRow subtable in tablecollection.Rows)
             foreach (System.Data.DataRow subtable in tablecollection.Rows)
             {
             {
                 Dictionary<string, string> Columns = new Dictionary<string, string>();
                 Dictionary<string, string> Columns = new Dictionary<string, string>();
-                System.Data.DataTable columncollection = Library.OtherMySqlConn.dtable("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_schema = 'KxsMainServer' and TABLE_NAME='" + subtable["TABLE_NAME"].ToString() + "'");
+                System.Data.DataTable columncollection = Library.OtherMySqlConn.dtable("select COLUMN_NAME,DATA_TYPE from information_schema.columns where table_schema = 'KxsProfitServer' and TABLE_NAME='" + subtable["TABLE_NAME"].ToString() + "'");
                 foreach (System.Data.DataRow column in columncollection.Rows)
                 foreach (System.Data.DataRow column in columncollection.Rows)
                 {
                 {
                     string datatype = column["DATA_TYPE"].ToString();
                     string datatype = column["DATA_TYPE"].ToString();