Ver Fonte

Merge branch 'DuGuYang' into develop

lichunlei há 3 anos atrás
pai
commit
53cadb1b88

+ 55 - 47
Areas/Admin/Controllers/MainServer/PosMachinesTwoChangeController.cs

@@ -129,9 +129,17 @@ namespace MySystem.Areas.Admin.Controllers
             foreach (Dictionary<string, object> dic in diclist)
             {
                 //是否真实调升/降
-                int ActivityList = int.Parse(dic["ActivityList"].ToString());
-                if (ActivityList == 1) dic["ActivityList"] = "已真实调升";
-                if (ActivityList == 2) dic["ActivityList"] = "已真实调降";
+                if (!string.IsNullOrEmpty(dic["ActivityList"].ToString()))
+                {
+                    // int ActivityList = Convert.ToInt32(dic["ActivityList"].ToString());
+                    string ActivityList = dic["ActivityList"].ToString();
+                    if (ActivityList == "1") dic["ActivityList"] = "已真实调升";
+                    if (ActivityList == "2") dic["ActivityList"] = "已真实调降";
+                }
+                if (string.IsNullOrEmpty(dic["ActivityList"].ToString()))
+                {
+                    dic["ActivityList"] = "";
+                }
                 //绑定状态
                 int BindingState = int.Parse(dic["BindingState"].ToString());
                 if (BindingState == 0) dic["BindingState"] = "未绑定";
@@ -154,8 +162,8 @@ namespace MySystem.Areas.Admin.Controllers
                 dic.Remove("StoreId");
                 //产品类型
                 dic["BrandId"] = RelationClass.GetKqProductBrandInfo(int.Parse(dic["BrandId"].ToString()));
-                //参加活动
-                dic["ActivityList"] = RelationClass.GetProfitObjectsActivesList(dic["ActivityList"].ToString());
+                // // 参加活动
+                // dic["ActivityList"] = RelationClass.GetProfitObjectsActivesList(dic["ActivityList"].ToString());
                 //绑定商户
                 int BindMerchantId = int.Parse(function.CheckInt(dic["BindMerchantId"].ToString()));
                 PosMerchantInfo bindmerchantid_MerchantInfo = db.PosMerchantInfo.FirstOrDefault(m => m.Id == BindMerchantId) ?? new PosMerchantInfo();
@@ -489,48 +497,48 @@ namespace MySystem.Areas.Admin.Controllers
                 new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("PosMachinesTwo", Fields, id);
 
             }
