Pārlūkot izejas kodu

金控解绑排除激活机具

lcl 2 gadi atpakaļ
vecāks
revīzija
0086e914d6

+ 1 - 1
AppStart/Helper/StatService.cs

@@ -315,7 +315,7 @@ namespace MySystem
         //金控活动机返奖励
         private void doJk30(WebCMSEntities db, PosMachinesTwo pos, PosMerchantInfo merchant, int GetUserId, string ParentNav, int TopUserId)
         {
-            DateTime start = DateTime.Parse("2022-04-07 00:00:00");
+            DateTime start = DateTime.Parse("2022-04-06 00:00:00");
             DateTime end = DateTime.Parse("2022-07-05 00:00:00");
             if((pos.BrandId == 1 || pos.BrandId == 3) && pos.CreateDate >= start && pos.CreateDate < end)
             {

+ 31 - 78
AppStart/Helper/SycnSpServer/SycnSpBindService.cs

@@ -39,90 +39,43 @@ namespace MySystem
                         {
                             if(Bind.Field1 == "解绑" && Bind.ProductType == "1")
                             {
-                                // string PosSn = Bind.MerSnNo;
-                                // string MerNo = Bind.MerNo;
-                                // PxcModels.MachineForSnNo forSnNo = db.MachineForSnNo.FirstOrDefault(m => m.SnNo == PosSn);
-                                // PxcModels.MachineForMerNo forMerNo = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == MerNo);
-                                // PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.Id == forSnNo.SnId);
-                                // if (pos.ActivationState == 0 && pos.BuyUserId > 0 && pos.BindingState == 0)
-                                // {
-                                //     if (forMerNo != null)
-                                //     {
-                                //         db.MachineForMerNo.Remove(forMerNo);
-                                //         db.SaveChanges();
-                                //     }
-                                //     db.MachineUnBind.Add(new PxcModels.MachineUnBind()
-                                //     {
-                                //         CreateDate = DateTime.Now,
-                                //         MerchantId = pos.BindMerchantId,
-                                //         AuditDate = DateTime.Now,
-                                //         AuditDesc = "金控推送解绑",
-                                //         AuditStatus = 1,
-                                //         SnNo = pos.PosSn,
-                                //         BrandId = pos.BrandId,
-                                //         UserId = pos.BuyUserId,
-                                //         ApplyNo = "U" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + function.get_Random(8),
-                                //     });
-                                //     pos.BindMerchantId = 0;
-                                //     pos.BindingState = 0;
-                                //     pos.BindingTime = DateTime.Parse("1900-01-01");
-                                //     pos.UserId = pos.BuyUserId;
-                                //     string IdBrand = pos.BuyUserId + "_" + pos.BrandId;
-                                //     PxcModels.UserMachineData userData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
-                                //     if (userData == null)
-                                //     {
-                                //         userData = db.UserMachineData.Add(new PxcModels.UserMachineData()
-                                //         {
-                                //             IdBrand = IdBrand,
-                                //         }).Entity;
-                                //         db.SaveChanges();
-                                //     }
-                                //     userData.BindCount -= 1;
-                                //     userData.UnBindCount += 1;
-                                //     db.SaveChanges();
-
-                                //     BindRecord edit = spdb.BindRecord.FirstOrDefault(m => m.Id == Bind.Id);
-                                //     if (edit != null)
-                                //     {
-                                //         edit.Status = 2;
-                                //         spdb.SaveChanges();
-                                //     }
-                                // }
-
-                                // 删除对应商户
-                                PxcModels.MachineForMerNo forMerNo = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == Bind.MerNo);
-                                if (forMerNo != null)
-                                {
-                                    db.MachineForMerNo.Remove(forMerNo);
-                                    db.SaveChanges();
-                                }
+                                // 删除对应商户,激活机具除外
                                 PxcModels.PosMachinesTwo pos = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == Bind.MerSnNo) ?? new PxcModels.PosMachinesTwo();
-                                PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
-                                if(merchant != null)
+                                if(pos.ActivationState == 0)
                                 {
-                                    //备份解绑的商户信息
-                                    CustomerSqlConn.op("insert into PosMerchantInfoBak select * from PosMerchantInfo where Id=" + pos.BindMerchantId, MysqlConn.SqlConnStr);
-                                    db.SaveChanges();
-                                    pos.BindMerchantId = 0;
-                                    pos.BindingState = 0;
-                                    pos.BindingTime = null;
-                                    db.PosMerchantInfo.Remove(merchant);
-                                    db.SaveChanges();
-                                }
+                                    PxcModels.MachineForMerNo forMerNo = db.MachineForMerNo.FirstOrDefault(m => m.MerNo == Bind.MerNo);
+                                    if (forMerNo != null)
+                                    {
+                                        db.MachineForMerNo.Remove(forMerNo);
+                                        db.SaveChanges();
+                                    }
+                                    PxcModels.PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == pos.BindMerchantId);
+                                    if(merchant != null)
+                                    {
+                                        //备份解绑的商户信息
+                                        CustomerSqlConn.op("insert into PosMerchantInfoBak select * from PosMerchantInfo where Id=" + pos.BindMerchantId, MysqlConn.SqlConnStr);
+                                        db.SaveChanges();
+                                        pos.BindMerchantId = 0;
+                                        pos.BindingState = 0;
+                                        pos.BindingTime = null;
+                                        db.PosMerchantInfo.Remove(merchant);
+                                        db.SaveChanges();
+                                    }
 
-                                string IdBrand = pos.BuyUserId + "_" + pos.BrandId;
-                                PxcModels.UserMachineData userData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
-                                if (userData == null)
-                                {
-                                    userData = db.UserMachineData.Add(new PxcModels.UserMachineData()
+                                    string IdBrand = pos.BuyUserId + "_" + pos.BrandId;
+                                    PxcModels.UserMachineData userData = db.UserMachineData.FirstOrDefault(m => m.IdBrand == IdBrand);
+                                    if (userData == null)
                                     {
-                                        IdBrand = IdBrand,
-                                    }).Entity;
+                                        userData = db.UserMachineData.Add(new PxcModels.UserMachineData()
+                                        {
+                                            IdBrand = IdBrand,
+                                        }).Entity;
+                                        db.SaveChanges();
+                                    }
+                                    userData.BindCount -= 1;
+                                    userData.UnBindCount += 1;
                                     db.SaveChanges();
                                 }
-                                userData.BindCount -= 1;
-                                userData.UnBindCount += 1;
-                                db.SaveChanges();
 
                                 BindRecord edit = spdb.BindRecord.FirstOrDefault(m => m.Id == Bind.Id);
                                 if (edit != null)