Forráskód Böngészése

暂存箱删除限制

DuGuYang 1 éve
szülő
commit
808dd1d57a

+ 13 - 5
Areas/Api/Controllers/v1/MainServer/MerchantInfoController.cs

@@ -590,13 +590,21 @@ namespace MySystem.Areas.Api.Controllers.v1
             MerchantInfo edit = maindb.MerchantInfo.FirstOrDefault(m => m.Id == Id && m.UserId == UserId);
             if (edit != null)
             {
-                maindb.MerchantInfo.Remove(edit);
-                MerchantAddInfo editadd = maindb.MerchantAddInfo.FirstOrDefault(m => m.Id == Id);
-                if (editadd != null)
+                if (edit.Sort == 0 && edit.Status == 0 && edit.QueryCount == 0)
                 {
-                    maindb.MerchantAddInfo.Remove(editadd);
+
+                    maindb.MerchantInfo.Remove(edit);
+                    MerchantAddInfo editadd = maindb.MerchantAddInfo.FirstOrDefault(m => m.Id == Id);
+                    if (editadd != null)
+                    {
+                        maindb.MerchantAddInfo.Remove(editadd);
+                    }
+                    maindb.SaveChanges();
+                }
+                else
+                {
+                    return new AppResultJson() { Status = "-1", Info = "该商户资料已提交过,不能删除", Data = Obj };
                 }
-                maindb.SaveChanges();
             }
             return new AppResultJson() { Status = "1", Info = "", Data = Obj };
         }