-            string[] lists = userIds.TrimEnd(',').Split(new char[] { ',' });
-            int times = lists.ToList().Count;
-            if (upposIds.Count > 0)
-            {
-                //调升
-                for (int i = 0; i < times; i++)
-                {
-                    var UserId = lists[i];
-                    var posInfo = db.PosMachinesTwo.Where(m => upposIds.Contains(m.Id) && m.BuyUserId == Convert.ToInt32(UserId)).ToList();
-                    string snhtml = "<div style='margin-bottom: .48rem;'>";
-                    foreach (var items in posInfo)
-                    {
-                        var mer = db.PosMerchantInfo.FirstOrDefault(m => m.Id == items.BindMerchantId);
-                        string Name = mer.MerchantName;
-                        if (mer.BrandId == 2)
-                        {
-                            if (Name.Contains("-"))
-                            {
-                                Name = Name.Split('-')[1];
-                            }
-                            else if (Name.Contains("_"))
-                            {
-                                Name = Name.Split('_')[1];
-                            }
-                        }
-                        var brand = db.KqProducts.FirstOrDefault(m => m.Id == items.BrandId);
-                        snhtml += "<div style='margin-bottom: .48rem;'><div class='f16'>商户姓名:" + Name + "</div>";
-                        snhtml += "<div class='f16'>机具品牌:" + brand.Name + "</div>";
-                        snhtml += "<div class='f16'>SN:" + items.PosSn + "</div></div>";
-                    }
-                    snhtml += "</div>";
-                    RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
-                    {
-                        UserId = Convert.ToInt32(UserId), //创客
-                        Title = "商户费率变更通知", //标题
-                        Content = "<div class='f16' style='margin-bottom: .72rem'>您的部分机具已绑定超过180天,刷卡费率已自动变更为0.63%,如需调整费率,请前往我的商户-商户详情中调整费率</div>" + snhtml, //内容
-                        Summary = "您的部分机具已绑定超过180天,刷卡费率已自动变更为0.63%,如需调整费率,请前往我的商户-商户详情中调整费率",
-                        CreateDate = DateTime.Now,
-
-                    }));
-                }
-            }
+            // string[] lists = userIds.TrimEnd(',').Split(new char[] { ',' });
+            // int times = lists.ToList().Count;
+            // if (upposIds.Count > 0)
+            // {
+            //     //调升
+            //     for (int i = 0; i < times; i++)
+            //     {
+            //         var UserId = lists[i];
+            //         var posInfo = db.PosMachinesTwo.Where(m => upposIds.Contains(m.Id) && m.BuyUserId == Convert.ToInt32(UserId)).ToList();
+            //         string snhtml = "<div style='margin-bottom: .48rem;'>";
+            //         foreach (var items in posInfo)
+            //         {
+            //             var mer = db.PosMerchantInfo.FirstOrDefault(m => m.Id == items.BindMerchantId);
+            //             string Name = mer.MerchantName;
+            //             if (mer.BrandId == 2)
+            //             {
+            //                 if (Name.Contains("-"))
+            //                 {
+            //                     Name = Name.Split('-')[1];
+            //                 }
+            //                 else if (Name.Contains("_"))
+            //                 {
+            //                     Name = Name.Split('_')[1];
+            //                 }
+            //             }
+            //             var brand = db.KqProducts.FirstOrDefault(m => m.Id == items.BrandId);
+            //             snhtml += "<div style='margin-bottom: .48rem;'><div class='f16'>商户姓名:" + Name + "</div>";
+            //             snhtml += "<div class='f16'>机具品牌:" + brand.Name + "</div>";
+            //             snhtml += "<div class='f16'>SN:" + items.PosSn + "</div></div>";
+            //         }
+            //         snhtml += "</div>";
+            //         RedisDbconn.Instance.AddList("MsgPersonalQueue", Newtonsoft.Json.JsonConvert.SerializeObject(new MsgPersonal()
+            //         {
+            //             UserId = Convert.ToInt32(UserId), //创客
+            //             Title = "商户费率变更通知", //标题
+            //             Content = "<div class='f16' style='margin-bottom: .72rem'>您的部分机具已绑定超过180天,刷卡费率已自动变更为0.63%,如需调整费率,请前往我的商户-商户详情中调整费率</div>" + snhtml, //内容
+            //             Summary = "您的部分机具已绑定超过180天,刷卡费率已自动变更为0.63%,如需调整费率,请前往我的商户-商户详情中调整费率",
+            //             CreateDate = DateTime.Now,
+
+            //         }));
+            //     }
+            // }
             db.SaveChanges();
             return "success";
         }

+ 3 - 3
Areas/Admin/Controllers/MainServer/PosMachinesTwoController.cs

@@ -126,11 +126,11 @@ namespace MySystem.Areas.Admin.Controllers
                 if (ActivationState == 0) dic["ActivationState"] = "未激活";
                 if (ActivationState == 1) dic["ActivationState"] = "已激活";
                 //所属创客
-                int UserId = int.Parse(function.CheckInt(dic["UserId"].ToString()));
-                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == UserId) ?? new Users();
+                int BuyUserId = int.Parse(function.CheckInt(dic["BuyUserId"].ToString()));
+                Users userid_Users = db.Users.FirstOrDefault(m => m.Id == BuyUserId) ?? new Users();
                 dic["UserIdMakerCode"] = userid_Users.MakerCode;
                 dic["UserIdRealName"] = userid_Users.RealName;
-                dic.Remove("UserId");
+                dic.Remove("BuyUserId");
                 //所属仓库
                 int StoreId = int.Parse(function.CheckInt(dic["StoreId"].ToString()));
                 StoreHouse storeid_StoreHouse = db.StoreHouse.FirstOrDefault(m => m.Id == StoreId) ?? new StoreHouse();

+ 46 - 0
Areas/Admin/Controllers/MainServer/StoreHouseController.cs

@@ -731,6 +731,7 @@ namespace MySystem.Areas.Admin.Controllers
                         var user = db.Users.FirstOrDefault(m => m.Id == toStore.UserId) ?? new Users();
                         var userAccount = db.UserAccount.FirstOrDefault(m => m.Id == toStore.UserId) ?? new UserAccount();
                         var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == Convert.ToInt32(BrandId)) ?? new KqProducts();
+                        var fuserMachineData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == userForMakerCode.UserId+ "_" + brandInfo.Id);
                         if (brandInfo.Name.Contains("电签"))
                         {
                             amount = 200;
@@ -816,6 +817,28 @@ namespace MySystem.Areas.Admin.Controllers
 
                                 posInfo.StoreId = toStore.Id;
                                 posInfo.BuyUserId = 0;
+                                posInfo.UserId = 0;
+                                posInfo.RecycEndDate = null;
+                                posInfo.PosSnType = 0;
+                                posInfo.BindMerchantId = 0;
+                                posInfo.ActivityList = null;
+                                posInfo.ScanQrTrade = 0;
+                                posInfo.DebitCardTrade = 0;
+                                posInfo.PrizeParams = null;
+                                posInfo.IsVip = 0;
+                                posInfo.CreditTrade = 0;
+                                posInfo.UserNav = null;
+                                posInfo.TransferTime = null;
+                                posInfo.IsPurchase = 0;
+                                posInfo.BindingTime = null;
+                                posInfo.BindingState = 0;
+                                posInfo.ActivationTime = null;
+                                posInfo.ActivationState = 0;
+                                posInfo.LeaderUserId = 0;
+                                posInfo.PreUserId = 0;
+                                posInfo.IsFirst = 0;
+                                fuserMachineData.TotalMachineCount -= 1;
+                                fuserMachineData.UnBindCount -= 1;
                                 toStore.TotalNum += 1;
                                 toStore.LaveNum += 1;
                                 fromStore.TotalNum -= 1;
@@ -879,7 +902,30 @@ namespace MySystem.Areas.Admin.Controllers
 
                                 posInfo.StoreId = toStore.Id;
                                 posInfo.BuyUserId = 0;
+                                posInfo.UserId = 0;
+                                posInfo.RecycEndDate = null;
+                                posInfo.PosSnType = 0;
+                                posInfo.BindMerchantId = 0;
+                                posInfo.ActivityList = null;
+                                posInfo.ScanQrTrade = 0;
+                                posInfo.DebitCardTrade = 0;
+                                posInfo.PrizeParams = null;
+                                posInfo.IsVip = 0;
+                                posInfo.CreditTrade = 0;
+                                posInfo.UserNav = null;
+                                posInfo.TransferTime = null;
+                                posInfo.IsPurchase = 0;
+                                posInfo.BindingTime = null;
+                                posInfo.BindingState = 0;
+                                posInfo.ActivationTime = null;
+                                posInfo.ActivationState = 0;
+                                posInfo.LeaderUserId = 0;
+                                posInfo.PreUserId = 0;
+                                posInfo.IsFirst = 0;
+                                fuserMachineData.TotalMachineCount -= 1;
+                                fuserMachineData.UnBindCount -= 1;
                                 toStore.LaveNum += 1;
+                                toStore.TotalNum += 1;
                                 db.SaveChanges();
                             }
                             db.SaveChanges();